Run stage when branch name matches | jenkinsfile when branch
MotivationCommonlypeoplewanttorunparticularstageswhentheymatchaspecificbranchname(s).Wewouldliketomakethispatternaccessibleintheeditor.Declarativeallowstheuseofwhentoconditionthestageexecutionlike:stage(second){agentlabel:some-nodebranch"master"when{env.BRANCH==master}}However,thisisntexactlywhatwewouldconsider"friendly"foraneditoraccessiblefeature(thoughwhenwillbesupportedviaatextarea)andthedeveloperwouldhavetolearntheScriptsyntaxtouseitcorrectly.SolutionWewouldliketoformalisethepatterninaw...
Motivation
Commonly people want to run particular stages when they match a specific branch name(s). We would like to make this pattern accessible in the editor.
Declarative allows the use of when to condition the stage execution like:
stage(second) { agent label:some-node branch "master" when { env.BRANCH == master } }However, this isnt exactly what we would consider "friendly" for an editor accessible feature (though when will be supported via a text area) and the developer would have to learn the Script syntax to use it correctly.
Solution
We would like to formalise the pattern in a way that is more Editor and user friendly with the introduction of branch. Ideally we could tell from BO if the user has skipped via when or via branch.
Example - match single branchThis stage would only be executed if master was the name of the current branch.
stage(deploy to staging) { agent lab...