Create
cancel
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

Edited

 

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/gitlab-ci-scripts.sh"
pipelines:
custom:
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 – gitlab-ci-scripts.sh 2021-04-13 12-07-57.pngExample of my .sh file

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Jira

Admins, notify your Jira instance of system-wide changes with the new admin announcement banner

Hi All! We’re excited to share the launch of an announcement banner that lets Jira site administrators communicate directly to their users across Jira Cloud instance.   📢 Get y...

150 views 7 7
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