Bitbucket Pipelines steps to always perform (setup step) Edited

Suppose I have the following bitbucket-pipelines.yml

 

pipelines:
default:
- step:
script:
- chmod +x gradlew
- ./gradlew build
- ./gradlew publishSnapshot
tags:
release-*:
- step:
script:
- chmod +x gradlew
- ./gradlew build
- ./gradlew publishRelease

 

So bitbucket pipelines' documentation says that the default step is run every time no other rule is matched (such as branch or tag). 

So for example, if I have a tag release-* rule:

  • When I don't have a tag, the default step will run
  • When I have a "release-vX.X.X" tag, the release-* step will run

The problem is that the bold lines are shared code and therefore redundant. 

Is it possible to have a kind of setup step that will run before all?

This is an example of what I mean:

 

pipelines:
  setup:
    - step:
        script:
          - chmod +x gradlew
          - ./gradlew build  default:
    - step:
        script:
          - ./gradlew publishSnapshot
  tags:
    release-*:
      - step:
          script:
          - ./gradlew publishRelease

 

 

2 answers

1 accepted

This seems to be a part of a bigger issue of allowing multiple steps and it is still an open issue

This is no longer open @Jad Baz

Why is this no longer open ?  As long as I know this requirement is not available in any form neither any workaround

What Danielo said. As far as I can see, what Jad asks for is not resolved yet?

You're right, I unmarked answer as correct.

So this is still an open issue as far as I can see

Suggest an answer

Log in or Join to answer
Community showcase
Piotr Plewa
Published Dec 27, 2017 in Bitbucket

Recipe: Deploying AWS Lambda functions with Bitbucket Pipelines

Bitbucket Pipelines helps me manage and automate a number of serverless deployments to AWS Lambda and this is how I do it. I'm building Node.js Lambda functions using node-lambda&nbsp...

716 views 0 4
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you
Atlassian Team Tour

Join us on the Team Tour

We're bringing product updates and pro tips on teamwork to ten cities around the world.

Save your spot