Skip to content

Commit

Permalink
Add setup stage to only load project configuration
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
mkaapu committed Dec 9, 2024
1 parent 0246bcb commit 06eb753
Showing 1 changed file with 52 additions and 0 deletions.
52 changes: 52 additions & 0 deletions ghaf-main-pipeline.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@ properties([
githubProjectProperty(displayName: '', projectUrlStr: REPO_URL),
])

def run_type_description = '''
normal - executing all configured build and test stages normally<br>
setup - only reloading configuration, not running futher stages
'''

// Record failed target(s)
def failedTargets = []

Expand Down Expand Up @@ -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) {
Expand All @@ -110,6 +146,14 @@ pipeline {
}

stage('Evaluate') {
when {
not {
anyOf {
triggeredBy 'JobDslCause';
environment name: 'RUN_TYPE', value: 'setup'
}
}
}
steps {
dir(WORKDIR) {
script {
Expand All @@ -121,6 +165,14 @@ pipeline {
}

stage('Build targets') {
when {
not {
anyOf {
triggeredBy 'JobDslCause';
environment name: 'RUN_TYPE', value: 'setup'
}
}
}
steps {
script {
parallel target_jobs
Expand Down

0 comments on commit 06eb753

Please sign in to comment.