I have a shared pipeline created for all my microservices, the steps are more or less same but vary on branch execution. with different variable set. How can I achieve below functionality
Example:
**********************************************************
Shared Pipeline
***********************************************************
**********************************************************************
Import Pipeline
***************************************************************************
Now that Dynamic Pipelines have been released, you can achieve a greater level of flexibility with the Bitbucket pipelines.
Last week, I published this article explaining how to add a step dynamically to a repository. This approach offers a greater level of flexibility, considering that the app logic can change the entire pipeline of a repository.
Hope this will help managing pipelines,
Caterina
Hi Hareesh and welcome to the community!
I'm afraid that it is not possible to share only certain steps at the moment or customize elements like deployments.
We have a feature request for the ability to share certain steps of a pipeline:
You can add your vote and feedback to that ticket to express your interest.
In the meantime, you can achieve what you want by creating a separate pipeline for each combination of pipeline step and deployment environment in the shared pipeline, and then use them in the imported repo.
We have the following documentation on sharing pipelines configuration that also includes many frequently asked questions:
Please feel free to reach out if you have any other questions!
Kind regards,
Theodora
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Theodora, Thanks for getting back. In that case Can we do the same for import pipelines with a deployment in that case?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Hareesh,
A deployment is a property of a step or a stage and not of the whole pipeline. I'm afraid that you cannot use a definition like the one you shared. You will need to define the deployment in the Shared Pipeline repo, in the specific step that uses a deployment, as follows:
export: true
definitions:
pipelines:
share-pipeline-java8-production:
- step: &Maven-Build-and-Test
deployment: develop
image:
name: abc.io/maven:3.9-jdk8
username: $ART_USER
password: $ARTI_PASSWORD
caches:
- maven
script:
- mvn clean install
artifacts:
- target/*.jar
after-script:
# Collect checkstyle results, if any, and convert to Bitbucket Code Insights.
- pipe: atlassian/checkstyle-report:0.3.0
If you have more than one deployment environment that you want to use this way, you will need to add separate definitions for the same step with a different deployment environment.
Please feel free to let me know if you have any questions.
Kind regards,
Theodora
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.