ansible / awx

AWX provides a web-based user interface, REST API, and task engine built on top of Ansible. It is one of the upstream projects for Red Hat Ansible Automation Platform.
Other
13.65k stars 3.37k forks source link

Jira Service Desk automation webhook support #7459

Open jjtroberts opened 4 years ago

jjtroberts commented 4 years ago
ISSUE TYPE
SUMMARY

My small engineering team would like to use Jira Service Desk (JSD) automation rules to facilitate user self-service for common, low-risk requests. Most of our requests are already automated using Ansible playbooks and roles, however, we currently have to use Jenkins to provide self-service. The desired goal would be to trigger a job template from a JSD webhook payload. The final step of the role/playbook would be to update the Jira issue via API with success or failure. To that end, we need the contents of the JSD payload available to playbooks and roles so we can execute based upon custom fields for each request type.

For example, say a developer wants to pull production down to stage. The JSD request type requires approval from a member of QA so any ongoing work in our test environment does not get blown away. Once that approval is received, JSD sends a POST webhook containing the standard issue payload containing two custom fields (eg. source and target). The webhook triggers a job template which passes the payload to Ansible as a known variable, say perhaps tower_webhook_payload, which can then be used as needed. At that point we'd have the Jira issue id and could post back to Jira REST api to update the status of the issue.

https://developer.atlassian.com/server/jira/platform/jira-service-desk-webhooks/

Payload details:

{
    "issue" : {
        "id": "18001",
        "self": "https://mycompany.atlassian.net/rest/api/2/issue/18001",
        "key": "IT-4",
        "fields": {
            "summary" : "I cannot get my second screen to work",
            "description" : "Have tried multiple ports, cables, but no luck",
            "status" : {
                "name" : "Waiting for Support",
                ...
            },
            "reporter" : {
                "name" : "jsmith",
                ...
            },
            ...
        }
    },
    "timestamp" : 1462941258113 // Time when webhook was fired - UTC milliseconds from epoch
}
Valien commented 3 years ago

The cloud version of Jira, now called JSM (Jira Service Management), has support for posting to an external webhook. Would love to see AWX/Tower have a generic webhook configuration or something so that it could listen for JSM posts.

Previously I built a JSD to Tower integration leveraging Groovy, native RESTful API's of Tower, and the Ansible Jira module. But that was only for on-prem (server and data center) versions. Atlassian is moving heavily to their SaaS/Cloud model and the webhook process is their goto method right now.

JSM Cloud Webhook documentation - https://developer.atlassian.com/cloud/jira/platform/webhooks/

drmmarsunited commented 3 years ago

@Valien Did you happen to blog about this effort or write it up at all? I’m in the middle of research in an undertaking that fits this use case, and any pointers in the right direction would be phenomenal.

I’m 100% in favor of a generic configurable we hook within AWX/Tower, but until it’s there, I was thinking of the direct integration route, but haven’t ever gotten into customizing anything within the Atlassian suite via development.

Valien commented 3 years ago

@drmmarsunited - Actually I have not. I changed jobs in February and no longer am working with Ansible and Jira, so something I don't have to worry about but still think that Tower would be great if it had generic webhook support for sure!