-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathaction.yml
More file actions
96 lines (89 loc) · 2.96 KB
/
Copy pathaction.yml
File metadata and controls
96 lines (89 loc) · 2.96 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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
name: 'FaultRay Resilience Check'
description: 'Score your infrastructure resilience before terraform apply. Catches SPOFs, cascade risks, and availability ceiling violations.'
author: 'Yutaro Maeda'
branding:
icon: 'shield'
color: 'blue'
inputs:
plan-file:
description: 'Path to Terraform plan JSON file'
required: false
default: ''
yaml-file:
description: 'Path to infrastructure YAML file'
required: false
default: ''
min-score:
description: 'Minimum resilience score (0-100). Fails if below.'
required: false
default: '0'
fail-on-regression:
description: 'Fail if resilience score drops from baseline'
required: false
default: 'false'
financial:
description: 'Include financial impact analysis'
required: false
default: 'false'
cost-per-hour:
description: 'Default cost per hour of downtime (USD)'
required: false
default: '10000'
outputs:
score:
description: 'Resilience score (0-100)'
annual-loss:
description: 'Estimated annual financial loss (USD)'
critical-count:
description: 'Number of critical findings'
report:
description: 'Path to generated report file'
badge-url:
description: 'Shields.io badge URL for the resilience score'
badge-markdown:
description: 'Markdown snippet for embedding the resilience badge in a README'
runs:
using: 'composite'
steps:
- name: Install FaultRay
shell: bash
run: pip install faultray
- name: Run Terraform Check
if: inputs.plan-file != ''
shell: bash
run: |
ARGS=""
if [ "${{ inputs.min-score }}" != "0" ]; then
ARGS="$ARGS --min-score ${{ inputs.min-score }}"
fi
if [ "${{ inputs.fail-on-regression }}" == "true" ]; then
ARGS="$ARGS --fail-on-regression"
fi
if [ "${{ inputs.financial }}" == "true" ]; then
ARGS="$ARGS --financial"
fi
faultray tf-check "${{ inputs.plan-file }}" $ARGS
- name: Run YAML Simulation
if: inputs.yaml-file != ''
shell: bash
run: |
faultray load "${{ inputs.yaml-file }}"
faultray simulate --json > faultray-report.json
if [ "${{ inputs.financial }}" == "true" ]; then
faultray financial "${{ inputs.yaml-file }}" --cost-per-hour "${{ inputs.cost-per-hour }}"
fi
- name: Generate Badge
if: inputs.yaml-file != ''
shell: bash
run: |
BADGE_MD=$(faultray badge "${{ inputs.yaml-file }}" 2>/dev/null | head -1)
BADGE_URL=$(faultray badge "${{ inputs.yaml-file }}" --url 2>/dev/null)
echo "badge-markdown=$BADGE_MD" >> "$GITHUB_OUTPUT"
echo "badge-url=$BADGE_URL" >> "$GITHUB_OUTPUT"
echo "### Resilience Badge" >> "$GITHUB_STEP_SUMMARY"
echo "" >> "$GITHUB_STEP_SUMMARY"
echo "$BADGE_MD" >> "$GITHUB_STEP_SUMMARY"
- name: Run Demo (no input)
if: inputs.plan-file == '' && inputs.yaml-file == ''
shell: bash
run: faultray demo