简体   繁体   中英

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 (eg 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, eg "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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM