post PR message on init or validate failure (#1135)

This commit is contained in:
Ludovico Magnocavallo 2023-02-07 10:04:03 +01:00 committed by GitHub
parent 9b8de3e415
commit 2471e25c2c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 53 additions and 1 deletions

View File

@ -92,11 +92,13 @@ jobs:
# run Terraform init/validate/plan
- id: tf-init
name: Terraform init
continue-on-error: true
run: |
terraform init -no-color
- id: tf-validate
name: Terraform validate
continue-on-error: true
run: terraform validate -no-color
- id: tf-plan
@ -179,6 +181,16 @@ jobs:
body: output
})
- id: check-init
name: Check init failure
if: steps.tf-init.outcome != 'success'
run: exit 1
- id: check-validate
name: Check validate failure
if: steps.tf-validate.outcome != 'success'
run: exit 1
- id: check-plan
name: Check plan failure
if: steps.tf-plan.outcome != 'success'

View File

@ -88,11 +88,13 @@ jobs:
# run Terraform init/validate/plan
- id: tf-init
name: Terraform init
continue-on-error: true
run: |
terraform init -no-color
- id: tf-validate
name: Terraform validate
continue-on-error: true
run: terraform validate -no-color
- id: tf-plan
@ -175,6 +177,16 @@ jobs:
body: output
})
- id: check-init
name: Check init failure
if: steps.tf-init.outcome != 'success'
run: exit 1
- id: check-validate
name: Check validate failure
if: steps.tf-validate.outcome != 'success'
run: exit 1
- id: check-plan
name: Check plan failure
if: steps.tf-plan.outcome != 'success'

View File

@ -29,7 +29,9 @@ env:
FAST_WIF_PROVIDER: ${identity_provider}
SSH_AUTH_SOCK: /tmp/ssh_agent.sock
TF_PROVIDERS_FILE: ${tf_providers_file}
TF_VAR_FILES: ${tf_var_files == [] ? "''" : join("\n ", tf_var_files)}
%{~ if tf_var_files != [] ~}
TF_VAR_FILES: ${join("\n ", tf_var_files)}
%{~ endif ~}
TF_VERSION: 1.3.2
jobs:
@ -73,11 +75,13 @@ jobs:
run: |
gcloud alpha storage cp -r \
"gs://$${{env.FAST_OUTPUTS_BUCKET}}/providers/$${{env.TF_PROVIDERS_FILE}}" ./
%{~ if tf_var_files != [] ~}
gcloud alpha storage cp -r \
"gs://$${{env.FAST_OUTPUTS_BUCKET}}/tfvars" ./
for f in $${{env.TF_VAR_FILES}}; do
ln -s "tfvars/$f" ./
done
%{~ endif ~}
- id: tf-setup
name: Set up Terraform
@ -88,10 +92,12 @@ jobs:
# run Terraform init/validate/plan
- id: tf-init
name: Terraform init
continue-on-error: true
run: |
terraform init -no-color
- id: tf-validate
continue-on-error: true
name: Terraform validate
run: terraform validate -no-color
@ -175,6 +181,16 @@ jobs:
body: output
})
- id: check-init
name: Check init failure
if: steps.tf-init.outcome != 'success'
run: exit 1
- id: check-validate
name: Check validate failure
if: steps.tf-validate.outcome != 'success'
run: exit 1
- id: check-plan
name: Check plan failure
if: steps.tf-plan.outcome != 'success'

View File

@ -88,10 +88,12 @@ jobs:
# run Terraform init/validate/plan
- id: tf-init
name: Terraform init
continue-on-error: true
run: |
terraform init -no-color
- id: tf-validate
continue-on-error: true
name: Terraform validate
run: terraform validate -no-color
@ -175,6 +177,16 @@ jobs:
body: output
})
- id: check-init
name: Check init failure
if: steps.tf-init.outcome != 'success'
run: exit 1
- id: check-validate
name: Check validate failure
if: steps.tf-validate.outcome != 'success'
run: exit 1
- id: check-plan
name: Check plan failure
if: steps.tf-plan.outcome != 'success'