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
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
I would like to create a tagged release for my terraform module using a pipeline step when this get merged to master using a Pull Request.
Something like this.
release_job: stage: release image: registry.gitlab.com/gitlab-org/release-cli:latest rules: - if: $CI_COMMIT_TAG when: never # Do not run this job when a tag is created manually - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH # Run this job when commits are pushed or merged to the default branch script: - echo "running release_job for $TAG" release: # See https://docs.gitlab.com/ee/ci/yaml/#release for available properties tag_name: 'v0.$CI_PIPELINE_IID' # The version is incremented per pipeline. description: 'v0.$CI_PIPELINE_IID' ref: '$CI_COMMIT_SHA'
Welcome to the community.
If I understand it correctly, you'd like Bitbucket Cloud Pipelines to trigger builds on tag release.
If yes, you can try triggering Pipelines builds by triggering on tags.
You can check this link for more information about triggering Pipelines tags. - Configure bitbucket-pipelines.yml - tags
You can test it out and see if it fits your requirement.
Let me know if you have further questions.
In this case, you can achieve this by using branches and tags triggers.
Here's an example of Pipelines YAML configuration:
pipelines: tags: 'release-*': # This will trigger by pushing a tag with the name pattern release-* - step: name: Release by tag script: #- Do validation here for the variable $BITBUCKET_BRANCH and create a repository variable for the default branch (e.g. $DEFAULT_BRANCH) // You can use bash if else here then return exit 1 if it's not the same. - echo "Some commands here to release" branches: default_branch: # This will trigger for the default branch - step: name: Release by branch script: - echo "Some commands here to release"
The above YAML configuration works when there's a new commit push to the default_branch branch and when there's a new tag push.
For the tags trigger, you can do the validation first before proceeding to run your release commands.
Hope it helps and let me know if you have any further questions.