From 51fa5cca48fe7f6cd7d639a41e8112a38b23f490 Mon Sep 17 00:00:00 2001 From: Niels de Vos Date: Wed, 21 Oct 2020 14:55:50 +0200 Subject: [PATCH] ci: use refs/pull//merge to prevent need for rebases refs/pull//head might not contain the most current state of the branch. In case other PRs got merged, the PR under test needs rebasing. GitHub offers refs/pull//merge to checkout the rebased PR, use that in the CI jobs. In case refs/pull//merge is not available, it means the PR can not be rebased on its target branch. This will cause the CI job to fail, but GitHub also will have a message about rebase conflicts. Signed-off-by: Niels de Vos --- commitlint.groovy | 4 ++-- mini-e2e-helm.groovy | 2 +- mini-e2e.groovy | 2 +- upgrade-tests.groovy | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/commitlint.groovy b/commitlint.groovy index 3141725fa..5630f4e8a 100644 --- a/commitlint.groovy +++ b/commitlint.groovy @@ -31,7 +31,7 @@ node('cico-workspace') { try { stage('prepare bare-metal machine') { if (params.ghprbPullId != null) { - ref = "pull/${ghprbPullId}/head" + ref = "pull/${ghprbPullId}/merge" } sh 'scp -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no ./prepare.sh root@${CICO_NODE}:' sh "ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no root@${CICO_NODE} ./prepare.sh --workdir=/opt/build/go/src/github.com/ceph/ceph-csi --gitrepo=${ci_git_repo} --ref=${ref} --history" @@ -41,7 +41,7 @@ node('cico-workspace') { if (params.ghprbTargetBranch != null) { git_since = "origin/${ghprbTargetBranch}" } - sh "ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no root@${CICO_NODE} 'cd /opt/build/go/src/github.com/ceph/ceph-csi && make containerized-test CONTAINER_CMD=podman TARGET=commitlint GIT_SINCE=${git_since} REBASE=1'" + sh "ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no root@${CICO_NODE} 'cd /opt/build/go/src/github.com/ceph/ceph-csi && make containerized-test CONTAINER_CMD=podman TARGET=commitlint GIT_SINCE=${git_since}'" } } diff --git a/mini-e2e-helm.groovy b/mini-e2e-helm.groovy index cc8c79a00..44d035cb4 100644 --- a/mini-e2e-helm.groovy +++ b/mini-e2e-helm.groovy @@ -52,7 +52,7 @@ node('cico-workspace') { stage('checkout PR') { if (params.ghprbPullId != null) { - ref = "pull/${ghprbPullId}/head" + ref = "pull/${ghprbPullId}/merge" } if (params.ghprbTargetBranch != null) { git_since = "${ghprbTargetBranch}" diff --git a/mini-e2e.groovy b/mini-e2e.groovy index b2ccd3f65..4a6942e9f 100644 --- a/mini-e2e.groovy +++ b/mini-e2e.groovy @@ -49,7 +49,7 @@ node('cico-workspace') { stage('checkout PR') { if (params.ghprbPullId != null) { - ref = "pull/${ghprbPullId}/head" + ref = "pull/${ghprbPullId}/merge" } if (params.ghprbTargetBranch != null) { git_since = "${ghprbTargetBranch}" diff --git a/upgrade-tests.groovy b/upgrade-tests.groovy index c3b81a2c5..b28122e49 100644 --- a/upgrade-tests.groovy +++ b/upgrade-tests.groovy @@ -49,7 +49,7 @@ node('cico-workspace') { stage('checkout PR') { if (params.ghprbPullId != null) { - ref = "pull/${ghprbPullId}/head" + ref = "pull/${ghprbPullId}/merge" } if (params.ghprbTargetBranch != null) { git_since = "${ghprbTargetBranch}"