From bd6d4bdbc8bbfc87dc171ec8340b50ee50805e91 Mon Sep 17 00:00:00 2001 From: Bram Prieshof Date: Sun, 21 Feb 2021 02:36:46 +0000 Subject: [PATCH] Add 'Goovy_Jenkins/groovy_script-if_step-When' --- Goovy_Jenkins/groovy_script-if_step-When | 32 ++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 Goovy_Jenkins/groovy_script-if_step-When diff --git a/Goovy_Jenkins/groovy_script-if_step-When b/Goovy_Jenkins/groovy_script-if_step-When new file mode 100644 index 0000000..36fe8e9 --- /dev/null +++ b/Goovy_Jenkins/groovy_script-if_step-When @@ -0,0 +1,32 @@ +when { + anyOf { + allOf { + expression { return (env.ImgVariant).startsWith('Default-') } + environment name: 'BuildDefault', value: 'true' + } + allOf { + expression { return (env.ImgVariant).startsWith('Extra-') } + environment name: 'BuildExtra', value: 'true' + } + } +} + + +stage('Build Check') { + steps { + script { + if (env.BuildDefault == 'true' && (env.ImgVariant).startsWith('Default-')) { + echo 'Building Default' + BuildThisLocal = true + } else if (env.BuildExtra == 'true' && (env.ImgVariant).startsWith('Extra-')) { + BuildThisLocal = true + echo 'Building Extra' + } else { + BuildThisLocal = false + echo 'not building' + } + env.BuildThis = BuildThisLocal + } + + } +} \ No newline at end of file