Reputation: 65
I am trying to select branches with branch names starting with release.
stage("Upload Artifacts") {
when {
expression {
return env.BRANCH_NAME == "release/*"
}
}
steps {
...
...
}
}
The above code is not picking up my release branch and is simply skipping the stage.
Stage "Upload Artifacts" skipped due to when conditional
Upvotes: 0
Views: 348
Reputation: 65
when {
expression {
return (env.BRANCH_NAME).startsWith('release')
}
}
Upvotes: 0
Reputation: 1334
You are comparing the branch name with the verbatim string release/*
. If there is only one branch called "release"
just compare with that. If you wanted to use the *
as a wild card you should use BRANCH_NAME.startsWith('release')
or look into patterns in groovy.
Upvotes: 2