-
Notifications
You must be signed in to change notification settings - Fork 1
72 lines (63 loc) · 2.21 KB
/
Copy pathapprove-override.yml
File metadata and controls
72 lines (63 loc) · 2.21 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
name: Approve Override
# Workflow dispatch — only runs after approval from the 'override-approval'
# GitHub environment (requires board member review).
on:
workflow_dispatch:
inputs:
plan_key:
description: "S3 plan key (from the Slack alert)"
required: true
type: string
repo:
description: "Repository (e.g. javaBin/moresleep)"
required: true
type: string
run_id:
description: "Failed apply run ID to retrigger"
required: true
type: string
reason:
description: "Reason for override"
required: true
type: string
permissions:
id-token: write
contents: read
actions: write
env:
AWS_ACCOUNT_ID: "553637109631"
AWS_REGION: eu-central-1
jobs:
approve:
name: Approve Override
runs-on: ubuntu-latest
environment: override-approval
steps:
- uses: actions/checkout@v6
with:
sparse-checkout: scripts
- name: Configure AWS credentials via OIDC
uses: aws-actions/configure-aws-credentials@v6
with:
role-to-assume: arn:aws:iam::${{ env.AWS_ACCOUNT_ID }}:role/javabin-ci-override-approver
aws-region: ${{ env.AWS_REGION }}
- name: Sign override via gate Lambda
run: |
aws lambda invoke \
--function-name javabin-apply-gate \
--payload "$(jq -n \
--arg action sign \
--arg plan_key "${{ inputs.plan_key }}" \
--arg approved_by "${{ github.actor }}" \
--arg reason "${{ inputs.reason }}" \
'{action: $action, plan_key: $plan_key, approved_by: $approved_by, reason: $reason}')" \
--cli-binary-format raw-in-base64-out \
/dev/stdout
- name: Notify Slack
env:
SSM_WEBHOOK_PARAM: /javabin/slack/platform-override-alerts-webhook
run: sh scripts/notify-slack.sh "Risk Override Approved" "*Repo:* ${{ inputs.repo }}\n*Plan:* \`${{ inputs.plan_key }}\`\n*By:* ${{ github.actor }}\n*Reason:* ${{ inputs.reason }}"
- name: Retrigger failed apply
env:
GH_TOKEN: ${{ github.token }}
run: gh run rerun ${{ inputs.run_id }} --repo ${{ inputs.repo }} --failed