Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Skip a step in a stage

Pedro Arenas Parra
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
April 21, 2026

Hi, i read about the dynamic condition in steps and try for make a stage like "deploy" but using steps with conditions for things like: build and publish image but not run an infra deploy.

like this.

deploy-to-dev:
      - variables:
          - name: STEPS_TO_RUN
            default: build-publish-deploy
            allowed-values:
              - build-publish-deploy
              - build-publish-only
              - deploy-only
      - stage:
          name: Deploy on DEV
          deployment: dev
          steps:
            - step:
                <<: *def-common-variables-step
                name: Generate Common Vars
            - step:
                <<: *def-build-docker-image-step
                name: Build Image
                condition:
                  state: STEPS_TO_RUN == "build-publish-deploy" || STEPS_TO_RUN == "build-publish-only"
            - step:
                <<: *def-publish-docker-image-step
                name: Publish Image
                condition:
                  state: STEPS_TO_RUN == "build-publish-deploy" || STEPS_TO_RUN == "build-publish-only"
            - step:
                <<: *def-eks-deploy-step
                name: Deploy EKS CRONJOB
                condition:
                  state: STEPS_TO_RUN == "build-publish-deploy" || STEPS_TO_RUN == "deploy-only"




but when run the pipeline i get an error for: A step within the stage can't contain a condition. The condition must be defined on the stage.

exists a way to make this and not mess with a script in the step?

1 answer

0 votes
Aron Gombas _Midori_
Community Champion
April 22, 2026

@Pedro Arenas Parra 

AFAIK this is a known limitation in Bitbucket Pipelines: conditions are not supported on individual steps inside a stage. They can only be applied at the stage level itself.

I asked the AI and from the suggestion to me it seems that the best workaround is this:

Split the single stage into multiple stages, each with its own condition. It looks a bit verbose, but it should work and would be YAML-native (no need for scripts).

Pedro Arenas Parra
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
April 22, 2026

you can use multiple stages in a custom trigger? have any reference or example for try?

Aron Gombas _Midori_
Community Champion
April 22, 2026

Given that...

  1. There is an example here where multiple stages are under the same parent.
  2. The doc also says that stage is allowed under a custom parent.

I think it is legal to have multiple stages under a single custom.

Something like this:

Custom-Trigger-Stages-YAML-04-22-2026_05_59_PM.png

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events