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

Ability to run a set of commands before every pipeline, like "before_script" in gitlab-ci

    • 3
    • 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.

      Add "before_script" keyword to pipelines like in gitlab-ci.
      Should contains the list of Bash commands that are executed in sequence on zero step, before everything.

            [BCLOUD-13773] Ability to run a set of commands before every pipeline, like "before_script" in gitlab-ci

            This ticket really made me realize Bitbucket has no grasp of its competition. When you create a product, you test why your competition is better and adapt. Bitbucket pipelines not only miss basic capabilities, but they haven't even adapted to be something different or new. It seems like they're just scraping by knowing that they don't make a good product. before_script in gitlab ci is such a basic function (that helps a ton in my terraform pipelines in gitlab). Without this feature, pipeline code isn't DRY (don't repeat yourself) and comes down to editing the same line in 15 different places when I want to make a change.

            Shubham Pai added a comment - This ticket really made me realize Bitbucket has no grasp of its competition. When you create a product, you test why your competition is better and adapt. Bitbucket pipelines not only miss basic capabilities, but they haven't even adapted to be something different or new. It seems like they're just scraping by knowing that they don't make a good product. before_script in gitlab ci is such a basic function (that helps a ton in my terraform pipelines in gitlab). Without this feature, pipeline code isn't DRY (don't repeat yourself) and comes down to editing the same line in 15 different places when I want to make a change.

            Operations added a comment -

            Just ran into this issue myself. My pipeline consists of the same steps for backend but rebuilds 20 resource bundles that need to be compiled down into 20 artifacts for deploy on separate servers. My YAML file is huge and full of duplicates. 😬  Would love to be able to call a YAML anchor an initialize with a quick variable (resource name).

            Operations added a comment - Just ran into this issue myself. My pipeline consists of the same steps for backend but rebuilds 20 resource bundles that need to be compiled down into 20 artifacts for deploy on separate servers. My YAML file is huge and full of duplicates. 😬  Would love to be able to call a YAML anchor an initialize with a quick variable (resource name).

            This would be really useful so that we can use the YAML anchors so we can reuse steps but plumb in extra vars to the shared steps.

             

             

            image: atlassian/default-image:2

            definitions:
            steps:

            • step: &build-test
              name: Build and test
              script:
            • echo "Testing and building $foo"

            pipelines:
            default:

            • step:
              <<: *build-test
              name: Testing on Default
              before_script:
            • export foo='bar'

             

            Kevin Smith added a comment - This would be really useful so that we can use the YAML anchors so we can reuse steps but plumb in extra vars to the shared steps.     image: atlassian/default-image:2 definitions: steps: step: &build-test name: Build and test script: echo "Testing and building $foo" pipelines: default: step: <<: *build-test name: Testing on Default before_script: export foo='bar'  

            Matt Ryall added a comment -

            I'm reviewing tickets and unfortunately this is still a fair way down our list of improvements for Pipelines. We're working on more highly voted requests like deployment tracking and test reporting right now.

            Matt Ryall added a comment - I'm reviewing tickets and unfortunately this is still a fair way down our list of improvements for Pipelines. We're working on more highly voted requests like deployment tracking and test reporting right now.

            Issue BCLOUD-14542 was marked as a duplicate of this issue.

            Matt Ryall added a comment - Issue BCLOUD-14542 was marked as a duplicate of this issue.

            Matt Ryall added a comment -

            Thanks for the additional information.

            We don't have any plans to address this in the short term, so I've opened this ticket so we can capture additional votes from customers and feedback on its importance relative to other requests.

            Matt Ryall added a comment - Thanks for the additional information. We don't have any plans to address this in the short term, so I've opened this ticket so we can capture additional votes from customers and feedback on its importance relative to other requests.

            Hi Joshua,

            It very useful for environment configuration, set up some variables and install required dependencies. My project is very small but
            I have few pipelines and every one of them have

                  - step:
                      script:
                       ...
                        - export COMMIT="$BITBUCKET_COMMIT"; export VERSION="${BITBUCKET_BRANCH:-pipeline-custom}"
                       ...
            

            Later I have to add pip install ... into all of them to run tests before deploy.

            gusevaleksei added a comment - Hi Joshua, It very useful for environment configuration, set up some variables and install required dependencies. My project is very small but I have few pipelines and every one of them have - step: script: ... - export COMMIT= "$BITBUCKET_COMMIT" ; export VERSION= "${BITBUCKET_BRANCH:-pipeline-custom}" ... Later I have to add pip install ... into all of them to run tests before deploy.

            bogomolov added a comment -

            A global "before_script" will be nice. In the PHP projects we always install the dependencies with Composer. (In every task)
            Now I need to enter the call in every custom or branch step and edit multiple rows if changes.

            bogomolov added a comment - A global "before_script" will be nice. In the PHP projects we always install the dependencies with Composer. (In every task) Now I need to enter the call in every custom or branch step and edit multiple rows if changes.

            Hi Aleksei,

            Could you explain what you would run in the before_script that you could not run as the first command in the step?

            Joshua Tjhin (Inactive) added a comment - Hi Aleksei, Could you explain what you would run in the before_script that you could not run as the first command in the step?

              Unassigned Unassigned
              368ce4753399 gusevaleksei
              Votes:
              28 Vote for this issue
              Watchers:
              18 Start watching this issue

                Created:
                Updated: