Continuous Integration using Jenkins with Gitlab and JIRA
Before beginning to this article make sure Jenkins Server, Gitlab Server and JIRA are already setup and running.
Step 1: Integrate Gitlab with Jenkins:
Generate Access Token in Gitlab: Gitlab → User Settings → Access Token
Configure Global Key in Jenkins: Jenkins → Credentials → System → Global Credentials → Add Credentials
Configure Connection Between Jenkins and Gitlab: Jenkins → Manage Jenkins → Configure System → Gitlab
Step 2: Configure Jenkins Build Triggers and Post-Build Actions
Go to Jenkins → <PROJECT> → Configure → Build Triggers
Go to Jenkins → <PROJECT> → Configure → Build Triggers → Advanced → Secret Token → Click Generate
Go to Jenkins → <PROJECT> → Configure → Post-build Actions
Step 3: Configure Gitlab Webhooks
Go to Gitlab → Projects → <Project> → Settings → Integrations
Here is an example of after clicking the Push events button
Step 4: Integrate JIRA with Gitlab:
Gitlab → Admin Area → Service Templates → JIRA
After saving above configuration your Gitlab Project will be able to Interact with all JIRA Project. JIRA issue in GitLab will automatically add a comment in JIRA issue with the link back to GitLab.
While commit source over Gitlab don’t forget to mention the JIRA issue in comment as follows:
For more detailed reference please go through GitLab JIRA integration documentation.