Check if DEBIAN_BRANCH exists in build-debian-packages-pipeline
This patch fix an issue when build-debian-packages-pipeline pipeline
crashed due to checkout non-existent DEBIAN_BRANCH.
Change-Id: If25752793e9988d756cd75dc66eceef166652eba
Related-PROD: PROD-16786
diff --git a/build-debian-packages-pipeline.groovy b/build-debian-packages-pipeline.groovy
index 4220b7a..8bfbff6 100644
--- a/build-debian-packages-pipeline.groovy
+++ b/build-debian-packages-pipeline.groovy
@@ -64,7 +64,15 @@
scm: [$class: 'GitSCM', branches: pollBranches, doGenerateSubmoduleConfigurations: false,
extensions: extensions, submoduleCfg: [], userRemoteConfigs: userRemoteConfigs]
if (debian_branch){
- sh("git checkout "+DEBIAN_BRANCH)
+ /* There are 2 schemas of build spec keeping:
+ 1. Separate branch with build specs. I.e. debian/xenial
+ 2. Separate directory with specs.
+ Logic below makes package build compatible with both schemas.
+ */
+ def retStatus = sh(script: 'git checkout ' + DEBIAN_BRANCH, returnStatus: true)
+ if (retStatus != 0) {
+ common.warningMsg("Cannot checkout ${DEBIAN_BRANCH} branch. Going to build package by ${SOURCE_BRANCH} branch.")
+ }
}
}
debian.cleanup(OS+":"+DIST)