You're on your way to the next level! Join the Kudos program to earn points and save your progress.
Level 1: Seed
25 / 150 points
Next: Root
1 badge earned
Challenges come and go, but your rewards stay with you. Do more to earn more!
What goes around comes around! Share the love by gifting kudos to your peers.
Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!
Join now to unlock these features and more
The Atlassian Community can help you and your team get more value out of Atlassian products and practices.
I tried to search a lot but have not got proper answer.
In my case, I want to run a pipeline when a branch is deleted, basically it will help to remove the resources used for example k8s pods/deployments.
We create development environments whenever a branch is created so now to want to remove these environments once that branch is deleted.
Please do suggest a valid way to do so. Is there any add-on available?
Hello @Rahul Raut ,
Thank you for reaching out to Atlassian Community!
I'm afraid that it would not be possible to run a pipeline for a deleted branch, as the pipeline will look for the bitbucket-pipelines.yml file on that branch and since the branch is gone the file would no longer exist.
Since your goal is to do some cleanup in the environments that were used from previous pipelines, I would suggest using a custom pipeline. Custom pipelines are only manually triggered and you can select in the UI which branch or commit you want it to run. Also, it's possible to provide variables during the pipeline trigger of a custom pipeline, which allows you to have dynamic values in each run.
Following is an example of using a custom pipeline with variables :
pipelines:
custom:
custom-name-and-region:
- variables:
- name: Username
- name: Region
default: ap-southeast-2 # optionally provide a default value
- step:
script:
- echo "User name is $Username"
- echo "and they are in $Region"
In this example, the pipeline would expect the variables Username and Region to be provided. You will be prompted to provide those variables when running the pipeline manually from Pipelines page > Run Pipeline. For variables that have a default value, if no different value is provided, the default one will be used.
You can read more about custom pipelines in our Scheduled and manually triggered pipelines documentation.
Thank you, @Rahul Raut !
Patrik S
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.