added list of all environments and defined export function
parent
277ea00ddb
commit
317e950357
|
|
@ -1,21 +1,13 @@
|
||||||
//not required right now as CN is reachable from EMEA as well
|
//not required right now as CN is reachable from EMEA as well
|
||||||
def loopEnvironments(environments){
|
|
||||||
print env.JENKINS_URL
|
environments=['EMEA_PROD', 'EMEA_PREPROD', 'NA_PROD', 'NA_PREPROD', 'CN_PROD', 'CN_PREPROD']
|
||||||
|
|
||||||
environments.each { key, val ->
|
|
||||||
|
@NonCPS // has to be NonCPS or the build breaks on the call to .each
|
||||||
//Execute only if you are on the same environment
|
def export_config_all(list) {
|
||||||
//not required right now as CN is reachable from EMEA as well
|
list.each { env ->
|
||||||
if (env.JENKINS_URL == environments."${key}"[3].'jenkins')
|
sh "python3 export.py ${env}"
|
||||||
{
|
}
|
||||||
envname = environments."${key}"[0].'name'
|
|
||||||
envurl = environments."${key}"[1].'env-url'
|
|
||||||
tokenname = environments."${key}"[2].'env-token-name'
|
|
||||||
|
|
||||||
sh 'python createReport.py "${envname}"'
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
pipeline {
|
pipeline {
|
||||||
options {
|
options {
|
||||||
|
|
@ -61,7 +53,7 @@
|
||||||
AWS_S3_BUCKET="coco-dynatrace-tfstate"
|
AWS_S3_BUCKET="coco-dynatrace-tfstate"
|
||||||
AWS_S3_REGION="eu-central-1"
|
AWS_S3_REGION="eu-central-1"
|
||||||
|
|
||||||
TERRAFORM_RESOURCES="dynatrace_management_zone"
|
//TERRAFORM_RESOURCES="dynatrace_management_zone"
|
||||||
|
|
||||||
//EMEA PROD
|
//EMEA PROD
|
||||||
TF_VAR_EMEA_PROD_ENV_URL="https://xxu26128.live.dynatrace.com"
|
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')
|
TF_VAR_NA_PREPROD_API_TOKEN=credentials('NAPREPROD_TOKEN_VAR')
|
||||||
|
|
||||||
//CN PROD
|
//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')
|
TF_VAR_CN_PROD_API_TOKEN=credentials('CNPROD_TOKEN_VAR')
|
||||||
|
|
||||||
//CN PREPROD
|
//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')
|
TF_VAR_CN_PREPROD_API_TOKEN=credentials('CNPREPROD_TOKEN_VAR')
|
||||||
|
|
||||||
//TERRAFORM
|
//TERRAFORM
|
||||||
|
|
@ -130,15 +122,17 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
stage('Execute Export Script TERRAFORM') {
|
stage('Execute Export Script TERRAFORM') {
|
||||||
steps {
|
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
|
//Only required once CN is not reachable from EMEA
|
||||||
//loopEnvironments(environments)
|
//loopEnvironments(environments)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
stage('Send report') {
|
stage('Send report') {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue