The Atlassian Community Forums are currently in read-only mode. We will be relaunching on a new platform on September 22 (read more here). We apologize for the extended downtime. For concerns or questions, please email communitymanagers@atlassian.com. See you on the other side, on the new Atlassian Community Forums! :)

×

Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 
  • Community
  • Q&A
  • Jira
  • Questions
  • Jenkins to Jira integration: how to send deployment info for only the environment being deployed to?

Jenkins to Jira integration: how to send deployment info for only the environment being deployed to?

burt repine
Contributor
September 27, 2024

As we only deploy to 1 environment at a time we would like the Jira info sent for only that environment.

Currently it sends info for all environments if we write our pipeline syntax, using stages, as described here:

How Jenkins for Jira works 

We use a 'when' conditional to direct the script to the particular environment we would like to deploy to a la:

 

...
stage('deploy to DEV') {
when { expression { "$envName" == "DEV" } }
steps {
// deploy to DEV....only send Jira info for DEV
...
}
}
stage('deploy to QA') {
when { expression { "$envName" == "QA" } }
steps {
// deploy to QA....only send Jira info for QA
...

 

 

But in this scenario, deployment info is sent to Jira for BOTH environments which is really misleading.

Console output for a DEV deploy where deployment info for QA is also sent to Jira even though the Stage "deploy to QA" was properly skipped:

...
[Pipeline] stage
[Pipeline] { (deploy to QA)
...
[ATLASSIAN CLOUD PLUGIN] [DEBUG] Extracted issue keys from ChangeLogSet message 'SPA-1371: testing': [SPA-1371]
[ATLASSIAN CLOUD PLUGIN] [INFO] sending request to Jenkins app in Jira: {DEPLOYMENT DETAILS...
Stage "deploy to QA" skipped due to when conditional
[Pipeline] getContext
[Pipeline] }
...

0 answers

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
PREMIUM
PERMISSIONS LEVEL
Product Admin
TAGS
AUG Leaders

Atlassian Community Events