Skip to content

feat(prerelease-setup): add composite action for pre-release workflow setup#148

Open
sowmyav27 wants to merge 5 commits into
loft-sh:mainfrom
sowmyav27:engqa-1042
Open

feat(prerelease-setup): add composite action for pre-release workflow setup#148
sowmyav27 wants to merge 5 commits into
loft-sh:mainfrom
sowmyav27:engqa-1042

Conversation

@sowmyav27
Copy link
Copy Markdown
Contributor

Summary

Adds .github/actions/prerelease-setup/ — a composite action that consolidates the duplicated setup block at the top of the two jobs in loft-sh/loft-enterprise .github/workflows/prerelease-checks.yaml (prerelease-vcluster and prerelease-aicloud). The two jobs share ~100 lines of identical setup that only differ in role-session-name.

The action performs:

  1. Free disk space (jlumbroso/free-disk-space@v1.3.1)
  2. Checkout (actions/checkout@v6)
  3. Setup Go (actions/setup-go@v5, go-version-file: go.mod, cache on)
  4. Setup kubectl (azure/setup-kubectl@v4)
  5. Setup helm (azure/setup-helm@v4)
  6. AWS Login via OIDC (aws-actions/configure-aws-credentials@v5.1.1 against arn:aws:iam::084374023943:role/e2e-test-executor, us-west-2, 6300s)
  7. Resolve and validate the four version inputs (set -euo pipefail + semver regex + curl/jq "latest release" / "latest pre-release" fallbacks, identical to the inlined version)
  8. Download the vcluster CLI matching the resolved base standalone version
  9. Verify kubectl, helm, vcluster on $PATH

Resolved versions are written to $GITHUB_OUTPUT and mirrored to $GITHUB_ENV so the consumer's downstream run-ginkgo step keeps reading them as env vars exactly as in the inlined version — this preserves the acceptance criterion that PR 6937's two jobs run identically before and after extraction.

Mirrors the convention from #139 (aws-test-infra).

Inputs / outputs

Documented in README.md. Summary:

  • Inputs: role-session-name (req), standalone-vcluster-version, standalone-vcluster-upgrade-version (req), platform-base-version, platform-rc-version, vci-k8s-version, vci-k8s-upgrade-version.
  • Outputs (post-resolve, no leading v): standalone-vcluster-version, standalone-vcluster-upgrade-version, platform-base-version, platform-rc-version.

Out of scope

  • EC2 provisioning (already in aws-test-infra@aws-test-infra/v1, AI Cloud–only)
  • Ginkgo execution (already in run-ginkgo@run-ginkgo/v1, different test dirs per job)
  • The loft-enterprise consumer PR — tracked separately under ENGQA-1042 Step 2; it will reference this action via the prerelease-setup/v1 tag after merge.

Test plan

  • CI on this PR passes
  • Tag prerelease-setup/v1 after merge
  • Open the loft-enterprise consumer PR (Step 2) referencing @prerelease-setup/v1; verify both prerelease-vcluster and prerelease-aicloud jobs run identically before/after (CI run time and artifact contents unchanged)

References

… setup

Extracts ~100 lines of duplicated setup steps from
loft-sh/loft-enterprise .github/workflows/prerelease-checks.yaml
(prerelease-vcluster + prerelease-aicloud jobs) into a single composite
action.

The action performs: free disk space, checkout, setup-go (cache on,
go-version-file: go.mod), setup-kubectl, setup-helm, OIDC AWS Login
(role-session-name is the only AWS input that differs between the two
jobs), resolve+validate the standalone vCluster base/upgrade and platform
base/RC versions (with curl/jq fallbacks to "latest release" /
"latest pre-release"), download the vCluster CLI matching the resolved
base, and verify kubectl/helm/vcluster are on PATH.

Resolved versions are written to GITHUB_OUTPUT and mirrored to GITHUB_ENV
so the consumer's downstream test step (run-ginkgo) keeps reading them as
env vars exactly as in the inlined version.

The action does NOT include EC2 provisioning (aws-test-infra) or test
execution (run-ginkgo) — those remain inline in the consumer because only
the AI Cloud job needs EC2 and both jobs run different test directories.

Mirrors the convention from PR loft-sh#139 (aws-test-infra).

