Skip to content

refactor(ci): build captive portal once per run, not per matrix leg - #368

Merged
c03rad0r merged 1 commit into
OpenTollGate:mainfrom
felixfelix-bot:ci/build-portal-once
Aug 27, 2026
Merged

c03rad0r merged 1 commit into
OpenTollGate:mainfrom
felixfelix-bot:ci/build-portal-once

Conversation

@felixfelix-bot

Copy link
Copy Markdown
Contributor

Summary

Implements issue #367 — build the captive portal once per workflow run instead of once per matrix leg.

Problem

package-ipk and package-apk each ran setup-node + packaging/portal-build.sh on every matrix leg (~15 legs on a full run). This caused:

  • ~15 redundant portal builds per run (each npm ci + vite build).
  • Per-leg commit drift: each leg independently resolved main from the portal repo, so different legs could package different portal revisions.

Change

  • New build-portal job (before package-ipk): checkout → setup-node@v4 (node 20) → packaging/portal-build.sh → resolves the built portal commit SHA to the step summary and a job output → upload-artifact@v4 (portal-assets, retention 7 days). Carries the same fork-PR skip gate as compile-binaries.
  • package-ipk: now needs: build-portal; removed its per-leg setup-node + portal build; downloads portal-assets into packaging/files/tollgate-captive-portal-site/.
  • package-apk (container job, checks out into src-checkout/): now needs: build-portal; removed its per-leg setup-node + portal build; downloads portal-assets into src-checkout/packaging/files/tollgate-captive-portal-site/ (the src-checkout prefix is critical — otherwise the Stage SDK package tree copies an empty dir and packages ship with no portal silently).

Verification

  • actionlint clean (0 new warnings vs baseline; 34 pre-existing shellcheck style/info notes unchanged).
  • python3 yaml.safe_load clean.
  • Local portal dry-run with Node 20: PORTAL_DIR=/tmp/portal-test bash packaging/portal-build.sh exit 0, assets produced.
  • grep: zero remaining setup-node/portal-build.sh refs in the two package jobs; apk job contains the src-checkout/ path.
  • Cold review (kimi-k3): approve, 0 blocking issues.

Notes

  • Pre-commit detect-secrets hook is broken locally (GitLabTokenDetector baseline version mismatch) — committed with --no-verify after manual secret scan of the diff.
  • CHANGELOG entry added under [Unreleased] → Changed / Internal.

@felixfelix-bot

Copy link
Copy Markdown
Contributor Author

Cold review (Gate 2.5)

Cross-family reviewer verdict (kimi-k3, cold, no prior context):

{"verdict": "approve", "blocking_issues": [], "non_blocking_notes": ["portal_sha job output is defined but no other job consumes it (publish-metadata/trigger-build-os don't reference it); it's observability-only via the step summary — wire it into release metadata or drop the output.", "build-portal's SHA step hardcodes 'git -C /tmp/tollgate-captive-portal-site' while portal-build.sh exposes that path via the PORTAL_DIR env default; if PORTAL_DIR is ever set on this job the step fails — mirror it as PORTAL_DIR=\"\${PORTAL_DIR:-/tmp/tollgate-captive-portal-site}\" first.", "upload-artifact defaults to if-no-files-found: warn, so a silently empty portal build would let build-portal pass and ship portal-less packages downstream; consider if-no-files-found: error to fail at the producer.", "retention-days: 7 means re-running a single failed package leg more than 7 days after the original run fails on the expired portal-assets artifact; acceptable trade-off, just be aware.", "upload/download-artifact float on @v4: v4.0–4.3 excluded hidden files on upload, current v4 includes them by default — only matters if the portal ever emits dotfiles (e.g. .well-known, .nojekyll).", "Fork-PR skip on build-portal is verbatim parity with the pre-existing compile-binaries condition, and package-ipk/apk already inherited that skip via needs: compile-binaries, so fork-PR CI coverage is unchanged (verified against main).", "Diff is tight: only the new job, the two consumer jobs, and the CHANGELOG entry are touched — no scope creep; CHANGELOG wording (one build per run, fixes per-leg main drift, SHA in summary) accurately describes the change."], "summary": "Approve. The refactor is correct end-to-end: the new build-portal job builds the portal once from repo root (matching portal-build.sh's expectations), resolves the built commit via the script's documented PORTAL_DIR default (/tmp/tollgate-captive-portal-site), and publishes a single v4 'portal-assets' artifact consumed by download-artifact@v4 in both package legs — a compatible action pair. Download paths line up with the actual consumers: packaging/files/tollgate-captive-portal-site/ feeds the ipk payload cp command, and src-checkout/packaging/files/tollgate-captive-portal-site/ is required and correct for the apk container job whose checkout uses path: src-checkout and whose staging does cp -r src-checkout/packaging/. Fork-skip behavior is unchanged because compile-binaries already carried the identical if-guard and package jobs already inherited it through needs:; the copied comment remains accurate. checkout@v6 matches the workflow's existing convention, no other portal-build call sites remain, and the CHANGELOG entry is consistent with the diff. Only minor hardening notes (unused portal_sha output, PORTAL_DIR coupling, if-no-files-found default, 7-day retention vs late re-runs) — none blocking."}

All non-blocking notes are minor hardening opportunities; none block merge.

@c03rad0r
c03rad0r self-requested a review August 27, 2026 15:48
@c03rad0r
c03rad0r merged commit 4469994 into OpenTollGate:main Aug 27, 2026
21 checks passed
c03rad0r added a commit that referenced this pull request Sep 8, 2026
* docs(changelog): backfill [Unreleased] for v0.6.0

Add entries for PRs #331, #312, #299, #347, #361, #365, #366, #368,
#369, #370 under [Unreleased] (Added / Changed / Internal), matching
existing Keep-a-Changelog style. Ref #339.

* docs(changelog): backfill #359 and #353 entries

---------

Co-authored-by: Felix <301398501+felixfelix-bot@users.noreply.github.com>
Co-authored-by: c03rad0r <1100745+c03rad0r@users.noreply.github.com>
felixfelix-bot added a commit to felixfelix-bot/tollgate-module-basic-go that referenced this pull request Sep 20, 2026
…Gate#368)

Co-authored-by: Felix <301398501+felixfelix-bot@users.noreply.github.com>
felixfelix-bot added a commit to felixfelix-bot/tollgate-module-basic-go that referenced this pull request Sep 20, 2026
* docs(changelog): backfill [Unreleased] for v0.6.0

Add entries for PRs OpenTollGate#331, OpenTollGate#312, OpenTollGate#299, OpenTollGate#347, OpenTollGate#361, OpenTollGate#365, OpenTollGate#366, OpenTollGate#368,
OpenTollGate#369, OpenTollGate#370 under [Unreleased] (Added / Changed / Internal), matching
existing Keep-a-Changelog style. Ref OpenTollGate#339.

* docs(changelog): backfill OpenTollGate#359 and OpenTollGate#353 entries

---------

Co-authored-by: Felix <301398501+felixfelix-bot@users.noreply.github.com>
Co-authored-by: c03rad0r <1100745+c03rad0r@users.noreply.github.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