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

How can I retrieve the ticket number from a pipeline ?

Hello,

I would like to create the following flow.

user commit and PR a feature, then on the pipeline

=> Lint/Test
=> Build a preview
=> Deploy a preview
=> Automatically comment on ticket with preview link and move to QA.

I am unsure how to achieve this last step.
I am using Bibucket Cloud and Jira and probably would use Smart Commit .

The question is, how can I retrieve the ticket number from the pipeline ? I know there is some variables, but none seems related to the Jira Ticket. I would like to be able to retrieve this from the `bitbucket-pipelines.yml` the same way the PR page can know the associated tickets.

Is it possible ? 

Thank you 

1 answer

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

Hi @federico,

Thank you for reaching out to the community.

For the last step in your workflow, I don't think there's a default variable in Pipelines that fetches a Jira issue link. - Bitbucket Pipelines variables

As a workaround, since there is the default variable BITBUCKET_COMMIT in Pipelines, you can run a Git command to show extract the commit's message.
From that commit message, you can then parse the result to get the Jira issue key given the commit message has an issue key.

# To get the commit's message
- export commit_message=$(git show -s --format=%B $BITBUCKET_COMMIT)
# Parse the variable *commit_message* to get the Jira issue key

Hope it helps.

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