Skip to content

JGC-499 - Replace 'safe to test' label with single build-gate environment approval#3535

Open
ehl-jf wants to merge 1 commit into
masterfrom
JGC-499-build-gate
Open

JGC-499 - Replace 'safe to test' label with single build-gate environment approval#3535
ehl-jf wants to merge 1 commit into
masterfrom
JGC-499-build-gate

Conversation

@ehl-jf

@ehl-jf ehl-jf commented Jun 4, 2026

Copy link
Copy Markdown
Contributor

Summary

Replaces the per-workflow safe to test label gate with a single build-gate GitHub Environment deployment approval. A maintainer approves once per fork/PR run, and that single approval releases frogbot and all integration-test suites. Trusted push to master and manual workflow_dispatch runs skip the approval entirely.

What changed

  • New build-gate.yml orchestrator (name: Build Gate)
    • Triggers: pull_request_target [opened, synchronize, reopened], push to master, workflow_dispatch.
    • A single gate job carries environment: ${{ github.event_name == 'pull_request_target' && 'build-gate' || '' }} — only fork/PR runs hit the environment and wait for approval; push/workflow_dispatch resolve to an empty environment (no gate).
    • 26 suite jobs (frogbot + go + 24 others), each needs: gate + uses: ./.github/workflows/<suite>.yml + secrets: inherit.
    • A build-gate-success aggregator job (needs: all suites, if: always()) that fails if any suite failed/was cancelled — see required-checks note below.
  • 26 workflows converted to reusable (frogbot-scan-pull-request.yml + 25 *Tests.yml)
    • on:workflow_call: + workflow_dispatch: (dropped push and pull_request_target: [labeled]).
    • Removed the safe to test job conditions. workflow_dispatch inputs preserved (incl. poetry's poetry_version); env:/permissions: blocks intact.
    • frogbot no longer declares its own environment: frogbot — the gate now lives in the orchestrator.
    • evidenceTests and ghostFrogTests keep their existing if: false (independently disabled).
  • Deleted removeLabel.yml — the label mechanism it served is gone.

Security model

  • Approval happens in gate, before any job checks out PR head code or touches secrets.
  • Under pull_request_target, local uses: reusable workflows resolve from the base ref, so a PR cannot alter the gate or workflow logic — only the executed test/product code, which is exactly what the approval covers.

Recovering a failed run

Use "Re-run failed jobs": it re-runs the failed suite(s) and build-gate-success (reusing already-passed suites) while not re-running gate, so no re-approval and no new commit are needed — the single required check flips green on the same SHA. ("Re-run all jobs" re-runs gate and re-triggers approval.)

⚠️ Manual repo-settings changes required (not in this PR)

  1. Create the build-gate Environment (Settings → Environments) with Required reviewers = the maintainer team.

  2. Verify frogbot secrets are repo/org-level, not scoped to the old frogbot environment. frogbot no longer declares an environment and receives secrets via secrets: inherit (which passes repo/org secrets, not environment secrets). If FROGBOT_URL, FROGBOT_ACCESS_TOKEN, JF_SMTP_* were stored as frogbot-environment secrets, move them to repo/org level (or onto build-gate).

  3. Repoint branch-protection required status checks to the single aggregator:

    • Build Gate / build-gate-success

    Remove the stale old per-workflow contexts. The aggregator is the only check that needs to be required — it transitively gates every suite, is matrix-independent (won't break when a suite's matrix changes), and stays pending until the approval gate is released.

  4. (Optional cleanup) Delete the safe to test label and retire the now-unused frogbot environment.

…ment approval

Introduce build-gate.yml orchestrator: a single `build-gate` environment
deployment approval (skipped on push/dispatch) releases frogbot and all
integration-test suites for fork/PR runs. Convert frogbot and the 25 test
workflows to reusable (workflow_call) workflows invoked behind the gate,
drop the per-workflow 'safe to test' label conditions, and delete
removeLabel.yml.

Add a build-gate-success aggregator job that needs all suites, so branch
protection can require a single stable check instead of matrix-expanded
suite contexts.
@ehl-jf ehl-jf added the ignore for release Automatically generated release notes label Jun 4, 2026

@barakharyati barakharyati left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

.

@barakharyati barakharyati left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good 2 issues 1 security related and the second looks like a bug.

# "Build Gate / build-gate-success" instead of the matrix-expanded suite checks.
# Recover a failed suite with "Re-run failed jobs" (re-runs the suite + this job,
# not the approval gate) — no re-approval and no new commit needed.
build-gate-success:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we add gate also here?

# not the approval gate) — no re-approval and no new commit needed.
build-gate-success:
name: build-gate-success
if: always()

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The if: always () cusing an issue here
build-gate-success doesn’t directly depend on gate, only on jobs after it. If gate is rejected, those jobs may be skipped, and the final check can still pass because it allows skipped jobs.

cancel-in-progress: true

permissions:
pull-requests: write

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like there is a bug here (not security)
I remember that the caller workflow cannot assign permissions it doesn't have
In that case, the caller does not have id-token: write, and it assigns it to a different workflow like .github/workflows/helmTests.yml by triggrering it

https://github.com/jfrog/jfrog-cli/pull/3535/changes#diff-b4f30d948e9602b6e03aa68700eb3589067e5fabe411faa596842e3bcf0de387R22 row 22

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ignore for release Automatically generated release notes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants