Skip to content

Commit

Permalink
[CI] skip stages if only docs changes (elastic#18315)
Browse files Browse the repository at this point in the history
  • Loading branch information
v1v authored May 8, 2020
1 parent da1ba72 commit c88f07f
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,10 @@ pipeline {
}
}
stage('Build and Test'){
when {
beforeAgent true
expression { return env.ONLY_DOCS == "false" }
}
failFast false
parallel {
stage('Elastic Agent x-pack'){
Expand Down Expand Up @@ -1100,6 +1104,23 @@ def loadConfigEnvVars(){
generatorPatterns.addAll(getVendorPatterns('generator/common/beatgen'))
generatorPatterns.addAll(getVendorPatterns('metricbeat/beater'))
env.BUILD_GENERATOR = isChangedOSSCode(generatorPatterns)

// Skip all the stages for changes only related to the documentation
env.ONLY_DOCS = isDocChangedOnly()
}

/**
This method verifies if the changeset for the current pull request affect only changes related
to documentation, such as asciidoc and png files.
*/
def isDocChangedOnly(){
if (params.runAllStages || !env.CHANGE_ID?.trim()) {
log(level: 'INFO', text: 'Speed build for docs only is disabled for branches/tags or when forcing with the runAllStages parameter.')
return 'false'
} else {
log(level: "INFO", text: 'Check if the speed build for docs is enabled.')
return isGitRegionMatch(patterns: ['.*\\.(asciidoc|png)'], shouldMatchAll: true)
}
}

/**
Expand Down

0 comments on commit c88f07f

Please sign in to comment.