ansible/awx

Jira Service Desk automation webhook support

Open

#7,459 opened on Jun 27, 2020

View on GitHub
 (3 comments) (6 reactions) (0 assignees)Python (3,333 forks)batch import
component:apicomponent:uihelp wantedtype:enhancement

Repository metrics

Stars
 (13,071 stars)
PR merge metrics
 (Avg merge 24d 6h) (30 merged PRs in 30d)

Description

ISSUE TYPE
  • Add webhook service support for Jira Service Desk automation
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
}

Contributor guide