XMLWordPrintable

    Details

    • Feedback Policy:

      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.

      Description

      Hi! Is there a way to share steps in Bitbucket pipelines? Aka write it once, and use it several places?

      If I for example wanted to build a JAR on every commit, but only upload it somewhere if the branch was production.

      To achieve this today, I have to do somethink like this:

      #!yaml
      
      pipelines:
        default:
          - step:
              name: Build
              image: maven:3.3.9
              script:
                - mvn package
              artifacts:
                - target/my-project-1.0-SNAPSHOT.jar
        branches:
          production:
            - step:
                name: Build
                image: maven:3.3.9
                script:
                  - mvn package
                artifacts:
                  - target/my-project-1.0-SNAPSHOT.jar
            - step:
                name: Upload
                image: python:3.6-alpine
                script:
                  - python ./upload-jar.py
      

      You can see that this step is implemented exactly the same for default and for branch master:

          - step:
              name: Build
              image: maven:3.3.9
              script:
                - mvn package
              artifacts:
                - target/my-project-1.0-SNAPSHOT.jar
      

      I'm a fan of DRY. is there a way to define this step once, and use it both places?

        Attachments

          Activity

            People

            Assignee:
            Unassigned
            Reporter:
            terje.andersen1386955372 terander
            Votes:
            1 Vote for this issue
            Watchers:
            4 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: