With the recent introduction of Dynamic Pipelines, you can now achieve an unprecedented level of flexibility within your Bitbucket pipelines.
We understand that, when managing repositories at scale, not every pipeline can be exactly the same and copying the entire pipeline is not always possible. Maintaining per-repo pipelines can be challenging and lead to diverging and non-compliant implementation. In this scenario, having a centralized common logic across an organization would greatly improve the ability to setup and maintain pipelines.
This is where dynamic pipelines can help.
Let me show you one of the capabilities that have now been unlocked: the ability to share a step across pipelines
In our example, we are automatically adding a step to perform a scan of the files' hardcoded sensitive data via the Git secrets scan pipe. This is just an example and you can add any step required in your pipelines in the same way.
This step is not part of the bitbucket-pipelines.yml definition and is added when the pipeline runs.
At a high level, there are three steps required:
Setup Forge on your workstation
Clone the Dynamic Pipelines reference apps repository and follow the instructions of the Add Pipeline step app to register, deploy and install the app
Add the app as the dynamic pipeline provider of either the workspace or the repository in the “Dynamic pipelines” menu of the workspace or the repository
Run a pipeline in your repository and observe how the step has been added dynamically
Check out our YouTube video for a step-by-step overview of how to set this up.
Good to know
Before you continue, please note the following:
Dynamic pipelines is a Premium feature for Bitbucket Cloud. (Read more about Bitbucket Premium here)
Only workspace administrators can install an app so, unless you are the admin, you’ll need to ask an admin to perform the installation
FAQs
Q: How do I change the step to be added?
A: Check and update the addGitSecretScan function in the index.js
If you have any questions or get stuck at any stage during the setup, let us know here in the comments.
Cheers,
Caterina
Caterina Curti
Developer Advocate
Sydney
109 accepted answers
0 comments