From f99a686342f0a759443e7bbee06dfbd19c8597bc Mon Sep 17 00:00:00 2001 From: rforstner Date: Fri, 26 Nov 2021 11:34:22 +0100 Subject: [PATCH] init commit --- Jenkinsfile | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 69b8d01..dbcec48 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,9 +1,13 @@ + def loopEnvironments(environments){ + environments.each { entry --> echo "${name}"} + + } pipeline { options { ansiColor('xterm') } //label libraryBuild is available in CN JAWS and ROW JAWS, therefore this one was used; no additional intents - agent{label 'libraryBuild'} + agent {label 'libraryBuild'} //here comes the trigger according to crontabs - jenkins is in UTC @@ -55,14 +59,14 @@ //Define how to // could also be a script block instead of a when block //e.g. add an additional parameter to python scripts to let python choose on which environment it should execute the script (not that good, as the script should be as generic as possible) - //e.g. just put the execute script step in both steps (not that good --> do not repeat yourself) - //e.g. create to environment.yaml files and use different files for different jenkins (not that good --> ugly) - //is the environment yaml even that good, should python be refactored to only execute one environment at time + //e.g. just put the execute python script step in both steps (not that good --> do not repeat yourself) + //e.g. create two environment.yaml files and use different files for different jenkins (not that good --> ugly) + //e.g. is the environment yaml even that good, should python be refactored to only execute one environment at time stage('Detect Jenkins Environment CN') { when { - expression { return env.JENKINS_URL ==~ 'china' } + expression { return env.JENKINS_URL == 'https://jaws-china.bmwgroup.net/opmaas/' } } steps { @@ -78,7 +82,9 @@ expression { return env.JENKINS_URL == 'https://jaws.bmwgroup.net/opapm/' } } steps { - sh 'echo "test" > test.csv' + script{environments = readYaml (file:'environment.yaml')} + sh 'echo "test" > test.csv' + loopEnvironments(environments) //env.JENKINS_URL //env.BRANCH_NAME print env.JENKINS_URL