From adece898c6e97facd1f36aeeb741ef49f6fb59a0 Mon Sep 17 00:00:00 2001 From: Yug Gupta Date: Mon, 11 May 2020 18:50:07 +0530 Subject: [PATCH] ci: check for ghprbPullId env variable The script checks for ghprbPullId env variable and if found unset, runs the script for master to support regular builds. Signed-off-by: Yug Gupta --- make-containerized-build.groovy | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/make-containerized-build.groovy b/make-containerized-build.groovy index c4ea32d13..8f452c85f 100644 --- a/make-containerized-build.groovy +++ b/make-containerized-build.groovy @@ -2,13 +2,9 @@ def cico_retries = 16 def cico_retry_interval = 60 def ci_git_repo = 'https://github.com/ceph/ceph-csi' def ci_git_branch = 'ci/centos' +def ref = "master" node('cico-workspace') { - // environment (not?) set by Jenkins, or not? - environment { - GIT_REPO = 'https://github.com/ceph/ceph-csi' - GIT_BRANCH = 'master' - } stage('checkout ci repository') { git url: "${ci_git_repo}", @@ -27,12 +23,15 @@ node('cico-workspace') { try { stage('prepare bare-metal machine') { + if ("${ghprbPullId}".length() != 0) { + ref = "pull/${ghprbPullId}/head" + } 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 --gitrepo=${GIT_REPO} --branch=${GIT_BRANCH}' + 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}" } - + stage('build') { - sh 'ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no root@${CICO_NODE} "cd /opt/build && make containerized-build CONTAINER_CMD=podman"' + sh 'ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no root@${CICO_NODE} "cd /opt/build/go/src/github.com/ceph/ceph-csi && make containerized-build CONTAINER_CMD=podman"' } }