Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Can a step be replaced in the pipeline without having it defined in the bitbucket-pipeline.yaml

Jeffrey Hsiung November 19, 2024

Is there a way for dynamic pipelines to define a step that only exists in the pipelines section instead of in the definitions section in the bitbucket-pipelines.yaml file?

For instance, is it possible for the step named *replace_this_with_step_in_index.js to exist only in the pipelines section as shown below, but have the actual script lines be defined in the index.js?

The use case would be for the index.js to define multiple standard steps, and then only have the stepNames in the pipelines section of the yaml file. That way team members only need to add the steps to the pipelines section.

------------------bitbucket-pipelines.yaml-----------------------

pipelines:
branches:
"**":
- step: *replace_this_with_step_in_index.js

1 answer

1 accepted

0 votes
Answer accepted
Jeffrey Hsiung November 19, 2024

Was able to get it working with bitbucket-pipeline.yaml having something like below, and index.js searches for the step by name and replaces it. This way theres no step definition needed in the definitions section of the yaml file


"**":
[step: {name: nameOfstepToReplace}, step: {name: nameOfStepToReplace}]

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
PREMIUM
TAGS
AUG Leaders

Atlassian Community Events