Skip to content

feat(aws-test-infra): add s3-stage, s3-download, s3-cleanup subcommands#175

Open
anvesh-loft wants to merge 1 commit into
mainfrom
engqa-1271-s3
Open

feat(aws-test-infra): add s3-stage, s3-download, s3-cleanup subcommands#175
anvesh-loft wants to merge 1 commit into
mainfrom
engqa-1271-s3

Conversation

@anvesh-loft

@anvesh-loft anvesh-loft commented Jul 13, 2026

Copy link
Copy Markdown

What

Adds the S3 half of the AWS test-infra lifecycle to the aws-test-infra Go binary: three new subcommands so callers can drop the duplicated S3 bucket-setup + presigned-URL bash currently inlined in the vcluster-pro conformance workflows.

Additive and backward-compatibleprovision and cleanup are untouched (same flags, logic, outputs). Existing consumers (selinux, prerelease, conformance) are unaffected.

New subcommands

Command Purpose
s3-stage Ensure + tag a run-scoped bucket, upload files, emit presigned URLs as a JSON map (bucket, presigned-urls outputs)
s3-download Pull an object to a local path; a missing object is a no-op (not an error)
s3-cleanup Empty + delete a bucket with a tag-based sweep fallback, mirroring the EC2 cleanup design (best-effort by default, -strict to fail loudly)

Both GET and PUT presigned URLs are generated natively via aws-sdk-go-v2, which lets the caller drop the inline boto3 shim the workflows used for PUT URLs (aws-cli v2 presign is GET-only).

Design notes

  • Follows the existing action patterns: narrow S3API / S3Presigner interfaces (like EC2API), one runXxx per subcommand with its own flag.FlagSet, and the instance-id-by-role-style JSON-map output for presigned URLs.
  • s3-stage reads uploads / presign as newline lists (same shape as ingress-rules).
  • Bucket name defaults to the lowercased run-id; us-east-1 correctly omits LocationConstraint.

Testing

  • make test-aws-test-infra (go test -race) — new fake-S3 + fake-presigner suite (16 cases: bucket ensure/create/tag, us-east-1 constraint, stage upload+presign, download no-op-when-missing + writes-file, direct + tag-sweep cleanup, output emission) plus all pre-existing provision/cleanup tests still green.
  • make check-docs clean (auto-doc tables regenerated).
  • shellcheck clean on the composite run block; YAML validated.

Rollout

  • Refs ENGQA-1271. A follow-up PR in vcluster-pro migrates the conformance workflow's two staging steps (+ optionally the results download and S3 teardown) onto these subcommands and deletes the duplicated bash.
  • The SDK-generated PUT presign will be validated end-to-end by that conformance workflow's dispatch run (EC2 uploads results via curl -X PUT).

Comment thread .github/actions/aws-test-infra/src/s3.go Outdated
Comment thread .github/actions/aws-test-infra/src/s3.go Outdated
Comment thread .github/actions/aws-test-infra/src/s3.go
Comment thread .github/actions/aws-test-infra/src/s3.go
Comment thread .github/actions/aws-test-infra/src/s3.go
Comment thread .github/actions/aws-test-infra/src/s3.go
Comment thread .github/actions/aws-test-infra/src/s3.go
Comment thread .github/actions/aws-test-infra/action.yml Outdated
@anvesh-loft
anvesh-loft requested a review from loft-bot July 13, 2026 20:44
Comment thread .github/actions/aws-test-infra/src/s3_test.go Outdated
Comment thread .github/actions/aws-test-infra/src/s3.go Outdated
Comment thread .github/actions/aws-test-infra/src/s3.go
Comment thread .github/actions/aws-test-infra/src/s3.go
Comment thread .github/actions/aws-test-infra/action.yml
Comment thread .github/actions/aws-test-infra/src/s3.go Outdated
Add the S3 half of the AWS test-infra lifecycle to the shared Go binary so the
vcluster-pro conformance workflows can drop their duplicated S3 bucket-setup +
presigned-URL bash (including the boto3 PUT-presign shim). Additive: provision
and cleanup are unchanged.

Subcommands:
- s3-stage: ensure+tag a run-scoped bucket, upload files, emit presigned URLs as
  a JSON map (bucket, presigned-urls outputs). GET and PUT URLs are signed
  natively via aws-sdk-go-v2 (no boto3). URLs are registered with ::add-mask::,
  and the step warns if -expires-in outlives the STS session.
- s3-download: fetch an object to a local path; a missing object is a no-op and
  a failed copy does not leave a truncated file behind.
- s3-cleanup: empty+delete a bucket with a region-scoped, paginated, tag-based
  sweep fallback; best-effort by default, -strict to fail loudly.

The s3-stage upload/presign list parsing lives in src/parse-list.sh (CRLF-safe)
with a bats suite, wired into the Makefile and the test workflow. Go unit tests
use fake S3 + presigner clients and cover bucket create/idempotency, tagging,
region+pagination sweeps, DeleteObjects batching past 1000 keys, output formats
+ URL masking, and the download error paths.

Closes ENGQA-1271

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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.

2 participants