File tree 2 files changed +38
-26
lines changed
2 files changed +38
-26
lines changed Original file line number Diff line number Diff line change 31
31
default : ' '
32
32
type : string
33
33
description : ' The Octo STS identity name'
34
+ slack_channel :
35
+ required : false
36
+ type : string
37
+ default : ' '
38
+ description : Slack channel to post failure alert to. Will alert only when non-empty channel specified.
39
+
40
+ secrets :
41
+ SLACK_WEBHOOK :
42
+ required : false
43
+ description : Secret for accessing Slack
44
+
45
+ permissions :
46
+ contents : read
34
47
35
48
jobs :
36
49
terraform :
@@ -45,10 +58,11 @@ jobs:
45
58
PROJECT_ID : ${{ inputs.project_id }}
46
59
TF_PLAN_BIN : ' plan.tmp'
47
60
TF_PLAN_OUT : ' plan.out'
61
+ WORKING_DIR : ${{ inputs.working_directory }}
48
62
49
63
defaults :
50
64
run :
51
- working-directory : " ${{ inputs.working_directory }}"
65
+ working-directory : " ${{ env.WORKING_DIR }}"
52
66
53
67
steps :
54
68
- uses : step-security/harden-runner@63c24ba6bd7ba022e95695ff85de572c04a18142 # v2.7.0
86
100
- name : Setup terraform
87
101
uses : ' hashicorp/setup-terraform@a1502cd9e758c50496cc9ac5308c4843bcd56d36' # v3.0.0
88
102
with :
89
- terraform_version : 1.6
103
+ terraform_version : 1.9
90
104
91
105
- name : Terraform fmt
92
106
id : fmt
@@ -214,3 +228,16 @@ jobs:
214
228
- name : Terraform Apply
215
229
if : github.ref == 'refs/heads/main' && (github.event_name == 'push' || github.event_name == 'workflow_dispatch')
216
230
run : terraform apply -auto-approve -input=false "${{ env.TF_PLAN_BIN }}"
231
+
232
+ - uses : rtCamp/action-slack-notify@c33737706dea87cd7784c687dadc9adf1be59990 # v2.3.2
233
+ if : ${{ failure() }}
234
+ env :
235
+ SLACK_ICON : http://github.com/chainguard-dev.png?size=48
236
+ SLACK_USERNAME : guardian
237
+ SLACK_WEBHOOK : ${{ secrets.SLACK_WEBHOOK }}
238
+ SLACK_CHANNEL : ' octo-sts-alerts' # Use a channel
239
+ SLACK_COLOR : ' #8E1600'
240
+ MSG_MINIMAL : ' true'
241
+ SLACK_TITLE : Deploying OctoSTS to Cloud Run failed
242
+ SLACK_MESSAGE : |
243
+ For detailed logs: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}
Original file line number Diff line number Diff line change @@ -15,31 +15,16 @@ concurrency:
15
15
16
16
jobs :
17
17
deploy :
18
- runs-on : ubuntu-latest
19
-
20
18
if : github.repository == 'octo-sts/app'
21
-
19
+ uses : ./.github/workflows/.terraform.yaml
22
20
permissions :
23
21
contents : read # clone the repository contents
24
22
id-token : write # federates with GCP
25
-
26
- steps :
27
- - uses : ./.github/workflows/.terraform.yaml
28
- with :
29
- project_id : ' octo-sts'
30
- workload_identity_provider : ' projects/96355665038/locations/global/workloadIdentityPools/github-pool/providers/github-provider'
31
- service_account :
' [email protected] '
32
- working_directory : ./iac
33
-
34
- - uses : rtCamp/action-slack-notify@c33737706dea87cd7784c687dadc9adf1be59990 # v2.3.2
35
- if : ${{ failure() }}
36
- env :
37
- SLACK_ICON : http://github.com/chainguard-dev.png?size=48
38
- SLACK_USERNAME : guardian
39
- SLACK_WEBHOOK : ${{ secrets.SLACK_WEBHOOK }}
40
- SLACK_CHANNEL : ' octo-sts-alerts' # Use a channel
41
- SLACK_COLOR : ' #8E1600'
42
- MSG_MINIMAL : ' true'
43
- SLACK_TITLE : Deploying OctoSTS to Cloud Run failed
44
- SLACK_MESSAGE : |
45
- For detailed logs: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}
23
+ with :
24
+ project_id : ' octo-sts'
25
+ workload_identity_provider : ' projects/96355665038/locations/global/workloadIdentityPools/github-pool/providers/github-provider'
26
+ service_account :
' [email protected] '
27
+ working_directory : ./iac
28
+ slack_channel : ' octo-sts-alerts'
29
+ secrets :
30
+ SLACK_WEBHOOK : ${{ secrets.SLACK_WEBHOOK }}
You can’t perform that action at this time.
0 commit comments