@quantile-co/factory-pi 0.0.0-stage → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/dist/DEPENDENCY-LICENSES.txt +261 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +3870 -0
- package/dist/settings.json +29 -0
- package/package.json +407 -3
- package/skills/day-zero-deploy/SKILL.md +32 -0
- package/skills/day-zero-deploy/references/local-state.md +267 -0
- package/skills/deploy/SKILL.md +34 -0
- package/skills/deploy/references/configuration.md +138 -0
- package/skills/deploy/references/plan-apply.md +189 -0
- package/skills/deploy/references/saved-plan-review.md +59 -0
- package/README.md +0 -3
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
# Review a saved plan privately
|
|
2
|
+
|
|
3
|
+
First follow the repository's Plan procedure to verify the producing run,
|
|
4
|
+
source revision, target and selected layer. Keep main fixed during review.
|
|
5
|
+
Apply trusts the operator's choice; it does not check the producing source.
|
|
6
|
+
Use the pinned shell and an authorized plan reader, not broader IAM grants.
|
|
7
|
+
|
|
8
|
+
Set `GH_REPO`, the reviewed Terraform root `TF_DIR`, the producing bucket and
|
|
9
|
+
`TF_LAYER` and `GH_PLAN_REF` copied as `RUN_ID/ATTEMPT/GENERATION` from the
|
|
10
|
+
selected Plan job's summary. The
|
|
11
|
+
components below are derived helpers, not additional inputs. Keep downloads
|
|
12
|
+
and provider schemas outside Git and the Nix store:
|
|
13
|
+
|
|
14
|
+
```sh
|
|
15
|
+
set -euo pipefail; set +x; umask 077
|
|
16
|
+
: "${GH_REPO:?verified owner/repo}"
|
|
17
|
+
repo=$(env -u GH_REPO gh repo view --json nameWithOwner --jq .nameWithOwner)
|
|
18
|
+
test "$GH_REPO" = "$repo"
|
|
19
|
+
: "${TF_DIR:?reviewed Terraform root}"
|
|
20
|
+
: "${TF_LAYER:?selected infrastructure or application layer}"
|
|
21
|
+
: "${GCP_TF_STATE_BUCKET:?verified producing Plan bucket}"
|
|
22
|
+
: "${GH_PLAN_REF:?reviewed run/attempt/generation}"
|
|
23
|
+
[[ "$GH_PLAN_REF" =~ ^([1-9][0-9]*)/([1-9][0-9]*)/([1-9][0-9]*)$ ]]
|
|
24
|
+
plan_run_id=${BASH_REMATCH[1]}
|
|
25
|
+
plan_attempt=${BASH_REMATCH[2]}
|
|
26
|
+
plan_generation=${BASH_REMATCH[3]}
|
|
27
|
+
gh api "repos/$GH_REPO/actions/runs/$plan_run_id/attempts/$plan_attempt" \
|
|
28
|
+
--jq '{id,run_attempt,head_sha,path,event,status,conclusion,created_at}'
|
|
29
|
+
gh api "repos/$GH_REPO/actions/runs/$plan_run_id/attempts/$plan_attempt/jobs" \
|
|
30
|
+
--jq '.jobs[] | {name,conclusion}'
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
Confirm the response is the intended successful Plan attempt on the reviewed
|
|
34
|
+
source before downloading, and that the successful job matches `TF_LAYER` and
|
|
35
|
+
`TF_DIR`; the other offered layer must be skipped. An ambiguous or failed run is
|
|
36
|
+
not reviewable success.
|
|
37
|
+
|
|
38
|
+
```sh
|
|
39
|
+
REVIEW_DIR=$(mktemp -d)
|
|
40
|
+
repo_id=$(gh api "repos/$GH_REPO" --jq .id)
|
|
41
|
+
base="gs://$GCP_TF_STATE_BUCKET/plans/$repo_id/$plan_run_id/$plan_attempt"
|
|
42
|
+
gcloud storage cp "$base/saved-plan/plan.tfplan#$plan_generation" "$REVIEW_DIR/plan.tfplan"
|
|
43
|
+
test -s "$REVIEW_DIR/plan.tfplan"
|
|
44
|
+
TF_DATA_DIR="$REVIEW_DIR/schemas" tofu -chdir="$TF_DIR" init \
|
|
45
|
+
-backend=false -input=false -lockfile=readonly
|
|
46
|
+
TF_DATA_DIR="$REVIEW_DIR/schemas" tofu -chdir="$TF_DIR" show -no-color \
|
|
47
|
+
"$REVIEW_DIR/plan.tfplan" > "$REVIEW_DIR/plan.txt"
|
|
48
|
+
TF_DATA_DIR="$REVIEW_DIR/schemas" tofu -chdir="$TF_DIR" show -json \
|
|
49
|
+
"$REVIEW_DIR/plan.tfplan" > "$REVIEW_DIR/plan.json"
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
Read the complete private plan and variables, including replacements, deletions,
|
|
53
|
+
IAM, repository policy and state protections. Follow the repository's additional
|
|
54
|
+
checks for DNS, releases or application resources. Never paste plans or provider
|
|
55
|
+
payloads into public logs or issues. Stop on unexpected changes or a changed
|
|
56
|
+
source/state; request a new Plan rather than substituting another object.
|
|
57
|
+
Review does not authorize Apply. Preserve `GH_PLAN_REF`, its derived components and
|
|
58
|
+
the private directory between shell calls; remove only your own scratch after
|
|
59
|
+
review. Do not change the reference between review and the approved Apply.
|
package/README.md
DELETED