Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: disable stages if only docs changes or .github #2877

Closed
wants to merge 3 commits into from
Closed
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion .ci/Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,16 @@ pipeline {
deleteDir()
gitCheckout(basedir: "${BASE_DIR}")
stashV2(name: 'source', bucket: "${JOB_GCS_BUCKET}", credentialsId: "${JOB_GCS_CREDENTIALS}")
dir("${BASE_DIR}"){
// Skip all the stages except check Go sources for changeset's with asciidoc, md or .github changes only
setEnvVar('ONLY_DOCS', isGitRegionMatch(patterns: [ '(.*\\.(asciidoc|md)|^\\.github/.*)' ], shouldMatchAll: true).toString())
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We want to run mage check if .github/CODEOWNERS change (see #2768). If this is a problem we could extract this to a different target that is always run, though mage check is fast now.

}
}
}
stage('Check Go sources') {
when {
expression { return env.ONLY_DOCS == "false" }
}
steps {
dir("${BASE_DIR}"){
withMageEnv(){
Expand All @@ -54,6 +61,9 @@ pipeline {
}
}
stage('Check integrations') {
when {
expression { return env.ONLY_DOCS == "false" }
}
Comment on lines +61 to +63
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Packages have generated content in their README.md files, elastic-package lint or elastic-package check should be executed if doc files are changed, to ensure that the generated content hasn't been unexpectedly modified.

Maybe instead of having the condition here for the whole stage, it could be after the sh that runs elastic-package check below.

steps {
script {
dir("${BASE_DIR}/packages") {
Expand Down Expand Up @@ -115,7 +125,9 @@ pipeline {
}
post {
always {
publishCoverageReports()
whenTrue(env.ONLY_DOCS == "false") {
publishCoverageReports()
}
}
cleanup {
notifyBuildResult(prComment: true)
Expand Down