To restrict your build task to release/ branches only, add a conditional when block to that specific task in your pipeline.yaml.
Here are the two standard formats depending on how your pipeline engine parses strings:
Option 1: Standard Wildcard (Glob)
- ref: java-gradle-build
name: gradle-build
when:
branch: "release/*"
Option 2: Regular Expression
If the standard wildcard syntax doesn't filter correctly, switch to a strict regex anchor:
- ref: java-gradle-build
name: gradle-build
when:
branch: "^release/.*$"
Key Checklist
-
Indentation: Ensure
when:aligns vertically withref:andname:, andbranch:is indented right below it. - Scope: Placing this block inside the task array only skips this specific step. To stop the entire pipeline early, you must move the condition up to the stage or trigger level.
Top comments (0)