From 06eb7535f407cad1999004fb750e4cc227f62016 Mon Sep 17 00:00:00 2001 From: Marko Kaapu Date: Tue, 3 Dec 2024 15:12:52 +0000 Subject: [PATCH] Add setup stage to only load project configuration RUN_TYPE choice parameter added with 'normal' and 'setup' runs. Only 'Setup' stage is executed when 'setup' is chosen. 'Setup' stage only loads confifuration and marks result as NOT_BUILT. 'Setup' stage is also run when 'queue' method (from Job DSL plugin) is called with JCasC. Signed-off-by: Marko Kaapu --- ghaf-main-pipeline.groovy | 52 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) 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