Are you in the loop? Keep up with the latest by making sure you're subscribed to Community Announcements. Just click Watch and select Articles.

×
Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Celebration

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

is there a way to release a terraform module that lives on a bibucket repo?

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'    

1 answer

0 votes
Mark C
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
Sep 14, 2022

Hi @Ramiro Achaval Rovira,

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.

Regards,
Mark C

Hey Mark, thank you for you answer, let me try to explain better.

I need to create a step what will alow me to create a release for whatever I have in my repository, and set Git tags to version it.

Mark C
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
Oct 13, 2022

Hi @Ramiro Achaval Rovira,

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.

Regards,
Mark C

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PERMISSIONS LEVEL
Site Admin
TAGS
AUG Leaders

Atlassian Community Events