diff --git a/Jenkinsfile b/Jenkinsfile index cec6470..6969be8 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,21 +1,13 @@ //not required right now as CN is reachable from EMEA as well - def loopEnvironments(environments){ - print env.JENKINS_URL - - environments.each { key, val -> - - //Execute only if you are on the same environment - //not required right now as CN is reachable from EMEA as well - if (env.JENKINS_URL == environments."${key}"[3].'jenkins') - { - envname = environments."${key}"[0].'name' - envurl = environments."${key}"[1].'env-url' - tokenname = environments."${key}"[2].'env-token-name' - - sh 'python createReport.py "${envname}"' - } - - } + + environments=['EMEA_PROD', 'EMEA_PREPROD', 'NA_PROD', 'NA_PREPROD', 'CN_PROD', 'CN_PREPROD'] + + + @NonCPS // has to be NonCPS or the build breaks on the call to .each + def export_config_all(list) { + list.each { env -> + sh "python3 export.py ${env}" + } } pipeline { options { @@ -61,7 +53,7 @@ AWS_S3_BUCKET="coco-dynatrace-tfstate" AWS_S3_REGION="eu-central-1" - TERRAFORM_RESOURCES="dynatrace_management_zone" + //TERRAFORM_RESOURCES="dynatrace_management_zone" //EMEA PROD TF_VAR_EMEA_PROD_ENV_URL="https://xxu26128.live.dynatrace.com" @@ -80,11 +72,11 @@ TF_VAR_NA_PREPROD_API_TOKEN=credentials('NAPREPROD_TOKEN_VAR') //CN PROD - TF_VAR_CN_PROD_ENV_URL="https://dynatracemgd-tsp.bmwgroup.net/e/b921f1b9-c00e-4031-b9d1-f5a0d530757b" + TF_VAR_CN_PROD_ENV_URL="https://dyna-synth-cn.bmwgroup.com.cn/e/b921f1b9-c00e-4031-b9d1-f5a0d530757b" TF_VAR_CN_PROD_API_TOKEN=credentials('CNPROD_TOKEN_VAR') //CN PREPROD - TF_VAR_CN_PREPROD_ENV_URL="https://dynatracemgd-tsp.bmwgroup.net/e/ab88c03b-b7fc-45f0-9115-9e9ecc0ced35" + TF_VAR_CN_PREPROD_ENV_URL="https://dyna-synth-cn.bmwgroup.com.cn/e/ab88c03b-b7fc-45f0-9115-9e9ecc0ced35" TF_VAR_CN_PREPROD_API_TOKEN=credentials('CNPREPROD_TOKEN_VAR') //TERRAFORM @@ -130,15 +122,17 @@ } } - stage('Execute Export Script TERRAFORM') { steps { - sh 'python3 export.py TERRAFORM' + export_config_all(environments) + //sh 'python3 export.py EMEA_PROD' + //sh 'python3 export.py TERRAFORM' //Only required once CN is not reachable from EMEA //loopEnvironments(environments) - } + } + } stage('Send report') {