From 95c5a52856f1bd3604782120037310ff5cabd84a Mon Sep 17 00:00:00 2001 From: RichardG867 Date: Sat, 13 Nov 2021 13:48:00 -0300 Subject: [PATCH] Attempt Jenkins pipeline improvements including delegating builds --- .ci/Jenkinsfile | 38 +++++++++++++++++++++++++++++++++++--- .ci/build.sh | 2 ++ 2 files changed, 37 insertions(+), 3 deletions(-) diff --git a/.ci/Jenkinsfile b/.ci/Jenkinsfile index bd2bd37b0..d88b823c7 100644 --- a/.ci/Jenkinsfile +++ b/.ci/Jenkinsfile @@ -17,8 +17,10 @@ def gitClone() { cleanWs() + if (env.GIT_COMMIT == null) + env.GIT_COMMIT = BRANCH def scmVars = git url: 'https://github.com/richardg867/86Box.git', - branch: 'cleanup30' + branch: env.GIT_COMMIT env.GIT_COMMIT = scmVars.GIT_COMMIT } @@ -38,9 +40,12 @@ pipeline { agent any parameters { - choice(name: 'BUILD_TYPE', - choices: ['beta', 'none', 'alpha', 'beta', 'release'], // duplicated on purpose, first is default + string(name: 'BUILD_TYPE', + defaultValue: 'beta', /* !!! CHANGE HERE !!! for build type */ description: 'Build type to pass on to CMake. This may affect the UI icon and feature set.') + string(name: 'BRANCH', + defaultValue: 'master', + description: 'Used internally to make sure all downstream builds use the same commit.') } stages { @@ -63,5 +68,32 @@ pipeline { } } } + + /* If we're on the main jobs, trigger each of the downstream jobs. */ + stage('Trigger downstream jobs') { + when { + expression { + return env.JOB_BASE_NAME == '86Box-TestBuildPleaseIgnore'; + } + } + + steps { + ["${env.JOB_BASE_NAME}2"].each { + /* Set next build number for this job. */ + def job = Jenkins.instance.getItem(it) + job.nextBuildNumber = env.BUILD_NUMBER + job.saveNextBuildNumber() + + /* Trigger this job. */ + build propagate: false, + wait: false, + job: it, + parameters: [ + string(name: 'BUILD_TYPE', value: BUILD_TYPE) + string(name: 'BRANCH', value: env.GIT_COMMIT) + ] + } + } + } } } diff --git a/.ci/build.sh b/.ci/build.sh index 4808af571..621369d08 100644 --- a/.ci/build.sh +++ b/.ci/build.sh @@ -507,6 +507,8 @@ then fi # Run builds according to the Jenkins job name. +echo Temporarily disabled [$JOB_BASE_NAME] +exit 0 case $JOB_BASE_NAME in $project | $project-TestBuildPleaseIgnore) if is_windows