@@ -45,26 +45,26 @@ pipeline {
45
45
// Assuming the job name format is <region_name>/job/<service_name>/job/job_name
46
46
def regionName = parts[1 ]
47
47
def serviceName = parts[2 ]
48
-
49
48
// Set environment variables for reuse in subsequent stages
50
49
env.Region = regionName
51
50
env.Service = serviceName
52
-
53
- sh " cd \" ${ WORKSPACE} /${ env.Region} /${ env.Service} \" && terraform init -upgrade"
54
-
55
- // Run Terraform plan and capture the output
56
- terraformPlanOutput = sh(script : " cd \" ${ WORKSPACE} /${ env.Region} /${ env.Service} \" && terraform plan -out=tfplan.out" , returnStdout : true ). trim()
57
- } else {
51
+ } else {
58
52
// Assuming the job name format is <region_name>/job/job_name
59
53
def regionName = parts[1 ]
60
-
54
+ def serviceName = ' '
55
+ if (regionName == ' global' ) {
56
+ serviceName = ' rpc'
57
+ }
61
58
// Set environment variables for reuse in subsequent stages
62
59
env.Region = regionName
63
- sh " cd \" ${ WORKSPACE} /${ env.Region} \" && terraform init -upgrade"
60
+ env.Service = serviceName
61
+ }
62
+
63
+ def final_path = " ${ WORKSPACE} /${ env.Region} /${ env.Service} "
64
+ sh " cd \" ${ WORKSPACE} /${ env.Region} /${ env.Service} \" && terraform init -upgrade"
65
+ // Run Terraform plan and capture the output
66
+ terraformPlanOutput = sh(script : " cd \" ${ WORKSPACE} /${ env.Region} /${ env.Service} \" && terraform plan -out=tfplan.out" , returnStdout : true ). trim()
64
67
65
- // Run Terraform plan and capture the output
66
- terraformPlanOutput = sh(script : " cd \" ${ WORKSPACE} /${ env.Region} \" && terraform plan -out=tfplan.out" , returnStdout : true ). trim()
67
- }
68
68
69
69
// Check if the plan contains any changes
70
70
if (terraformPlanOutput. contains(' No changes.' )) {
0 commit comments