From b5036489c81e9d9ba4acd8f2d9f581007db12f1d Mon Sep 17 00:00:00 2001 From: Niels de Vos Date: Wed, 27 May 2020 09:59:42 +0200 Subject: [PATCH] ci: checkout PR with modified scripts for testing The `git` command does not allow checking out a non-branch (like a PR), so it is needed to use `checkout` instead. Signed-off-by: Niels de Vos --- ci-job-validation.groovy | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/ci-job-validation.groovy b/ci-job-validation.groovy index 6c861d637..413200fa1 100644 --- a/ci-job-validation.groovy +++ b/ci-job-validation.groovy @@ -7,9 +7,11 @@ def base = '' node('cico-workspace') { stage('checkout ci repository') { - git url: "${ci_git_repo}", - branch: "${ci_git_branch}", - changelog: false + if (params.ghprbPullId != null) { + ref = "pull/${ghprbPullId}/head" + } + checkout([$class: 'GitSCM', branches: [[name: 'FETCH_HEAD']], + userRemoteConfigs: [[url: "${ci_git_repo}", refspec: "${ref}"]]]) } stage('reserve bare-metal machine') { @@ -30,9 +32,6 @@ node('cico-workspace') { try { stage('prepare bare-metal machine') { - if (params.ghprbPullId != null) { - ref = "pull/${ghprbPullId}/head" - } if (params.ghprbTargetBranch != null) { base = "--base=${ghprbTargetBranch}" }