Greetings, I'm integrating Opsgenie with Jenkins from pipelines. I created 2 pipelines with the same code that represents a sample code present in this link: https://support.atlassian.com/opsgenie/docs/integrate-opsgenie-with-jenkins/.
In the first case use the groovy sandbox to run the pipeline script and in the second case I ran the script from a Jenkinsfile.
Jenkins Pipeline Job:
Opsgenie notification (via slack):
In this case, everything went as it should. I ran the pipeline and gave an error to verify that the failure notification appeared in Opsgenie and is validated.
Jenkins Pipeline Job:
As you can see in the Jenkins pipeline job screenshot, the request for Opsgenie is made. My question or problem is that Opsgenie does not notify slack as it did in the first case, so I would like to have some help here if possible.
Justin here, from Opsgenie support - happy to help!
There are a few common culprits that can prevent a particular alert from sending out to Slack - it may be that the alert that is created is not assigned to the same team as the Slack integration, or it may be that the Slack integration has some filtering in place that is preventing alerts matching certain criteria from sending outbound.
For the first - can you check to see that both of these alerts in Opsgenie are assigned to the same team as your Slack integration? You can find the assigned responder teams here on the alert:
You'll want to ensure that this is the same as your Slack integration:
Additionally, you'll want to check if there are any filters here, on the Slack integration, that might be preventing the alert from sending out to Slack:
Those are the most common causes of something like this, but if that doesn't solve the issue, please feel free to respond here, or reach out to us directly at support.atlassian.com.
Atlassian Cloud Support
Good morning, thanks for the reply. I think I exposed the error incorrectly. The problem isn't in the slack because the alert doesn't reach Opsgenie. What I exposed already worked correctly with the same code by a pipeline script or a pipeline script by scm.
That said, my company only uses scripted pipelines. The code shown above refers to the example of this link : https://support.atlassian.com/opsgenie/docs/integrate-opsgenie-with-jenkins/ .This code is declarative and works correctly, the alert is sent to Opsgenie and later to slack.
But as mentioned above, we only use scripted pipelines and what happens is that when I call the Opsgenie function in this type of pipeline, the output says that the alert is sent but it doesn't reach Opsgenie.
Scripted Pipeline Code:
Output of Scripted Pipeline:
Supposedly job data is sent to Opsgenie but the alert does not appear in Opsgenie when the command is called within a scripted pipeline.
Is something missing in my code or does Opsgenie only allow in-command invocation in declarative pipelines?
Ah, thanks for the additional information! With that in mind, I *suspect* that the issue has to do with your Opsgenie configuration - it may be that the data is received by Opsgenie, but doesn't match the filter conditions for the rules in the 'Create Alert' action for your integration - see below for a screenshot of where this is found:
The best way to check this is to view the logs (Settings >> Logs), where all incoming requests will be displayed, whether they trigger an alert to be created or not. You can search the logs using the name or ID of the Jenkins integration, and will see all request received by that integration, and can confirm if the specific notification from your scripted pipeline.
You may also want to reach out to us directly at support.atlassian.com, or through the in-app chat (found in the lower right hand corner of the application - note -i f you don't see the in-app chat option, it may be due to an ad-blocker extension in your browser.)
We may need to gain access to your account to do some additional troubleshooting of the issue, so contacting us directly would be the best way to achieve that.
Atlassian Cloud Support
Hello Atlassian Community! Feedback from customers like you has helped us shape and improve Jira Software. As Head of Product, Jira Software, I wanted to take this opportunity to share an update on...
Connect with like-minded Atlassian users at free events near you!Find an event
Connect with like-minded Atlassian users at free events near you!
Unfortunately there are no Community Events near you at the moment.Host an event
You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events