init commit

master
rforstner 2021-11-26 11:34:22 +01:00
parent cfdcd8b49e
commit f99a686342
1 changed files with 12 additions and 6 deletions

14
Jenkinsfile vendored
View File

@ -1,3 +1,7 @@
def loopEnvironments(environments){
environments.each { entry --> echo "${name}"}
}
pipeline { pipeline {
options { options {
ansiColor('xterm') ansiColor('xterm')
@ -55,14 +59,14 @@
//Define how to //Define how to
// could also be a script block instead of a when block // 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. 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. just put the execute python 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) //e.g. create two 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. is the environment yaml even that good, should python be refactored to only execute one environment at time
stage('Detect Jenkins Environment CN') { stage('Detect Jenkins Environment CN') {
when { when {
expression { return env.JENKINS_URL ==~ 'china' } expression { return env.JENKINS_URL == 'https://jaws-china.bmwgroup.net/opmaas/' }
} }
steps { steps {
@ -78,7 +82,9 @@
expression { return env.JENKINS_URL == 'https://jaws.bmwgroup.net/opapm/' } expression { return env.JENKINS_URL == 'https://jaws.bmwgroup.net/opapm/' }
} }
steps { steps {
script{environments = readYaml (file:'environment.yaml')}
sh 'echo "test" > test.csv' sh 'echo "test" > test.csv'
loopEnvironments(environments)
//env.JENKINS_URL //env.JENKINS_URL
//env.BRANCH_NAME //env.BRANCH_NAME
print env.JENKINS_URL print env.JENKINS_URL