I've set up a Jenkins pipeline in which I want to run a Jenkinsfile, based on a Gerrit trigger. I have read a lot on here about how to set this up. I have added the GERRIT_REFSPEC
variable as parameter and $GERRIT_REFSPEC
under Advanced->Refspec in my pipeline.
The issue is that GERRIT_REFSPEC
is always empty when I trigger a build from Gerrit. I would expect it to contain something like "refs/changes/../.../."
. GERRIT_BRANCH
and other variables are set correctly. Even when I trigger a build from Jenkins by running "Build with parameters"
and overwrite the value, it's empty afterwards.
I have seen the error, because the Git checkout goes wrong. I've also tried creating a pipeline script directly in Jenkins and echoing multiple Gerrit parameters there. GERRIT_REFSPEC
seems the only one that's empty. All other variables contain valid information.
Can anyone tell me what I'm missing here? Thanks!