File tree Expand file tree Collapse file tree 2 files changed +10
-12
lines changed Expand file tree Collapse file tree 2 files changed +10
-12
lines changed Original file line number Diff line number Diff line change @@ -60,7 +60,6 @@ pipeline {
60
60
env.Service = serviceName
61
61
}
62
62
63
- def final_path = " ${ WORKSPACE} /${ env.Region} /${ env.Service} "
64
63
sh " cd \" ${ WORKSPACE} /${ env.Region} /${ env.Service} \" && terraform init -upgrade"
65
64
// Run Terraform plan and capture the output
66
65
terraformPlanOutput = sh(script : " cd \" ${ WORKSPACE} /${ env.Region} /${ env.Service} \" && terraform plan -out=tfplan.out" , returnStdout : true ). trim()
Original file line number Diff line number Diff line change @@ -49,22 +49,21 @@ pipeline {
49
49
env.Region = regionName
50
50
env.Service = serviceName
51
51
52
- sh " cd \" ${ WORKSPACE} /${ env.Region} /${ env.Service} \" && terraform init -upgrade"
53
- // sh "cd \"${WORKSPACE}/${env.Region}/${env.Service}\" && terraform plan -destroy"
54
-
55
- // Run Terraform plan
56
- terraformPlanOutput = sh(script : " cd \" ${ WORKSPACE} /${ env.Region} /${ env.Service} \" && terraform plan -destroy" , returnStdout : true ). trim()
57
- } else {
52
+ } else {
58
53
// Assuming job name format is <region_name>/job/job_name
59
54
def regionName = parts[1 ]
55
+ def serviceName = ' '
56
+ if (regionName == ' global' ) {
57
+ serviceName = ' rpc'
58
+ }
60
59
// Set environment variables for reuse
61
60
env.Region = regionName
61
+ env.Service = serviceName
62
62
63
- sh " cd \" ${ WORKSPACE} /${ env.Region} \" && terraform init -upgrade"
64
-
65
- // Run Terraform plan
66
- terraformPlanOutput = sh(script : " cd \" ${ WORKSPACE} /${ env.Region} \" && terraform plan -destroy" , returnStdout : true ). trim()
67
- }
63
+ }
64
+ sh " cd \" ${ WORKSPACE} /${ env.Region} \" && terraform init -upgrade"
65
+ // Run Terraform plan
66
+ terraformPlanOutput = sh(script : " cd \" ${ WORKSPACE} /${ env.Region} \" && terraform plan -destroy" , returnStdout : true ). trim()
68
67
69
68
// Check if the plan contains any changes
70
69
if (terraformPlanOutput. contains(' No changes.' )) {
You can’t perform that action at this time.
0 commit comments