Skip to content
This repository has been archived by the owner on Oct 24, 2023. It is now read-only.

Commit

Permalink
chore: add job exclusion regex to jenkinsfile (#1922)
Browse files Browse the repository at this point in the history
  • Loading branch information
devigned authored and jackfrancis committed Sep 9, 2019
1 parent be9e921 commit 50fa841
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,15 @@ stage ("discover tests") {
k8sVersions.each { version ->
def jobName = cfgFile.path[cfgFile.path.indexOf("test_cluster_configs/") + 21..-6] // remove leader and trailing .json
jobName = "v${version}/${jobName}"
if(params.JOB_FOCUS_REGEX.trim() && !(jobName ==~ ~/${params.JOB_FOCUS_REGEX}/)){
if(params.INCLUDE_JOB_REGEX.trim() && !(jobName ==~ ~/${params.INCLUDE_JOB_REGEX}/)){
// the job is focused, so only run jobs matching the regex
echo("This run is limited to jobs matching ${params.JOB_FOCUS_REGEX}; not running ${jobName}")
echo("This run is limited to jobs matching ${params.INCLUDE_JOB_REGEX}; not running ${jobName}")
return // this is a continue and will not exit the entire iteration
}

if(params.EXCLUDE_JOB_REGEX.trim() && (jobName ==~ ~/${params.EXCLUDE_JOB_REGEX}/)){
// the job is focused, so only run jobs matching the regex
echo("This run excludes jobs matching ${params.EXCLUDE_JOB_REGEX}; not running ${jobName}")
return // this is a continue and will not exit the entire iteration
}

Expand Down

0 comments on commit 50fa841

Please sign in to comment.