Bitbucket Pipelines steps to always perform (setup step)

jadbaz July 10, 2017

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

 

 

3 answers

1 accepted

3 votes
Answer accepted
jadbaz February 13, 2018

There is already an issue for this here: https://bitbucket.org/site/master/issues/12751/allow-more-capable-steps-that-can-be

Closing this post

Cory Robinson May 28, 2019

Please upvote the most recent post with the solution to help others find the answer as this post comes up as the 2nd listing on google search results.

7 votes
Cory Robinson May 28, 2019
0 votes
jadbaz July 10, 2017

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

Cory Robinson January 9, 2018

This is no longer open @jadbaz

jadbaz January 9, 2018

Thanks!

Danielo Rodriguez February 8, 2018

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

Deleted user February 13, 2018

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

jadbaz February 13, 2018

You're right, I unmarked answer as correct.

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

Deleted user February 13, 2018

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events