Refs ENGQA-1042.
sowmyav27 added 3 commits May 24, 2026 15:15
…ers; drop vci-k8s inputs

Two CI fixes plus a scope tightening:

- zizmor (github-env): the previous revision mirrored resolved versions to
  GITHUB_ENV so the consumer's downstream test step could read them as
  env vars. zizmor flagged this as a code-execution risk and the repo
  convention (aws-test-infra) writes only to GITHUB_OUTPUT. The consumer
  now wires outputs to env via the run-ginkgo step's env: block (shown in
  README Usage).

- check-docs: README must use the AUTO-DOC-INPUT / AUTO-DOC-OUTPUT
  markers consumed by tj-actions/auto-doc; hand-written tables removed
  and the markers populated via `make generate-docs`.

- vci-k8s-version / vci-k8s-upgrade-version inputs dropped. They are not
  produced or validated by any setup step and are already available to
  the consumer at the workflow env: block; carrying them as
  pass-through-only inputs would be dead code. README "Notes" calls
  this deviation from the original ticket scope out explicitly.
Comment thread .github/actions/prerelease-setup/action.yml Outdated
Comment thread .github/actions/prerelease-setup/action.yml Outdated
Comment thread .github/actions/prerelease-setup/action.yml
Comment thread .github/actions/prerelease-setup/action.yml Outdated
Comment thread .github/actions/prerelease-setup/action.yml
Comment thread .github/actions/prerelease-setup/action.yml Outdated
…anup

- Add required github-token input. The platform release resolvers call the
  GitHub API for loft-sh/loft-enterprise, which is private — unauthenticated
  calls return 404. Pass ${{ github.token }} from a caller whose job
  permissions include contents:read.
- Authenticate the vcluster (public) /releases/latest call too. The GH API
  rate-limits unauthenticated calls to 60/hr per runner IP; auth bumps it to
  1000/hr per token and removes the intermittent 403 mode on shared runners.
- Drop output-credentials: true. configure-aws-credentials exports AWS_*
  env vars by default; the flag only adds step outputs, which no downstream
  step reads.
- Bump major versions on third-party actions:
    actions/setup-go              v5     -> v6.4.0
    azure/setup-kubectl           v4     -> v5.1.0
    azure/setup-helm              v4     -> v5.0.0
    aws-actions/configure-aws-credentials v5.1.1 -> v6.1.3
  All four bumps share the same breaking change (node24 runtime, requires
  runner v2.327.1+) which GitHub-hosted ubuntu-latest already satisfies.
- Regenerate README via make generate-docs.
@sowmyav27
Copy link
Copy Markdown
Contributor Author

Thanks for the review @sydorovdmytro — pushed 280bcb0 addressing the four blocking / non-nit comments. Replies inline by line:

Line 104 (private-repo auth) + Line 90 (rate limit) — fixed. Added a required github-token input and pass Authorization: Bearer $GH_TOKEN on both API calls. Confirmed loft-sh/loft-enterprise is private (returns 404 unauthenticated); already hit this on the consumer side in the inline workflow, so the composite needed the same treatment. Authenticating the public vcluster call too — same shared-IP / 60-per-hour rate-limit reason you flagged.

Line 72 (output-credentials: true) — dropped. You're right, configure-aws-credentials exports AWS_* env vars by default; the flag only added step outputs that no downstream step reads. Removed both the YAML line and the corresponding README paragraph.

Line 55 (outdated action versions) — bumped:

  • actions/setup-go v5 → v6.4.0
  • azure/setup-kubectl v4 → v5.1.0
  • azure/setup-helm v4 → v5.0.0
  • aws-actions/configure-aws-credentials v5.1.1 → v6.1.3

All four share the same breaking change (node24 runtime, requires runner ≥v2.327.1) which GitHub-hosted ubuntu-latest already satisfies. Kept checkout@v6.0.2 and free-disk-space@v1.3.1 as both are at their latest major.

Line 83 (Bats extraction) and Line 42 (free-disk-space → caller) — deferring. Bats refactor is scope creep for this PR; happy to follow up in a separate one if you'd like. Leaving free-disk-space in the action for now since both current consumers need it and pulling it out duplicates 5 lines per caller — open to revisiting if more callers appear that don't need it.

@sowmyav27 sowmyav27 requested a review from sydorovdmytro June 2, 2026 00:11
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