gitmavendeploymentjenkinspromotions

Jenkins using Git Plugin not populating GIT_COMMIT to promoted build


I am trying to set up a series of jobs in Jenkins to build and deploy an application using the Promoting plug in. We are currently using Git as our SCM and we are using the Git Plug in to help with the builds. This particular build is a Maven build. The steps I am trying to implement is as follows:

The problem is the deployment job never gets the GIT_COMMIT value. So it is always failing while trying to retrieve the code from Git.

So far I have tried:

So far, no luck.

I must add that all the other parameters and variables are propagating properly, the Deployment environment one, I have one for versioning, BUILD_NUMBER, etc. everything propagates well, except for GIT_COMMIT.

I also have a similar setup for another application, this is a Grails application, and the GIT_COMMIT propagates perfectly fine there.

These are the versions I am using:

Any ideas are more than welcome. Thank you.


Solution

  • I was able to get a workaround, but I didn't find a solution for the original issue. The original issue is the GIT_COMMIT is not being propagated to the deployment job and I was unable to make that work. Instead, to have my process working I did the following:

    On the build job, in the promotion process, when triggering the integration job I added "Predefined parameters" with the value: BUILD_COMMIT=${GIT_COMMIT}.

    On the integration job, when triggering the deployment job, I am adding a "Current build parameters" parameter.

    On the deployment job, in the git configuration, in the "Branches to build" field I am using ${BUILD_COMMIT}.

    This is triggering all correctly and the deployment job is getting the proper commit number when deploying.

    I hope this helps.