Skip to content

Add examples/setup-aws.sh: one-command AWS provisioning#3

Merged
snopoke merged 16 commits intomainfrom
feature/setup-aws-script
Apr 27, 2026
Merged

Add examples/setup-aws.sh: one-command AWS provisioning#3
snopoke merged 16 commits intomainfrom
feature/setup-aws-script

Conversation

@snopoke
Copy link
Copy Markdown
Contributor

@snopoke snopoke commented Apr 27, 2026

Summary

  • New examples/setup-aws.sh: idempotent, OIDC-only bash script that provisions every AWS resource the dora GitHub Actions S3 variant needs in one command — IAM OIDC provider, S3 bucket (+ Block Public Access, CORS, public-read bucket policy on dora-report.json only), and an IAM role with a repo-scoped trust policy plus inline policy granting s3:GetObject/s3:PutObject on exactly two keys (dora.db, dora-report.json).
  • --existing-bucket NAME skips bucket creation/CORS/policy and only configures IAM, for teams reusing a shared bucket.
  • --branch NAME (optional, no default) locks the trust policy to a specific ref. Re-running with a new --branch updates the trust policy in place.
  • examples/workflows/dora-report.yml and README.md § S3 variant now point at the script. Drops the now-redundant --public-read flag from the documented dora upload line — the bucket policy supersedes the per-object ACL.
  • 27 pytest cases via a stubbed aws CLI on PATH (NUL-delimited argv log, robust to multiline JSON heredocs). shellcheck clean.

Spec: docs/superpowers/specs/2026-04-27-aws-setup-script-design.md. Plan: docs/superpowers/plans/2026-04-27-aws-setup-script.md. Manual smoke-test checklist: docs/superpowers/plans/2026-04-27-aws-setup-script-smoke-test.md.

Test plan

  • `uv run pytest` — 94/94 passes (27 new in tests/test_setup_aws.py + existing).
  • `uvx --from shellcheck-py shellcheck examples/setup-aws.sh` — silent (clean).
  • `bash examples/setup-aws.sh --help` shows full flag list including the re-run-with-new-branch hint.
  • Reviewer: walk the smoke-test checklist against a real AWS test account: fresh setup → re-run idempotency → branch update → `--existing-bucket` mode → bucket-name-collision (403) → cleanup. Unit tests stub `aws`; the smoke test exercises the actual API contract.

🤖 Generated with Claude Code

snopoke and others added 16 commits April 27, 2026 14:52
12 TDD-paced tasks: scaffold + arg parsing + preflight, then one task
per AWS resource (OIDC provider, bucket, CORS, bucket policy, IAM role,
inline policy), then summary output, doc updates, and a manual smoke
test checklist. Tests stub the aws CLI on PATH and assert on recorded
argv.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Code-review feedback: imports go at module level alongside other imports,
not appended below the first test function.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
- Add `# --- 3. Bucket CORS ---` and `# --- 4. Bucket policy ---` section
  headers so readers don't see a confusing 2 → 5 jump in the section
  numbering.
- Drop the dead `oidc_provider_arn` variable; the trust policy uses the
  deterministic ARN format directly. Comment explains why.
- Mention re-running with a different --branch in --help (per spec's
  "trust policy too narrow" mitigation).
- Fix smoke-test step 2 expected-substring to match the actual stderr
  emitted by the role-update path.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@snopoke snopoke merged commit 3953158 into main Apr 27, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant