Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Deleted user
0 / 0 points
Next:
badges earned

Your Points Tracker
Challenges
Leaderboard
  • Global
  • Feed

Badge for your thoughts?

You're enrolled in our new beta rewards program. Join our group to get the inside scoop and share your feedback.

Join group
Recognition
Give the gift of kudos
You have 0 kudos available to give
Who do you want to recognize?
Why do you want to recognize them?
Kudos
Great job appreciating your peers!
Check back soon to give more kudos.

Past Kudos Given
No kudos given
You haven't given any kudos yet. Share the love above and you'll see it here.

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

Include external YAML files in pipelines for code-reuse ?

Hi,

Does Bitbucket have support for a means of including YAML located elsewhere (like a different repo) into a pipeline? 

For example, I have a lot of boilerplate yaml that is getting copied from pipeline to pipeline, which, as developers, we know is a horrible practice. I'd much rather have a repository filled with YAML snippets which then various pipelines could include in them instead.

Here is something we do a lot:

script: &installPkgsCentos
apt-get update;
apt-get install -y awscli curl git make python3-pip rsync unzip wget;
pip install --upgrade pip awscli

But I'd much rather simply do:

 - step: &unit_test
name: Run Unit Tests
image: python:3.8.5-slim
script:
include: https://bitbucket.org/myproject/myrepo/src/develop/installPkgsCentos
- make build
- make testall

Where the file referenced in the `include` statement looks like this:

        - apt-get update
- apt-get install -y awscli curl git make python3-pip rsync unzip wget
- pip install --upgrade pip awscli

The above should equate to valid YAML such that the step looks like this:

 - step: &unit_test
name: Run Unit Tests
image: python:3.8.5-slim
script:
- apt-get update
- apt-get install -y awscli curl git make python3-pip rsync unzip wget
- pip install --upgrade pip awscli
- make build
- make testall

 

If this feature exists, can someone please point me to the docs, as I have been unable to locate anything describing this use-case. The closest I came was pipes, but that's not what I'm after here, since the snippets of YAML I want to include in different pipelines could be included as steps in stages using a variety of different base containers.

 

Thanks.

--

Paul

0 answers

Suggest an answer

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

Bitbucket Pipelines Runners is now in open beta

We are excited to announce the open beta program for self-hosted runners. Bitbucket Pipelines Runners is available to everyone. Please try it and let us know your feedback. If you have any issue...

2,318 views 50 18
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