Forums

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

JQL and Automation For Deployment

Mustafa Akın April 20, 2022

I want to create an automation for when a deployment to production is done, I want to get related issues and post them to Slack. I thought it would be easy since all the information is actually available in the UI.

But I could not do move forward because I don't know how to relate deployment with issues. The following JQL is successful.

project = "x" AND deploymentEnvironmentType ~ 'Production' AND deploymentState ~ 'Successful'

However, when I try to add the deployment name as a parameter, I'm unsure what to add. The deployment smart values suggest the deploymentName is actually the Pipeline number but none of the queries seem to work when I try to query them with JQL.

project = "x" AND deploymentEnvironmentType ~ 'Production' AND deploymentState ~ 'Successful' AND deploymentName ~ '300'

I set up an automation, in either case, to use {{deployment.name}} as a value but it does not seem to be triggered at all. Can anyone help?

 

1 answer

0 votes
Darryl Lee
Community Champion
April 20, 2022

So, ok, I'm just operating from documentation and examples, reading this:

And examining this sample rule:

So I think what you need to do is create a Deployment successful trigger for the Production environment.

Then I think the way Deployment Triggers work is that they apply to every issue associated with a Deployment.

So if your Production Deployment referenced TEST-123 in the commit messages and/or branch names, then you could add an Issue fields condition to check:

IF project = "x"

And if so then it would be a matter of creating an action of sending a Slack message to the appropriate channel, something like:

<{{deployment.url}}|{{deployment.name}}> was successfully deployed and included a fix for <{{issue.url}}|{{issue.id}} - {{issue.summary}}>

Unfortunately I think this would result in a separate Slack message for each related issue.

I can't find if there is a Smart Value for a list of all issues related to a Deployment. If there is, then you might be able to do some fancy list processing and just send a single Slack message.

Darryl Lee
Community Champion
April 20, 2022

I found a very similar example here:

What's interesting is that @John McKiernan notes that you could also "get more granular" and "use the branch / related issues block".

Which I would be tempted to use to try to "build" a single Slack message that contains the list of issues by appending each issue to a Smart Value "variable" but there's an issue with asynchronous execution of rules.

Suggest an answer

Log in or Sign up to answer