diff --git a/fmo-os-main-pipeline.groovy b/fmo-os-main-pipeline.groovy index 9435abb..7d2d6f5 100644 --- a/fmo-os-main-pipeline.groovy +++ b/fmo-os-main-pipeline.groovy @@ -26,6 +26,12 @@ def targets = [ '.#packages.x86_64-linux.fmo-os-rugged-tablet-7230-public-release' ] +// RUN_TYPE parameter description +def run_type_description = ''' +normal - executing all configured build and test stages normally
+setup - only reloading configuration, not running futher stages +''' + /////////////////////////////////////////////////////////////////////// // define code blocks per target to execute as brances for parallel step @@ -57,6 +63,9 @@ pipeline { string description: 'Branch (or revision reference) Specifier', name: 'BRANCH', defaultValue: DEFAULT_REF + choice name: 'RUN_TYPE', + choices: ['normal', 'setup' ], + description: run_type_description } triggers { pollSCM '* * * * *' @@ -79,8 +88,32 @@ pipeline { FMO_REF = params.getOrDefault('BRANCH', DEFAULT_REF) } stages { + stage('Setup') { + when { + anyOf { + triggeredBy 'JobDslCause'; + environment name: 'RUN_TYPE', value: 'setup' + } + } + steps { + script { + String note = 'Project configuration parsed.' + echo note + currentBuild.description = note + currentBuild.result = 'NOT_BUILT' + } + } + } stage('Checkout') { agent any + when { + not { + anyOf { + triggeredBy 'JobDslCause'; + environment name: 'RUN_TYPE', value: 'setup' + } + } + } steps { script { utils = load "utils.groovy" @@ -97,6 +130,14 @@ pipeline { } } stage('Test targets') { + when { + not { + anyOf { + triggeredBy 'JobDslCause'; + environment name: 'RUN_TYPE', value: 'setup' + } + } + } steps { script { parallel tests diff --git a/ghaf-main-pipeline.groovy b/ghaf-main-pipeline.groovy index 3b6bb6c..85d949d 100644 --- a/ghaf-main-pipeline.groovy +++ b/ghaf-main-pipeline.groovy @@ -15,6 +15,11 @@ properties([ githubProjectProperty(displayName: '', projectUrlStr: REPO_URL), ]) +def run_type_description = ''' +normal - executing all configured build and test stages normally
+setup - only reloading configuration, not running futher stages +''' + // Record failed target(s) def failedTargets = [] @@ -86,13 +91,44 @@ pipeline { triggers { pollSCM('* * * * *') } + parameters { + choice name: 'RUN_TYPE', + choices: ['normal', 'setup' ], + description: run_type_description + } options { disableConcurrentBuilds() timestamps () buildDiscarder(logRotator(numToKeepStr: '100')) } stages { + + stage('Setup') { + when { + anyOf { + triggeredBy 'JobDslCause'; + environment name: 'RUN_TYPE', value: 'setup' + } + } + steps { + script { + String note = 'Project configuration parsed.' + echo note + currentBuild.description = note + currentBuild.result = 'NOT_BUILT' + } + } + } + stage('Checkout') { + when { + not { + anyOf { + triggeredBy 'JobDslCause'; + environment name: 'RUN_TYPE', value: 'setup' + } + } + } steps { script { utils = load "utils.groovy" } dir(WORKDIR) { @@ -110,6 +146,14 @@ pipeline { } stage('Evaluate') { + when { + not { + anyOf { + triggeredBy 'JobDslCause'; + environment name: 'RUN_TYPE', value: 'setup' + } + } + } steps { dir(WORKDIR) { script { @@ -121,6 +165,14 @@ pipeline { } stage('Build targets') { + when { + not { + anyOf { + triggeredBy 'JobDslCause'; + environment name: 'RUN_TYPE', value: 'setup' + } + } + } steps { script { parallel target_jobs diff --git a/ghaf-nightly-pipeline.groovy b/ghaf-nightly-pipeline.groovy index 386c753..3d9d65f 100644 --- a/ghaf-nightly-pipeline.groovy +++ b/ghaf-nightly-pipeline.groovy @@ -17,6 +17,11 @@ properties([ githubProjectProperty(displayName: '', projectUrlStr: REPO_URL), ]) +def run_type_description = ''' +normal - executing all configured build and test stages normally
+setup - only reloading configuration, not running futher stages +''' + def target_jobs = [:] //////////////////////////////////////////////////////////////////////////////// @@ -151,6 +156,12 @@ pipeline { pollSCM('0 23 * * *') } + parameters { + choice name: 'RUN_TYPE', + choices: ['normal', 'setup' ], + description: run_type_description + } + options { disableConcurrentBuilds() timestamps () @@ -159,7 +170,32 @@ pipeline { stages { + stage('Setup') { + when { + anyOf { + triggeredBy 'JobDslCause'; + environment name: 'RUN_TYPE', value: 'setup' + } + } + steps { + script { + String note = 'Project configuration parsed.' + echo note + currentBuild.description = note + currentBuild.result = 'NOT_BUILT' + } + } + } + stage('Checkout') { + when { + not { + anyOf { + triggeredBy 'JobDslCause'; + environment name: 'RUN_TYPE', value: 'setup' + } + } + } steps { script { utils = load "utils.groovy" } dir(WORKDIR) { @@ -178,6 +214,14 @@ pipeline { } stage('Evaluate') { + when { + not { + anyOf { + triggeredBy 'JobDslCause'; + environment name: 'RUN_TYPE', value: 'setup' + } + } + } steps { dir(WORKDIR) { script { @@ -193,6 +237,14 @@ pipeline { } stage('Build targets') { + when { + not { + anyOf { + triggeredBy 'JobDslCause'; + environment name: 'RUN_TYPE', value: 'setup' + } + } + } steps { script { parallel target_jobs @@ -201,6 +253,14 @@ pipeline { } stage('Hardware tests') { + when { + not { + anyOf { + triggeredBy 'JobDslCause'; + environment name: 'RUN_TYPE', value: 'setup' + } + } + } steps { script { targets.each { diff --git a/ghaf-pre-merge-pipeline.groovy b/ghaf-pre-merge-pipeline.groovy index 53d6fd7..cbf3d85 100644 --- a/ghaf-pre-merge-pipeline.groovy +++ b/ghaf-pre-merge-pipeline.groovy @@ -46,6 +46,11 @@ properties([ ]) ]) +def run_type_description = ''' +normal - executing all configured build and test stages normally
+setup - only reloading configuration, not running futher stages +''' + def target_jobs = [:] //////////////////////////////////////////////////////////////////////////////// @@ -111,13 +116,42 @@ def targets = [ pipeline { agent { label 'built-in' } + parameters { + choice name: 'RUN_TYPE', + choices: ['normal', 'setup' ], + description: run_type_description + } options { disableConcurrentBuilds() timestamps () buildDiscarder(logRotator(numToKeepStr: '100')) } stages { + stage('Setup') { + when { + anyOf { + triggeredBy 'JobDslCause'; + environment name: 'RUN_TYPE', value: 'setup' + } + } + steps { + script { + String note = 'Project configuration parsed.' + echo note + currentBuild.description = note + currentBuild.result = 'NOT_BUILT' + } + } + } stage('Checkenv') { + when { + not { + anyOf { + triggeredBy 'JobDslCause'; + environment name: 'RUN_TYPE', value: 'setup' + } + } + } steps { sh 'set | grep -P "(GITHUB_PR_)"' // Fail if this build was not triggered by a PR @@ -132,6 +166,14 @@ pipeline { } } stage('Checkout') { + when { + not { + anyOf { + triggeredBy 'JobDslCause'; + environment name: 'RUN_TYPE', value: 'setup' + } + } + } steps { script { utils = load "utils.groovy" } dir(WORKDIR) { @@ -175,6 +217,14 @@ pipeline { } } stage('Set PR status pending') { + when { + not { + anyOf { + triggeredBy 'JobDslCause'; + environment name: 'RUN_TYPE', value: 'setup' + } + } + } steps { script { // https://www.jenkins.io/doc/pipeline/steps/github-pullrequest/ @@ -188,6 +238,14 @@ pipeline { } stage('Evaluate') { + when { + not { + anyOf { + triggeredBy 'JobDslCause'; + environment name: 'RUN_TYPE', value: 'setup' + } + } + } steps { dir(WORKDIR) { script { @@ -199,6 +257,14 @@ pipeline { } stage('Build targets') { + when { + not { + anyOf { + triggeredBy 'JobDslCause'; + environment name: 'RUN_TYPE', value: 'setup' + } + } + } steps { script { parallel target_jobs @@ -227,11 +293,13 @@ pipeline { } unsuccessful { script { - setGitHubPullRequestStatus( - state: 'FAILURE', - context: "${JOB_BASE_NAME}", - message: "Build #${BUILD_NUMBER} failed in ${currentBuild.durationString}", - ) + if(currentBuild.result != 'NOT_BUILT') { + setGitHubPullRequestStatus( + state: 'FAILURE', + context: "${JOB_BASE_NAME}", + message: "Build #${BUILD_NUMBER} failed in ${currentBuild.durationString}", + ) + } } } } diff --git a/ghaf-release-pipeline.groovy b/ghaf-release-pipeline.groovy index 9fa1297..3d49deb 100644 --- a/ghaf-release-pipeline.groovy +++ b/ghaf-release-pipeline.groovy @@ -19,6 +19,11 @@ properties([ ]) ]) +def run_type_description = ''' +normal - executing all configured build and test stages normally
+setup - only reloading configuration, not running futher stages +''' + target_jobs = [:] //////////////////////////////////////////////////////////////////////////////// @@ -91,6 +96,11 @@ def targets = [ pipeline { agent { label 'built-in' } + parameters { + choice name: 'RUN_TYPE', + choices: ['normal', 'setup' ], + description: run_type_description + } options { disableConcurrentBuilds() timestamps () @@ -101,7 +111,33 @@ pipeline { GITREF = params.getOrDefault('GITREF', DEF_GITREF) } stages { + + stage('Setup') { + when { + anyOf { + triggeredBy 'JobDslCause'; + environment name: 'RUN_TYPE', value: 'setup' + } + } + steps { + script { + String note = 'Project configuration parsed.' + echo note + currentBuild.description = note + currentBuild.result = 'NOT_BUILT' + } + } + } + stage('Checkout') { + when { + not { + anyOf { + triggeredBy 'JobDslCause'; + environment name: 'RUN_TYPE', value: 'setup' + } + } + } steps { script { utils = load "utils.groovy" } dir(WORKDIR) { @@ -120,6 +156,14 @@ pipeline { } stage('Evaluate') { + when { + not { + anyOf { + triggeredBy 'JobDslCause'; + environment name: 'RUN_TYPE', value: 'setup' + } + } + } steps { dir(WORKDIR) { script { @@ -131,6 +175,14 @@ pipeline { } stage('Build targets') { + when { + not { + anyOf { + triggeredBy 'JobDslCause'; + environment name: 'RUN_TYPE', value: 'setup' + } + } + } steps { script { parallel target_jobs @@ -139,6 +191,14 @@ pipeline { } stage('Hardware tests') { + when { + not { + anyOf { + triggeredBy 'JobDslCause'; + environment name: 'RUN_TYPE', value: 'setup' + } + } + } steps { script { targets.each {