Details
-
Suggestion
-
Resolution: Duplicate
Description
Hi! Is there a way to share steps in Bitbucket pipelines? Aka write it once, and use it several places?
If I for example wanted to build a JAR on every commit, but only upload it somewhere if the branch was production.
To achieve this today, I have to do somethink like this:
#!yaml pipelines: default: - step: name: Build image: maven:3.3.9 script: - mvn package artifacts: - target/my-project-1.0-SNAPSHOT.jar branches: production: - step: name: Build image: maven:3.3.9 script: - mvn package artifacts: - target/my-project-1.0-SNAPSHOT.jar - step: name: Upload image: python:3.6-alpine script: - python ./upload-jar.py
You can see that this step is implemented exactly the same for default and for branch master:
- step:
name: Build
image: maven:3.3.9
script:
- mvn package
artifacts:
- target/my-project-1.0-SNAPSHOT.jar
I'm a fan of DRY. is there a way to define this step once, and use it both places?