Forums

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

To have an issue with a linked deployment, do I need to have a commit with the issue key?

Nick Daniel January 30, 2023

To get issues to have associated/linked deployments, I am finding success by including the issue key in the commit message. However, the documentation leads me to believe that this should work based on branch name as well (which does appropriately link to the issue, but does not track along with the deployments).

When I use merge commits, and merge in a branch with the issue key, and keep that as the merge comment, then it tracks deployments appropriately (because the issue key from the branch name is now in the commit message history). Is this the only way to do it? The docs are a little unclear on this, and it's slightly unfortunate for the use case I have: PR-linked deployments from branches aren't showing in the Jira issue that they have been deployed to a given environment.

Thank you,
Nick

2 answers

1 accepted

1 vote
Answer accepted
Theodora Boudale
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
January 31, 2023

Hi Nick,

Are you referring to the Deployments tab, in the Development panel of a Jira Cloud issue?

If so, the deployment is indeed linked only if the commit associated with the deploy contains the issue key in its commit message. See the link below, in the section "Deployments":

Deployments

A deployment to an environment, such as production or testing, is linked if a commit associated with the deploy contains the issue key in its commit message. The issue key must be included in the commit to activate this feature.

If the deployments run on a pull-requests definition in your bitbucket-pipelines.yml file, the issue key needs to be present in the last commit of the source branch.

Kind regards,
Theodora

Ivari Horm
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
May 18, 2023

What happens if the deployment is run from tag instead?

If I currently tag the commit and the deployment pipeline is executed, only that issue is now linked to the new deployment environment.

How can all other issues in the git tree between the current and previous deployment be linked as well?

Theodora Boudale
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
May 22, 2023

Hi Ivari,

A tag is associated with a certain commit, so when you run deployments from a tag, it's again a specific commit that is associated with the deployment.

What I mentioned in the previous post applies in that use case as well. The deployment is linked only if the commit associated with the deploy contains the issue key in its commit message.

Kind regards,
Theodora

0 votes
Alexander
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
June 1, 2023

Hi @Theodora Boudale, thanks for your responses, our team is struggling with this issue right now. From what you said, it sounds like it's only possible to link deployments to Jira issues only if you make that deployment from commit associated with certain issue. 

In our workflow and in accordance with Atlassian Deployment Guidelines, we deploy from `main` branch. Once it's ready to be released, we trigger custom pipeline (from the latest state of `main`) and deploy to staging environment:

CGX Git Workflow.drawio.png

We noticed that only issues associated with the latest commit in `main` (JRA-3) have been linked to the new deployment. But before JRA-3 we have more issues merged (JRA-1, JRA-2). Does it means that these issues will not be linked to the latest deployment and not flagged as "Deployed to Staging"?

If I understand it correctly, it kind of ruins the idea of monitoring deployments from Jira: you will never know where code associated with certain issue was delivered to. Could you please let me know some way to associate previous issues with the  latest deployment? 

Theodora Boudale
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
June 2, 2023

Hi @Alexander,

Thank you for reaching out.

Is your team pushing commits to main branch? If so, what you could do instead is the following:

  • Create another branch, e.g. my-feature-a
  • Push commits to my-feature-a
  • Create a pull request from my-feature-a to main
  • When you are ready to merge the pull request, you can use as 'Merge strategy' Merge commit or Squash, and ensure that the commit message of the merge or squash commit contains all JIRA issue keys that you referenced on my-feature-a.

When you merge a PR from our website and the source branch has more than one commits, then the commit messages of all these commits (including the Jira issue keys) are populated automatically in the message of the merge or squash commit.

The merge or squash commit in main branch will contain all Jira issue keys that were worked on my-feature-a. If you trigger a deployment pipeline for this specific commit, then the deployment will show in all associated Jira issues (in the Development panel).


If you are already following this strategy, and JRA-1, JRA-2, and JRA-3 are merge commits from other branches, you would need to trigger a deployment for each commit in order for the deployment to show in each Jira issue's Development panel.

One way to work around this would be by creating and pushing to main an empty commit

git commit --allow-empty -m "Empty commit for deployment JRA-1 JRA-2 JRA-3"

and then trigger a deployment for this empty commit.

Kind regards,
Theodora

Suggest an answer

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

Atlassian Community Events