From 42a3b7d19554addb5ce811d4bb5b4c87786df941 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Soko=C5=82owski?= Date: Fri, 12 Apr 2019 09:17:14 +0200 Subject: [PATCH] fix setting of BUILD_TYPE and BRANCH params MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Jakub SokoĊ‚owski --- .gitignore | 3 +++ ci/jenkins.groovy | 25 +++++++++++++------------ 2 files changed, 16 insertions(+), 12 deletions(-) diff --git a/.gitignore b/.gitignore index a70216ede6..2b0b1641b0 100644 --- a/.gitignore +++ b/.gitignore @@ -163,3 +163,6 @@ logger_settings.ini conan*.txt conanbuildinfo.* conan.cmake + +# Env +.env.bkp diff --git a/ci/jenkins.groovy b/ci/jenkins.groovy index dd10cbec71..2d97a6fee1 100644 --- a/ci/jenkins.groovy +++ b/ci/jenkins.groovy @@ -28,28 +28,29 @@ def abortPreviousRunningBuilds() { } } +def strParam(key, value) { + /* just a helper for making string params */ + return [ + name: key, + value: value, + $class: 'StringParameterValue', + ] +} + def Build(name = null) { /** * Generate parameters to pass from current params * This allows utils.updateEnv() to work in sub-jobs **/ parameters = params.keySet().collectEntries { key -> - [(key): [ - name: key, - value: params.get(key), - $class: 'StringParameterValue' - ]] + [(key): strParam(key, params.get(key))] } /* default to current build type */ - parameters['BUILD_TYPE'].value = utils.getBuildType() + parameters['BUILD_TYPE'] = strParam('BUILD_TYPE', utils.getBuildType()) /* need to drop origin/ to match definitions of child jobs */ - parameters['BRANCH'].value = utils.branchName() + parameters['BRANCH'] = strParam('BRANCH', utils.branchName()) /* necessary for updating GitHub PRs */ - parameters['CHANGE_ID'] = [ - name: 'CHANGE_ID', - value: env.CHANGE_ID, - $class: 'StringParameterValue' - ] + parameters['CHANGE_ID'] = strParam('CHANGE_ID', env.CHANGE_ID) /* always pass the BRANCH and BUILD_TYPE params with current branch */ def b = build( job: name,