gitjenkinsjenkins-pipelinegerritgerrit-trigger

Gerrit & Jenkins pipeline newest changes


I have a Jenkins and a Gerrit running to validate my code. Jenkins has the gerrit trigger plugin. Gerrit should trigger a declarative pipeline which gets the newest changes and build it.

this works: git fetch http://localhost:8081/PipelinePart1 refs/changes/87/387/1 && git checkout FETCH_HEAD

but is there a way to get always the newest changes?


Solution

  • Use the $GERRIT_REFSPEC build parameter which, in your case, will be equal to "refs/changes/87/387/1". See the following image for reference:

    GERRIT_REFSPEC