env variables

master
SLW\ARNAUA 2023-06-01 12:44:00 +02:00
parent 814f20b278
commit cd53d0856e
2 changed files with 16 additions and 17 deletions

28
Jenkinsfile vendored
View File

@ -19,18 +19,18 @@ pipeline {
AUTH = credentials('proxy')
proxy_user = "${AUTH_USR}"
proxy_pw = "${AUTH_PSW}"
EMEA_PROD_API_TOKEN = credentials('EUPROD_TOKEN_VAR')
EMEA_PROD_ENV_URL = 'https://xxu26128.live.dynatrace.com'
EMEA_PREPROD_API_TOKEN = credentials('EUPREPROD_TOKEN_VAR')
EMEA_PREPROD_ENV_URL = 'https://qqk70169.live.dynatrace.com'
NA_PROD_API_TOKEN = credentials('NAPROD_TOKEN_VAR')
NA_PROD_ENV_URL = 'https://wgv50241.live.dynatrace.com'
NA_PREPROD_API_TOKEN = credentials('NAPREPROD_TOKEN_VAR')
NA_PREPROD_ENV_URL = 'https://onb44935.live.dynatrace.com'
CN_PROD_API_TOKEN = credentials('CNPROD_TOKEN_VAR')
CN_PROD_ENV_URL= 'https://dynatracemgd-tsp.bmwgroup.net/e/b921f1b9-c00e-4031-b9d1-f5a0d530757b'
CN_PREPROD_API_TOKEN = credentials('CNPREPROD_TOKEN_VAR')
CN_PREPROD_ENV_URL = 'https://dynatracemgd-tsp.bmwgroup.net/e/ab88c03b-b7fc-45f0-9115-9e9ecc0ced35'
env.EMEA_PROD_API_TOKEN = credentials('EUPROD_TOKEN_VAR')
env.EMEA_PROD_ENV_URL = 'https://xxu26128.live.dynatrace.com'
env.EMEA_PREPROD_API_TOKEN = credentials('EUPREPROD_TOKEN_VAR')
env.EMEA_PREPROD_ENV_URL = 'https://qqk70169.live.dynatrace.com'
env.NA_PROD_API_TOKEN = credentials('NAPROD_TOKEN_VAR')
env.NA_PROD_ENV_URL = 'https://wgv50241.live.dynatrace.com'
env.NA_PREPROD_API_TOKEN = credentials('NAPREPROD_TOKEN_VAR')
env.NA_PREPROD_ENV_URL = 'https://onb44935.live.dynatrace.com'
env.CN_PROD_API_TOKEN = credentials('CNPROD_TOKEN_VAR')
env.CN_PROD_ENV_URL= 'https://dynatracemgd-tsp.bmwgroup.net/e/b921f1b9-c00e-4031-b9d1-f5a0d530757b'
env.CN_PREPROD_API_TOKEN = credentials('CNPREPROD_TOKEN_VAR')
env.CN_PREPROD_ENV_URL = 'https://dynatracemgd-tsp.bmwgroup.net/e/ab88c03b-b7fc-45f0-9115-9e9ecc0ced35'
}
stages {
@ -75,7 +75,7 @@ pipeline {
stage('Install Required Packages') {
steps {
dir("/opt/workspace/coco_apm_dynatrace_terraform_backup_exporter") {
dir("/opt/workspace/coco_apm_dynatrace_terraform_backup_exporter/") {
retry(3) {
sleep(300*installRetryCount)
script {
@ -94,7 +94,7 @@ pipeline {
stage('Execute Exporting Script') {
steps {
dir("/opt/workspace/coco_apm_dynatrace_terraform_backup_exporter") {
dir("/opt/workspace/coco_apm_dynatrace_terraform_backup_exporter/") {
retry(3) {
sleep(300*exportRetryCount)
script {

View File

@ -9,8 +9,8 @@ from glob import glob
def setEnv(env, time, path, dashboard):
os.environ['DYNATRACE_ENV_URL'] = str(os.getenv(env + "_ENV_URL",default=str(env + "_ENV_URL")))
os.environ['DYNATRACE_API_TOKEN'] = str(os.getenv(env + "_API_TOKEN"))
os.environ['DYNATRACE_ENV_URL'] = str(os.environ.get(env + "_ENV_URL"))
os.environ['DYNATRACE_API_TOKEN'] = str(os.environ.get(env + "_API_TOKEN"))
os.environ['DYNATRACE_TARGET_FOLDER'] = str(path + time + "_" + env + dashboard)
return os.environ
@ -42,7 +42,6 @@ def runProcess(process_name, input_params):
if __name__ == "__main__":
if(len(sys.argv) == 1):
print(os.getcwd())
timestamp = time.strftime("%Y%m%d-%H%M%S")
outputFolder = "./output/"
environments = ["EMEA_PROD", "EMEA_PREPROD", "NA_PROD", "NA_PREPROD", "CN_PROD", "CN_PREPROD"]