Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Import .sh file into bitbucket pipeline



Hi, i take some issue. Exactly, i need to import some .sh file to my pipeline script for using function from this file later, maybe, it's like YAML anchors, but in another file. And it should execute before all scripts every time, when i started pipeline. Earlier i use gitlab pipeline and it look like this: multiproduct – .gitlab-ci.yml 2021-04-13 11-32-05.png

I just import file and can use it. Can you help me realize it on bitbucket pipelines?

I already done this:

blink – bitbucket-pipelines.yml 2021-04-13 11-35-26.png

Where "test_import" it's a simple function from .sh file

In pipelines i have the next one:

enwaycom  blink  Pipelines — Bitbucket 2021-04-13 11-39-05.png

2 answers

1 accepted

0 votes
Answer accepted

@Mikhail Sapozhnikov Bitbucket Pipelines currently doesn't have a way to specify a before script, you will have to add it as the first line for each of your steps. There is a feature request to add before script support, please vote for the issue.


Thank you for answer. I asked some another thing and already i resolved the issue.Following code works for me:

definitions:scripts: Load Scripts: &loadScripts source "scripts/gitlabci/"
start-feature-development: - variables: - name: USER_EMAIL - step: script: - *loadScripts - authenticate "DEVHUB" $DEVHUB_AUTH_URL -d - create_scratch_org $BITBUCKET_BRANCH $USER_EMAIL - push_to_scratch_org - create_developer_user $BITBUCKET_BRANCH $USER_EMAIL artifacts: - artifacts/**


blink – 2021-04-13 12-07-57.pngExample of my .sh file

Suggest an answer

Log in or Sign up to answer
Community showcase
Published in Bitbucket

📣 Calling Bitbucket Data Center customers to participate in research

Hi everyone, Are you Bitbucket DC customer? If so, we'd love to talk to you! Our team wants to dive deep to understand your long-term plans regarding Bitbucket DC and Atlassian Cloud. Do you plan...

147 views 2 4
Read article

Community Events

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

Find an event

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

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you