Do not use Jenkins pipeline default checkout Jenkins pipeline default checkout has issues with merge commits and also do not take into consideration the Gerrit target branch where the patch-set is going to be merge into. Change-Id: I3633cb7da0b0461e74275a2572106e42b05e6509
diff --git a/Jenkinsfile b/Jenkinsfile index 41b0880..8b696b9 100644 --- a/Jenkinsfile +++ b/Jenkinsfile
@@ -1,7 +1,13 @@ pipeline { - options { checkoutToSubdirectory('zookeeper-refdb') } + options { skipDefaultCheckout true } agent { label 'bazel-debian' } stages { + stage('Checkout') { + steps { + sh "git clone -b ${env.GERRIT_BRANCH} https://gerrit.googlesource.com/plugins/zookeeper-refdb" + sh "cd zookeeper-refdb && git fetch origin refs/changes/${BRANCH_NAME} && git merge FETCH_HEAD" + } + } stage('Formatting') { steps { sh "find zookeeper-refdb -name '*.java' | xargs /home/jenkins/format/google-java-format-1.7 -i"