Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Import .sh file into bitbucket pipeline

Mikhail Sapozhnikov April 13, 2021

 

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
Justin Thomas
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
April 22, 2021

@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.

Mikhail Sapozhnikov April 23, 2021

 

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/**
0 votes
Mikhail Sapozhnikov April 13, 2021

 

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
AUG Leaders

Atlassian Community Events