Uploaded image for project: 'Bitbucket Cloud'
  1. Bitbucket Cloud
  2. BCLOUD-22157

Create a global after-script section

XMLWordPrintable

    • Our product teams collect and evaluate feedback from a number of different sources. To learn more about how we use customer feedback in the planning process, check out our new feature policy.

      This request is for allowing the creation of one single after-script section after all steps of a given Bitbucket Pipelines builds. This "global" after-script should have an effect on all steps of the build.

      Currently, the after-script section is applied by step.

      Workaround

      If users want to have the same after-script section applied to all steps, they can create an after-script block using anchors and reference it on all steps. Below is an example of the same after-script section being applied to two steps of the same build:

      definitions:
        steps: &after-script-cleanup
          after-script:
            - echo "after script has run!"
      
      image: atlassian/default-image:3
      pipelines:
        default:
          - step:
              name: 'Step 1'
              script:
                  - echo 'Step 1 has run!'
              <<: *after-script-cleanup
          - step:
              name: 'Step 2'
              script:
                - echo 'Step 2 has run!'
              <<: *after-script-cleanup
      

              Unassigned Unassigned
              d5ac2d7527d5 Bruno
              Votes:
              2 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved: