Bitbucket pipelines conditional trigger mode

  Kiến thức lập trình

I need to dynamically set the trigger of a step to manual or automatic based on the value of an ENV VAR.

my actual code:

definitions:
  steps:
    - step: &setup
        name: Setup
        script:
          - echo "Initial setup!"
          - echo 'export V_DELETE_CLUSTER="$V_DELETE_CLUSTER"' >> env.sh
        artifacts:
          - env.sh
    - step: &delete_cluster
        name: Delete cluster
        script:
          - |
            source ./env.sh
            if [ "$V_DELETE_CLUSTER" == "true" ]; then
              echo "Deleting cluster.."
            fi
  pipelines:
  custom:
    custom-one:
      - variables:
          - name: V_DELETE__CLUSTER
            default: "true"
      - step: *setup
      - step: *delete_cluster

I want to have the delete_cluster step to be triggered automatic or manual if V_DELETE_CLUSTER value is true or false.

I tried to add trigger: manual using condition with no luck.

LEAVE A COMMENT