DEV Community

Query Filter
Query Filter

Posted on

docker-190

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/*"

Enter fullscreen mode Exit fullscreen mode

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/.*$"

Enter fullscreen mode Exit fullscreen mode

Key Checklist

  • Indentation: Ensure when: aligns vertically with ref: and name:, and branch: 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)