How do I pass the commit SHA as a parameter in GIT

2019-07-28 07:40发布

问题:

I want to trigger a Jenkins Job if there is code commit made to Gitlab

I am using WebHooks for this:

The URL I am trying is

http://10.192.39.32:1024/job/SCMSnaps/buildWithParameters?token=secretkey&SNAP=$GIT_COMMIT

I want SNAP to hold the value of the SHA Number on the Gitlab

can anyone help with the correct way to pass variables in a WebHook URL?

回答1:

You should install the gitlab hook plugin for jenkins, it will allow you to do just what you want :
https://wiki.jenkins-ci.org/display/JENKINS/Gitlab+Hook+Plugin