Jira and GitLab webhook! How to integrate? - jira

How can i integrate Jira and Gitlab and status will change on request!
Git commit -> ED-1511 #AutomationState Running
Jira ticket (ED-1511) - >> will change AutomationState on Running

I don't think that you can do this with the out of the box functionality of Jira and Gitlab.
From the structure of your commit message it looks like you are trying to use the smart commits functionality in Jira. Smart commits only allow you to perform three actions:
Log time
Comment on an issue
Transition an issue to a new workflow state
This is not something you can do with smart commits. In addition the current Jira Gitlab integration doesn't seem to support smart commits.
If you wanted to build this functionality you could probably build something yourself that:
Listens for Gitlab webhooks
On receipt of a Gitlab webhook calls the Jira REST api to modify the issue

If I understand your question correctly, the GitLab integration with JIRA described here should do what you want. I only recently set this up with our JIRA cloud instance and GitLab running in an AWS instance, and I haven't tried to integrate transitioning JIRA tickets from Git commit messages. However, the documentation seems to indicate that it is possible.

Related

Is BitBucket cloud version of source code repo along with Bamboo for CI/CD?

I'm new to Bamboo and currently learning & using the Bamboo as a standalone server in my company. There I can see the much-advanced options like creating the Build Plans, separate deployment projects based on different environments and also can integrate with notifications and triggers.
I wanted to do a lot of research and learning by myself at home so I was looking for a cloud-based version of Bamboo which I can straight away use to perform similar task like creating build plans, etc. I do not see anything cloud version of Bamboo but I can see BitBucket (cloud-based). What I know is that it is a source code repository like GitHub and GitLab and it has integration with inbuilt CI/CD.
Q1. Is BitBucket a cloud version of source code repository plus Bamboo?
Q2. If not, then do we have cloud version of Bamboo with exact options like build plans, deployment projects, etc
Q3. Also, I'm looking if there is any Bot which I can use like SlackBot or DeployBot to invoke or trigger the Bamboo Build Plan with a chat command? Slack I'm familiar but not DeployBot. I can get the Bamboo build notifications to my Slack channel but not the other way around.
I'm learning and doing research & development hence required clarification on my doubts from experts in this DevOps field to show me the right path.
Please suggest as I'm looking for setting up Bamboo with Bot instructing my build plans.
Thank you
Doing hands-on experience in company on Bamboo and learning as much as I can and playing around with it.
Bamboo Cloud was discontinued in January 2017. Bitbucket Cloud can still notify your Bamboo instance via webhook, assuming you configure Bamboo and your firewall and the webhook properly, or you can use Bitbucket Pipelines for the all-in-one approach.
You can also use Bitbucket Server if you'd prefer to keep everything behind the firewall.

Integration Jira Cloud with Jenkins

I want to integrate Jenkins with JIRA Cloud.
I want Jenkins to start build job when i'm updating Issue Status in JIRA.
example: when the issue in jira is going from status IN PROGRESS to DEV COMPLETED, I want Jenkis to start a build.
regards, Maja
Usually the flow is a little bit different.
After you done with the development you should add JIRA ticket number in commit.
Then create pull request (if you use Git as VCS) and merge it to main branch.
Git server will trigger build on the Jenkins side (you should find Jenkins plugin for your case).
After build is done there Jenkins can send update status to Jira (via Jenkins JIRA plugin
There are some variations. For example you want to allow merge only when build on Jenkins was successful. In this case JIRA update should be performed by Git service.
Thank you for your fast response, but we got different situation than the given answer. I will try to explain clearly.
1. we got Jira on cloud that successfully communicate with Gitlab. (there is a build in jenkins after commit in Jira)
2. and we got one test Jenkins on our local machine
Jira is configured in Jenkins and we got all needed plugins in Jenkins.
Now we want, with every changed status on the issue in Jira (from IN PROGRESS to DEV COMPLETED), Jenkins to make an automatic build on the job.
Additionaly, Is there any Jenkins Plugin for Jira CLOUD that could help us?
At this time, there is no Jenkins plugin / add-on for JIRA cloud, even though it is in high demand. It is rumored there may be one coming out in November / December 2017 as a beta.
If you are using Bitbucket, I'd recommend checking out Pipelines. Or, take a look at Bamboo or TeamCity as these tools integrate directly with JIRA Software Cloud.

Showing user details that has triggered the build on Jenkins Server while code is checked in into gitlab

I want to show user details of user who has triggered build on jenkns. I have integrated gitlab and jenkins and gitlab triggers the build on jenkins via web hook. We log in to gitlab through LDAP. Is there any way to show user details got from gitlab on Jenkins ???? Thanks in advance
At the moment, I don't believe this is possible. But it could be implemented.
In most cases where Jenkins jobs are triggered via Git webhook, the job itself is not triggered directly, but rather Jenkins is informed that for a given Git URI, there may have been changes.
Jenkins then polls Git for changes and, if something new was found, triggers a build of the jobs that use that repository. So at this point, various jobs just start, without receiving any special information about the webhook push that happened.
Also, a new build could have been triggered by multiple commits, from several different people, so it may not make sense to show a single person's name as being the one that triggered a build.
However, there are special implementations that understand the webhook payload format of different hosting services (e.g. GitHub, Bitbucket etc.).
Indeed, the GitLab Hook plugin looks like it does this: if you start a build via the /gitlab/build_now webhook endpoint, then on the build page, you'll see why the build started, e.g. "triggered by merge request feature -> develop" or "triggered by push on branch develop with 2 commits".
While it seems that part of the plugin does read an author's name from the payload (presumably for merge requests), this isn't currently shown on the build page.
So you could try implementing this or filing a feature request on the Jenkins plugin.
As a short term workaround, you can also look at the "Changes" page for each build. There you can see which commits were in that build, and the author names should be shown next to each one.
You may have to configure the "repository browser" under the Git section in the job configuration for this to work.

GitLab and Jenkins integration

I've read the differences between Gitlab Community and Enterprise in this page: https://about.gitlab.com/features/
Based on that page I understand the integration with Jenkins is only available in the enterprise version. However, I've seen that using web hooks I can trigger builds in Jenkins when a push happens in Gitlab.
So my question is which is the difference between community and enterprise regarding the integration with jenkins?
On the merge request page, there is a state widget that shows the status of tests for that particular merge request, and on your project home page, there is test status badging. These two UI elements only show up if you enable a 'ci service' on the project. In community you can turn it on with Gitlab CI. In enterprise you can set it up to work with jenkins.
Based on that page I understand the integration with Jenkins is only
available in the enterprise version.
This is no longer true, the Jenkins GitLab Plugin (from a 3rd party) works to hook Jenkins into GitLab as a CI provider.
The wiki page has an example setup with lots of details you'll need to get it working.
This will give per-commit build/test status indicators in GitLab and also hook into the Merge Request system (both in the local repo and when merge requests come from forked repos).
You can also integrate GitLab with Jenkins using the Generic Webhook Trigger Plugin.
An example of integrating with that plugin, to perform static code analysis on merge requests, is available in the Violation Comments to GitLab Plugin wiki page.

Github Jenkins plugin with Github Enterprise

I have a Jenkins server with the following github plugins:
github-api
github
github-pull-request
I want to trigger a build after a merge (from a PR). This is because I have some build chains that I don't execute when building a PR so after a merge I need to create new deployment packages.
In the enterprise github there doesn't seem to be the same interface (as regular github) for webhooks I don't seem to be able define what events the github plugin (webhook) should listen for so I think its just the default 'push' event. Is this done somewhere else or is it a limitation of the enterprise version?
UPDATE
I have the github plugin working now but its builds for every push if I check the box. This disucssion https://groups.google.com/forum/#!topic/jenkinsci-users/gew5gWVDxw8 suggests that I should be able to use the git scm and github plugin together. Github plugin will register a change, scm plugin will poll server to determine if this change was tho the watched branch. I also tried this suggestion How can I make Jenkins CI with git trigger on pushes to master?
When I try and configure this no branch is ever built!
At least for me it's not exactly clear from your question what you actually exactly want.
It sounds like you only want builds to be triggered if there are some new commits on github on a specific branch.
If this is all you're looking for, you can just setup a webhook (Jenkins (Github Plugin)).
In you Jenkins job, just specify the branch you're tracking (Branches to build).
Assuming you setup github's hoock to jenkins correctly, this should trigger your build job on each commit on github enterprise.
If your hook doesn't seem to work: To check if and what your github server actually would send to your jenkins server, you can temporarily replace the url to your jenkins server in github's webhook with something like requestb.in (this will let you inspect github's hook payload)

Resources