Goto Settings → Webhooks in Gitlab project menu
Select the event Issue Event
Enter the URL: https://YOUR_USER:YOUR_PASSWORD@your_jira_base_url/rest/restfulintegrator/1.0/incoming/gitlab_issue
Note the URL is listed in the Inbound Integration page of iHub
change YOUR_USER:YOUR_PASSWORD to the integration user. Note the colon between
This will start sending issue events in this project to Jira and iHub
Repeat the steps above and select Comment as event but with the URL
https://YOUR_USER:YOUR_PASSWORD@your_jira_base_url/rest/restfulintegrator/1.0/incoming/gitlab_comment
Manage the incoming request from Inbound Integrations
Navigate to inbound integrations
Click New Rule
Name it GitLab
Add a condition to the rule with operator ~ and value gitlab_issue
Add Flow
Add a condition with operator ~ and value gitlab_comment
Save the rule
So far we have just added the rule, now we need to build the actions that receives the call.
Create a GitLab authentication
Navigate to Credentials
Select Custom Header
Enter the name GitLab
Click Create
Add a new header with the following key/value
PRIVATE-TOKEN | generate token from Avatar->Edit Profile->Access Token and paste it in here in the value field |
Add Actions in Outbound Integrations
Click New (Action)
Select Template Category: Jira Core
Select Template: Create Issue
Click Create
Select a basic Auth Jira user see Basic Auth
Add Body
{ "fields": { "project": { "id": "12200" }, "summary": "{{object_attributes.title}}", "issuetype": { "id": "10001" }, "reporter": { "name": "kg" }, "labels": [ "gitlab" ], "description":"{{object_attributes.description}}", "customfield_10201":"{{object_attributes.id}}" } }
This will create the issue based on the incoming data from GitLab
To be able to update or comment the issue we need to link them together using a labels on GitHub side to do this.
Click New (Action)
Select Template: application/json
Click Create
Select PUT as method
Enter URL: https://gitlab.com/api/v4/projects/YOUR_PROJECT_ID/labels
Select the GitLab header auth in the Authentication select list
Add Body
{ "name":"{{key}}", "color":"#6699cc" }