Skip to content

Tools GH App token migration (phase 1) + per-pg build_packages filter#410

Open
ihalatci wants to merge 9 commits into
ihalatci/sign-rpm-packagesfrom
gh-app-token-phase1-tools-on-409
Open

Tools GH App token migration (phase 1) + per-pg build_packages filter#410
ihalatci wants to merge 9 commits into
ihalatci/sign-rpm-packagesfrom
gh-app-token-phase1-tools-on-409

Conversation

@ihalatci

Copy link
Copy Markdown
Contributor

Summary

Stacked validation branch for the tools side of the GH_TOKEN → GitHub App token migration, plus the per-PostgreSQL-version build_packages filter used by the packaging per-pg CI matrix. Base is #409 (ihalatci/sign-rpm-packages) so this PR shows only the incremental work on top of the RPM-signing fixes; it will retarget to develop automatically once #409 merges.

PR for review only — do not merge yet (gated).

What this stack contains (on top of #409)

  1. Phase 1 — GitHub App token in tools test workflows (commits 836fd65, b148bde): mint a GitHub App installation token and resolve the App ID via repo vars with a secrets fallback, across the tools test/CI workflows. App ID/private-key inputs are drop-in; outputs.token replaces the PAT.
  2. dev3 — Node24 action hygiene (commits a985c72, a40f783): bump actions/checkout@v5, actions/setup-python@v6, github/codeql-action@v3, create-github-app-token@v3, docker/login-action@v4 so no Node16/Node20-deprecated actions remain. Token-mint step is green on every leg.
  3. dev4 — optional postgres_version filter for build_packages (commit 7ff0365): build_packages() gains a trailing postgres_version: Optional[str] = None. For multi-image rpm platforms (el/ol/almalinux) the test can now restrict the build to a single locally-built {os}-pg{N} image instead of docker-pulling every sibling version from the registry. The single-image (deb/ubuntu/pgxn → ["all"]) path is unchanged; default None preserves the all-versions behavior for nightlies and the CLI.
  4. dev5 — test-harness fixes for the filter (commit ba5fcef): in test_build_packages, (A) gracefully pytest.skip when POSTGRES_VERSION is outside the platform's release set (the image is still built by update_image, so downstream push_images reseeds it), and (B) assert the filtered per-version package count when a single version is selected, full count otherwise.
  5. Comment reword (commit 03d88c0): clarify the two inline comments in test_build_packages to describe the change itself (non-behavioral).

Validation

Backward compatibility

deb/ubuntu/pgxn legs run with empty POSTGRES_VERSIONNone → no skip, full-count assertion, ["all"] iterator unchanged. The CLI and nightlies pass nothing and are unaffected.

citus-bot and others added 8 commits June 17, 2026 12:44
Replace the org PAT (secrets.GH_TOKEN) with a per-job GitHub App
installation token in the five tools test workflows:
tool-tests, packaging-methods-tests, statistic-tests,
statistic-schedule, citus-package-all-platforms-test.

Each consuming job now mints a token via
actions/create-github-app-token@v2 (app-id/private-key from the
existing GH_APP_ID/GH_APP_KEY org secrets, owner: citusdata) and
exports it to \ as GH_TOKEN (plus GITHUB_TOKEN for the
all-platforms test). The top-level env GH_TOKEN entries are removed,
since top-level/job env cannot reference the steps context.

No script or tools-package changes: an installation token is a
drop-in for the PAT. secrets.GH_TOKEN remains defined org-wide for
zero-downtime during the staged migration.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
The mint step failed with '[@octokit/auth-app] appId option is required'
because GH_APP_ID resolved empty as a secret reference. GH_APP_ID is an
org variable (App IDs are non-sensitive); GH_APP_KEY remains a secret.
Use \�ars.GH_APP_ID || secrets.GH_APP_ID\ so the workflow works whether
the App ID is stored as a variable or a secret.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Combines #409 (cc94f1c: pre-existing test fixes) with #407 (gh-app-token-phase1-tools @ b148bde: GH App token swap across the 5 test workflows). Disjoint file sets; clean merge. For cutting validation tag v0.8.36-dev3 only; #407 not merged to develop.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Fold Node20 deprecation bumps on top of the #407 GH App token swap for the
v0.8.36-dev3 validation stack:
- actions/checkout@v3 -> @v5 (all 16 occurrences; @v4 is still node20)
- actions/setup-python@v5 -> @v6 (tool-tests.yml)
- github/codeql-action/{init,autobuild,analyze}@v2 -> @V3
- docker/login-action@v2 -> @V3

actions/create-github-app-token@v2 left intact (current; introduced by #407).
No GH_TOKEN refs removed. Workflow logic otherwise unchanged.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Clear the new GitHub node20->node24 deprecation (2025-09-19) at the source so
consumer repos (packaging, docker) copy the future-proof node24 recipe in one pass:
- actions/create-github-app-token@v2 -> @V3 (node24; inputs app-id/private-key/owner
  and outputs.token identical to v2 -> drop-in) across the 5 migrated workflows.
- docker/login-action@v3 -> @v4 (node24) in build-citus-community-nightlies.yml.

Migration mechanics unchanged; no GH_TOKEN refs removed (Phase 6).

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
The rpm build test (test_build_packages) iterates ALL release postgres
versions for multiple-image platforms (el/ol/almalinux) and docker-runs
each {os}-pg{N} image. In packaging's per-pg CI matrix only the leg's own
pg image is built locally, so the test docker-pulls the OTHER versions
from the registry. Those pulled images can be stale, which surfaces as
spurious failures unrelated to the leg under test.

Add an optional trailing `postgres_version: Optional[str] = None` param to
build_packages(). When set and non-empty, the rpm (multiple-image) branch
restricts the iterator to that single version, raising ValueError if it is
not in the platform's release/nightly versions. The single-image
(deb/ubuntu/pgxn -> ["all"]) branch is unchanged. Default None preserves
the existing all-versions behavior, so the __main__ CLI (nightlies) is
unaffected.

test_citus_package.py reads POSTGRES_VERSION from the environment and
passes it through; empty/None keeps current behavior.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…ERSION filter

dev4 added an optional POSTGRES_VERSION filter to build_packages so the rpm
build test stops docker-running (and stale-pulling) every release pg version.
Running it in packaging's per-pg CI matrix surfaced two test-harness bugs that
are independent of the token migration and of R1:

Fix A (graceful skip for out-of-set versions): the packaging matrix enumerates
pg{14..18} per rpm distro to drive update_image into building every {os}-pg{N}
base image, but tools' rpm release set is a subset (e.g. 15,16,17). For a leg
whose POSTGRES_VERSION is outside that set there is nothing to build/sign, so
skip gracefully (skip == success) instead of letting build_packages raise. The
{os}-pg{N} image was still built by update_image, so push_images still reseeds
it.

Fix B (filtered-count assertion): when POSTGRES_VERSION restricts the build to a
single in-set version, only that version's packages are produced, so the
expected count is the per-version count (single_postgres_package_counts), not
len(release_versions) * per-version. When POSTGRES_VERSION is empty/None
(nightlies/CLI/deb/pgxn) the original all-versions assertion is preserved.

Test-only change; citus_package.py and the #409 signing regression guard are
untouched. get_required_package_count and test_get_required_package_count remain
unchanged (still exercise the unfiltered full-count path).

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Non-behavioral comment reword in test_build_packages: drop session-specific
phrasing so the inline comments describe only the change itself (the
POSTGRES_VERSION single-version filter skip + filtered-count assertion). No code
change.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
GH_APP_ID is an organization variable, so the secrets fallback is
unnecessary. Simplify the create-github-app-token app-id input to
${{ vars.GH_APP_ID }} in all 5 tools workflows. private-key remains a
secret (secrets.GH_APP_KEY), unchanged.

Co-authored-by: Copilot <223556219+Copilot@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.

3 participants