Skip to content

Commit

Permalink
Fix jenkins match patterns (#17573) (#17705)
Browse files Browse the repository at this point in the history
* Fix jenkins match patterns

The helper scripts in jenkins expect patterns to be configured as
regular expressions, not glob patterns.

* No dollar

Co-authored-by: Steffen Siering <steffen.siering@elastic.co>
  • Loading branch information
ycombinator and Steffen Siering authored Apr 14, 2020
1 parent f514120 commit 5b1d326
Showing 1 changed file with 15 additions and 13 deletions.
28 changes: 15 additions & 13 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -779,6 +779,8 @@ def reportCoverage(){
}
}

// isChanged treats the patterns as regular expressions. In order to check if
// any file in a directoy is modified use `^<path to dir>/.*`.
def isChanged(patterns){
return (
params.runAllStages
Expand All @@ -788,25 +790,25 @@ def isChanged(patterns){

def isChangedOSSCode(patterns) {
def always = [
"Jenkinsfile",
"^vendor/*",
"^libbeat/*",
"^testing/*",
"^dev-tools/*",
"^\\.ci/*",
"^Jenkinsfile",
"^vendor/.*",
"^libbeat/.*",
"^testing/.*",
"^dev-tools/.*",
"^\\.ci/.*",
]
return isChanged(always + patterns)
}

def isChangedXPackCode(patterns) {
def always = [
"Jenkinsfile",
"^vendor/*",
"^libbeat/*",
"^dev-tools/*",
"^testing/*",
"^Jenkinsfile",
"^vendor/.*",
"^libbeat/.*",
"^dev-tools/.*",
"^testing/.*",
"^x-pack/libbeat/.*",
"^\\.ci/*",
"^\\.ci/.*",
]
return isChanged(always + patterns)
}
Expand Down Expand Up @@ -885,7 +887,7 @@ def loadConfigEnvVars(){
// The Kubernetes test use Filebeat and Metricbeat, but only need to be run
// if the deployment scripts have been updated. No Beats specific testing is
// involved.
env.BUILD_KUBERNETES = isChanged(["^deploy/kubernetes/*"])
env.BUILD_KUBERNETES = isChanged(["^deploy/kubernetes/.*"])

env.BUILD_GENERATOR = isChangedOSSCode(["^generator/.*"])

Expand Down

0 comments on commit 5b1d326

Please sign in to comment.