ci(bazel): move package-mcp/package-npm gates into bazel.yml (F3)
Package gates now build bd via Bazel (no --config=ci) when the rbe job enables it and fall back to go build otherwise, so forks/Dependabot/rbe-off runs are unaffected. pr.yml's CI Gate keeps PACKAGE_MCP/PACKAGE_NPM required and never-skippable, now sourced from needs.bazel.outputs.*; the retired detect-package-gates/package-mcp/package-npm pr.yml jobs and DETECT_PACKAGE_GATES are deleted. MCP pytest pins -n 8 explicitly with pytest-xdist locked via uv lock. rbe, bazel-coverage, and both required gate jobs move to Blacksmith for same-repo PRs (gate names unchanged). Also closes a gap in detect-package-gates.sh (missing bazel.yml in the force-both-gates path list, since the job definitions moved there) and wires integrations/beads-mcp's manifest/lock into scripts_test's Bazel data so the new pytest-xdist pin check runs under `bazel test` too. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
parent
e2b78f7d7a
commit
65f378d241
15 changed files with 737 additions and 265 deletions
243
.github/workflows/bazel.yml
vendored
243
.github/workflows/bazel.yml
vendored
|
|
@ -187,6 +187,19 @@ on:
|
|||
type: string
|
||||
required: false
|
||||
default: "off"
|
||||
# "on" (pr.yml only) runs package-mcp and package-npm in this call,
|
||||
# which waits on nothing but the rbe job (F3: the legacy pr.yml jobs
|
||||
# those gates used to need: detect-package-gates, build-artifacts,
|
||||
# bazel-coverage, and the whole bazel call). bazel-farm.yml, nightly.yml
|
||||
# and direct runs (push, dispatch) keep the default "off": main.yml
|
||||
# keeps its own package jobs, and a fork-farm run has no bd artifact
|
||||
# consumer waiting on these.
|
||||
package-gates:
|
||||
description: >
|
||||
"on" (pr.yml only) runs the MCP and npm package gates in this call.
|
||||
type: string
|
||||
required: false
|
||||
default: "off"
|
||||
# Only what the rbe job and setup-bazel need; callers pass them
|
||||
# explicitly. None is required: fork and Dependabot runs have none.
|
||||
secrets:
|
||||
|
|
@ -229,6 +242,12 @@ on:
|
|||
bazel-server-storage:
|
||||
description: "bazel-server-storage's job.status"
|
||||
value: ${{ jobs.bazel-server-storage.outputs.result }}
|
||||
package-mcp:
|
||||
description: "package-mcp's job.status (empty unless package-gates is 'on')"
|
||||
value: ${{ jobs.package-mcp.outputs.result }}
|
||||
package-npm:
|
||||
description: "package-npm's job.status (empty unless package-gates is 'on')"
|
||||
value: ${{ jobs.package-npm.outputs.result }}
|
||||
|
||||
# Main runs always finish (they may save the runner cache); PR runs (called
|
||||
# from pr.yml or bazel-farm.yml, whose own groups cancel the calling run too)
|
||||
|
|
@ -255,7 +274,12 @@ jobs:
|
|||
# runs read vars but get no secrets, so they come out cache, not remote.
|
||||
rbe:
|
||||
name: execution mode
|
||||
runs-on: ubuntu-latest
|
||||
# Same-repo PRs (and merge_group/push/dispatch/schedule runs, which are
|
||||
# never forks) get the org's Blacksmith pool; a pull_request_target farm
|
||||
# run and any fork or Dependabot PR stay on GitHub-hosted runners. This
|
||||
# job reads no repository code and holds no secret value (see below), so
|
||||
# Blacksmith sees nothing sensitive either way.
|
||||
runs-on: ${{ (github.event_name == 'push' || github.event_name == 'workflow_dispatch' || github.event_name == 'schedule' || github.event_name == 'merge_group' || (github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository && github.actor != 'dependabot[bot]')) && 'blacksmith-2vcpu-ubuntu-2404' || 'ubuntu-latest' }}
|
||||
timeout-minutes: 5
|
||||
outputs:
|
||||
enabled: ${{ steps.decide.outputs.enabled }}
|
||||
|
|
@ -1214,3 +1238,220 @@ jobs:
|
|||
env:
|
||||
JOB_STATUS: ${{ job.status }}
|
||||
run: echo "result=$JOB_STATUS" >> "$GITHUB_OUTPUT"
|
||||
|
||||
# F3: moved here from pr.yml so the gate depends on nothing but the rbe
|
||||
# job's decision (not detect-package-gates, build-artifacts, bazel-coverage
|
||||
# or the whole bazel call). Only pr.yml opts in (package-gates: "on");
|
||||
# bazel-farm.yml and nightly.yml keep the default "off" and this job does
|
||||
# not run for them. Same-repo PRs get a Bazel-built bd (no --config=ci:
|
||||
# only test:ci is defined in .bazelrc, so bazel build //cmd/bd:bd_for_tests
|
||||
# is run directly); forks, Dependabot and rbe-off/skip runs fall back to
|
||||
# `go build`, same as package-mcp.sh's own prepare_bd_binary() does when
|
||||
# BEADS_TEST_BD_BINARY is unset.
|
||||
package-mcp:
|
||||
name: Package Gate (MCP)
|
||||
needs: rbe
|
||||
# 4 vCPU on purpose: pytest-xdist -n 8 measured ~2.7-3x on 4 CPUs
|
||||
# (tools/f3 timing, 2026-10), well past 2 vCPU's ceiling.
|
||||
runs-on: ${{ needs.rbe.outputs.enabled == 'true' && 'blacksmith-4vcpu-ubuntu-2404' || 'ubuntu-latest' }}
|
||||
if: ${{ inputs.package-gates == 'on' }}
|
||||
timeout-minutes: 30
|
||||
outputs:
|
||||
result: ${{ steps.result.outputs.result }}
|
||||
steps:
|
||||
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
||||
with:
|
||||
ref: ${{ inputs.checkout-sha }}
|
||||
fetch-depth: 0
|
||||
persist-credentials: false
|
||||
allow-unsafe-pr-checkout: ${{ inputs.fork-farm == 'authorized' && github.event_name == 'pull_request_target' }}
|
||||
|
||||
- name: Decide applicability
|
||||
id: detect
|
||||
env:
|
||||
PR_BASE_SHA: ${{ github.event.pull_request.base.sha }}
|
||||
PR_HEAD_SHA: ${{ github.event.pull_request.head.sha }}
|
||||
PUSH_BEFORE_SHA: ${{ github.event.before }}
|
||||
PUSH_AFTER_SHA: ${{ github.sha }}
|
||||
run: ./scripts/ci/detect-package-gates.sh
|
||||
|
||||
- name: Set up Bazel
|
||||
id: bazel
|
||||
if: ${{ steps.detect.outputs.mcp_package == 'true' && needs.rbe.outputs.enabled == 'true' }}
|
||||
uses: ./.github/actions/setup-bazel
|
||||
env:
|
||||
BAZEL_REMOTE_EXECUTOR: ${{ needs.rbe.outputs.enabled == 'true' && secrets.RBE_WEST_EXECUTOR || '' }}
|
||||
RBE_TLS_CERT: ${{ needs.rbe.outputs.enabled == 'true' && secrets.RBE_TLS_CERT || '' }}
|
||||
RBE_TLS_KEY: ${{ needs.rbe.outputs.enabled == 'true' && secrets.RBE_TLS_KEY || '' }}
|
||||
RBE_TLS_CA: ${{ needs.rbe.outputs.enabled == 'true' && secrets.RBE_TLS_CA || '' }}
|
||||
RBE_INSTANCE: ${{ needs.rbe.outputs.enabled == 'true' && 'oss' || '' }}
|
||||
BAZEL_FORK_CACHE: ${{ needs.rbe.outputs.mode == 'cache' && 'true' || '' }}
|
||||
|
||||
# No --config=ci: only test:ci is defined in .bazelrc, and `bazel
|
||||
# build --config=foo` fails when only test:foo exists.
|
||||
- name: bazel build //cmd/bd:bd_for_tests
|
||||
if: ${{ steps.detect.outputs.mcp_package == 'true' && needs.rbe.outputs.enabled == 'true' }}
|
||||
run: bazel build //cmd/bd:bd_for_tests --remote_download_regex='.*/bin/cmd/bd/bd_for_tests/bd$'
|
||||
|
||||
- name: Package the Bazel-built bd
|
||||
if: ${{ steps.detect.outputs.mcp_package == 'true' && needs.rbe.outputs.enabled == 'true' }}
|
||||
run: |
|
||||
./scripts/ci/package-bazel-bd.sh "$RUNNER_TEMP/bd-artifacts"
|
||||
echo "BEADS_TEST_BD_BINARY=$RUNNER_TEMP/bd-artifacts/bd-linux-gms-pure" >> "$GITHUB_ENV"
|
||||
|
||||
- name: Set up Go
|
||||
id: setup-go
|
||||
if: ${{ steps.detect.outputs.mcp_package == 'true' && needs.rbe.outputs.enabled != 'true' }}
|
||||
uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0
|
||||
with:
|
||||
go-version-file: 'go.mod'
|
||||
cache: false
|
||||
|
||||
- name: Restore Go module cache
|
||||
if: ${{ steps.detect.outputs.mcp_package == 'true' && needs.rbe.outputs.enabled != 'true' }}
|
||||
uses: actions/cache/restore@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
|
||||
with:
|
||||
path: ~/go/pkg/mod
|
||||
key: beads-go-mod-v2-${{ runner.os }}-${{ runner.arch }}-go-${{ steps.setup-go.outputs.go-version }}-${{ hashFiles('go.mod', 'go.sum') }}
|
||||
restore-keys: beads-go-mod-v2-${{ runner.os }}-${{ runner.arch }}-go-${{ steps.setup-go.outputs.go-version }}-
|
||||
|
||||
- name: Verify Go modules
|
||||
if: ${{ steps.detect.outputs.mcp_package == 'true' && needs.rbe.outputs.enabled != 'true' }}
|
||||
run: go mod verify
|
||||
|
||||
- name: Restore non-race Go build cache
|
||||
if: ${{ steps.detect.outputs.mcp_package == 'true' && needs.rbe.outputs.enabled != 'true' }}
|
||||
uses: actions/cache/restore@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
|
||||
with:
|
||||
path: ${{ runner.temp }}/go-cache/non-race
|
||||
key: beads-go-build-v2-${{ runner.os }}-${{ runner.arch }}-go-${{ steps.setup-go.outputs.go-version }}-base-gms_pure_go-non-race-${{ github.sha }}
|
||||
restore-keys: beads-go-build-v2-${{ runner.os }}-${{ runner.arch }}-go-${{ steps.setup-go.outputs.go-version }}-base-gms_pure_go-non-race-
|
||||
|
||||
- name: Set up Python
|
||||
if: ${{ steps.detect.outputs.mcp_package == 'true' }}
|
||||
uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
|
||||
with:
|
||||
python-version: '3.14'
|
||||
|
||||
- name: Install uv
|
||||
if: ${{ steps.detect.outputs.mcp_package == 'true' }}
|
||||
run: python -m pip install uv==0.11.16
|
||||
|
||||
- name: Run MCP package gate
|
||||
if: ${{ steps.detect.outputs.mcp_package == 'true' }}
|
||||
env:
|
||||
GOCACHE: ${{ runner.temp }}/go-cache/non-race
|
||||
run: make ci-package-mcp
|
||||
|
||||
# Last step: the job's result as a workflow_call output for pr.yml's
|
||||
# ci-gate. always() runs it after a failure, a timeout or a
|
||||
# cancellation too; package-gates == 'on' is the only skip condition
|
||||
# (the job itself), so PACKAGE_MCP is never "skipped" on pr.yml.
|
||||
- name: Record job result
|
||||
id: result
|
||||
if: ${{ always() }}
|
||||
env:
|
||||
JOB_STATUS: ${{ job.status }}
|
||||
run: echo "result=$JOB_STATUS" >> "$GITHUB_OUTPUT"
|
||||
|
||||
# F3: npm's twin of package-mcp above. Structurally identical apart from
|
||||
# the language setup (Node instead of Python/uv) and the `make` target.
|
||||
package-npm:
|
||||
name: Package Gate (npm)
|
||||
needs: rbe
|
||||
runs-on: ${{ needs.rbe.outputs.enabled == 'true' && 'blacksmith-4vcpu-ubuntu-2404' || 'ubuntu-latest' }}
|
||||
if: ${{ inputs.package-gates == 'on' }}
|
||||
timeout-minutes: 30
|
||||
outputs:
|
||||
result: ${{ steps.result.outputs.result }}
|
||||
steps:
|
||||
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
||||
with:
|
||||
ref: ${{ inputs.checkout-sha }}
|
||||
fetch-depth: 0
|
||||
persist-credentials: false
|
||||
allow-unsafe-pr-checkout: ${{ inputs.fork-farm == 'authorized' && github.event_name == 'pull_request_target' }}
|
||||
|
||||
- name: Decide applicability
|
||||
id: detect
|
||||
env:
|
||||
PR_BASE_SHA: ${{ github.event.pull_request.base.sha }}
|
||||
PR_HEAD_SHA: ${{ github.event.pull_request.head.sha }}
|
||||
PUSH_BEFORE_SHA: ${{ github.event.before }}
|
||||
PUSH_AFTER_SHA: ${{ github.sha }}
|
||||
run: ./scripts/ci/detect-package-gates.sh
|
||||
|
||||
- name: Set up Bazel
|
||||
id: bazel
|
||||
if: ${{ steps.detect.outputs.npm_package == 'true' && needs.rbe.outputs.enabled == 'true' }}
|
||||
uses: ./.github/actions/setup-bazel
|
||||
env:
|
||||
BAZEL_REMOTE_EXECUTOR: ${{ needs.rbe.outputs.enabled == 'true' && secrets.RBE_WEST_EXECUTOR || '' }}
|
||||
RBE_TLS_CERT: ${{ needs.rbe.outputs.enabled == 'true' && secrets.RBE_TLS_CERT || '' }}
|
||||
RBE_TLS_KEY: ${{ needs.rbe.outputs.enabled == 'true' && secrets.RBE_TLS_KEY || '' }}
|
||||
RBE_TLS_CA: ${{ needs.rbe.outputs.enabled == 'true' && secrets.RBE_TLS_CA || '' }}
|
||||
RBE_INSTANCE: ${{ needs.rbe.outputs.enabled == 'true' && 'oss' || '' }}
|
||||
BAZEL_FORK_CACHE: ${{ needs.rbe.outputs.mode == 'cache' && 'true' || '' }}
|
||||
|
||||
# No --config=ci: only test:ci is defined in .bazelrc, and `bazel
|
||||
# build --config=foo` fails when only test:foo exists.
|
||||
- name: bazel build //cmd/bd:bd_for_tests
|
||||
if: ${{ steps.detect.outputs.npm_package == 'true' && needs.rbe.outputs.enabled == 'true' }}
|
||||
run: bazel build //cmd/bd:bd_for_tests --remote_download_regex='.*/bin/cmd/bd/bd_for_tests/bd$'
|
||||
|
||||
- name: Package the Bazel-built bd
|
||||
if: ${{ steps.detect.outputs.npm_package == 'true' && needs.rbe.outputs.enabled == 'true' }}
|
||||
run: |
|
||||
./scripts/ci/package-bazel-bd.sh "$RUNNER_TEMP/bd-artifacts"
|
||||
echo "BEADS_TEST_BD_BINARY=$RUNNER_TEMP/bd-artifacts/bd-linux-gms-pure" >> "$GITHUB_ENV"
|
||||
|
||||
- name: Set up Go
|
||||
id: setup-go
|
||||
if: ${{ steps.detect.outputs.npm_package == 'true' && needs.rbe.outputs.enabled != 'true' }}
|
||||
uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0
|
||||
with:
|
||||
go-version-file: 'go.mod'
|
||||
cache: false
|
||||
|
||||
- name: Restore Go module cache
|
||||
if: ${{ steps.detect.outputs.npm_package == 'true' && needs.rbe.outputs.enabled != 'true' }}
|
||||
uses: actions/cache/restore@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
|
||||
with:
|
||||
path: ~/go/pkg/mod
|
||||
key: beads-go-mod-v2-${{ runner.os }}-${{ runner.arch }}-go-${{ steps.setup-go.outputs.go-version }}-${{ hashFiles('go.mod', 'go.sum') }}
|
||||
restore-keys: beads-go-mod-v2-${{ runner.os }}-${{ runner.arch }}-go-${{ steps.setup-go.outputs.go-version }}-
|
||||
|
||||
- name: Verify Go modules
|
||||
if: ${{ steps.detect.outputs.npm_package == 'true' && needs.rbe.outputs.enabled != 'true' }}
|
||||
run: go mod verify
|
||||
|
||||
- name: Restore non-race Go build cache
|
||||
if: ${{ steps.detect.outputs.npm_package == 'true' && needs.rbe.outputs.enabled != 'true' }}
|
||||
uses: actions/cache/restore@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
|
||||
with:
|
||||
path: ${{ runner.temp }}/go-cache/non-race
|
||||
key: beads-go-build-v2-${{ runner.os }}-${{ runner.arch }}-go-${{ steps.setup-go.outputs.go-version }}-base-gms_pure_go-non-race-${{ github.sha }}
|
||||
restore-keys: beads-go-build-v2-${{ runner.os }}-${{ runner.arch }}-go-${{ steps.setup-go.outputs.go-version }}-base-gms_pure_go-non-race-
|
||||
|
||||
- name: Set up Node.js
|
||||
if: ${{ steps.detect.outputs.npm_package == 'true' }}
|
||||
uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v6
|
||||
with:
|
||||
node-version: '24'
|
||||
|
||||
- name: Run npm package gate
|
||||
if: ${{ steps.detect.outputs.npm_package == 'true' }}
|
||||
env:
|
||||
GOCACHE: ${{ runner.temp }}/go-cache/non-race
|
||||
run: make ci-package-npm
|
||||
|
||||
# Last step: the job's result as a workflow_call output for pr.yml's
|
||||
# ci-gate. always() runs it after a failure, a timeout or a
|
||||
# cancellation too; package-gates == 'on' is the only skip condition
|
||||
# (the job itself), so PACKAGE_NPM is never "skipped" on pr.yml.
|
||||
- name: Record job result
|
||||
id: result
|
||||
if: ${{ always() }}
|
||||
env:
|
||||
JOB_STATUS: ${{ job.status }}
|
||||
run: echo "result=$JOB_STATUS" >> "$GITHUB_OUTPUT"
|
||||
|
|
|
|||
20
.github/workflows/pr-risk.yml
vendored
20
.github/workflows/pr-risk.yml
vendored
|
|
@ -34,7 +34,10 @@ env:
|
|||
jobs:
|
||||
detect-ci-tier:
|
||||
name: Detect CI tier
|
||||
runs-on: ubuntu-latest
|
||||
# F3: same-repo PRs and merge_group get the org's Blacksmith pool; forks,
|
||||
# Dependabot and any other event stay GitHub-hosted. This job restores no
|
||||
# GitHub-saved cache.
|
||||
runs-on: ${{ (github.event_name == 'merge_group' || (github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository && github.actor != 'dependabot[bot]')) && 'blacksmith-2vcpu-ubuntu-2404' || 'ubuntu-latest' }}
|
||||
outputs:
|
||||
full_embedded: ${{ steps.tier.outputs.full_embedded }}
|
||||
reason: ${{ steps.tier.outputs.reason }}
|
||||
|
|
@ -88,7 +91,13 @@ jobs:
|
|||
# variable and runs no repository code.
|
||||
bazel-coverage:
|
||||
name: Bazel tier coverage
|
||||
runs-on: ubuntu-latest
|
||||
# F3: same-repo PRs and merge_group get the org's Blacksmith pool; forks,
|
||||
# Dependabot and any other event stay GitHub-hosted. This job restores no
|
||||
# GitHub-saved cache, so Blacksmith's inability to see one does not cost
|
||||
# it anything. Must stay byte-identical to pr.yml's copy
|
||||
# (TestPRRiskBazelCoverageJob) and to the TestSameRepoBlacksmithRunners
|
||||
# pin.
|
||||
runs-on: ${{ (github.event_name == 'merge_group' || (github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository && github.actor != 'dependabot[bot]')) && 'blacksmith-2vcpu-ubuntu-2404' || 'ubuntu-latest' }}
|
||||
timeout-minutes: 5
|
||||
outputs:
|
||||
embedded: ${{ steps.decide.outputs.embedded }}
|
||||
|
|
@ -555,7 +564,12 @@ jobs:
|
|||
|
||||
ci-gate:
|
||||
name: PR Risk Gate / Required
|
||||
runs-on: ubuntu-latest
|
||||
# F3: same-repo PRs and merge_group get the org's Blacksmith pool; forks,
|
||||
# Dependabot and any other event stay GitHub-hosted. This job restores no
|
||||
# GitHub-saved cache. Must match the TestSameRepoBlacksmithRunners pin;
|
||||
# the gate's NAME must never change (ruleset requires exactly "PR Risk
|
||||
# Gate / Required").
|
||||
runs-on: ${{ (github.event_name == 'merge_group' || (github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository && github.actor != 'dependabot[bot]')) && 'blacksmith-2vcpu-ubuntu-2404' || 'ubuntu-latest' }}
|
||||
needs:
|
||||
- detect-ci-tier
|
||||
- bazel-coverage
|
||||
|
|
|
|||
190
.github/workflows/pr.yml
vendored
190
.github/workflows/pr.yml
vendored
|
|
@ -38,9 +38,10 @@ jobs:
|
|||
|
||||
# D2 step 3: stands down where bazel-coverage says pr_lanes (same-repo,
|
||||
# non-Dependabot PRs while BAZEL_RETIRES_LEGACY_PR_LANES is "true"): its
|
||||
# consumers then stand down too, or (the package gates) take bazel.yml's
|
||||
# bazel-ci-build-artifacts, the same layout built by Bazel /
|
||||
# test, which ci-gate then requires to have run remotely and passed.
|
||||
# consumers then stand down too. F3: the package gates (package-mcp,
|
||||
# package-npm) are no longer among those consumers - they moved into
|
||||
# bazel.yml and build their own bd (Bazel-built on same-repo PRs, `go
|
||||
# build` otherwise), needing only the call's rbe job.
|
||||
build-artifacts:
|
||||
name: Build Artifacts
|
||||
runs-on: ubuntu-latest
|
||||
|
|
@ -733,154 +734,10 @@ jobs:
|
|||
fi
|
||||
echo "No .beads/issues.jsonl changes detected"
|
||||
|
||||
detect-package-gates:
|
||||
name: Detect package gates
|
||||
runs-on: ubuntu-latest
|
||||
outputs:
|
||||
mcp_package: ${{ steps.detect.outputs.mcp_package }}
|
||||
npm_package: ${{ steps.detect.outputs.npm_package }}
|
||||
reason: ${{ steps.detect.outputs.reason }}
|
||||
steps:
|
||||
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v6
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Decide package gates
|
||||
id: detect
|
||||
env:
|
||||
PR_BASE_SHA: ${{ github.event.pull_request.base.sha }}
|
||||
PR_HEAD_SHA: ${{ github.event.pull_request.head.sha }}
|
||||
PUSH_BEFORE_SHA: ${{ github.event.before }}
|
||||
PUSH_AFTER_SHA: ${{ github.sha }}
|
||||
run: ./scripts/ci/detect-package-gates.sh
|
||||
|
||||
package-mcp:
|
||||
name: Package Gate (MCP)
|
||||
runs-on: ubuntu-latest
|
||||
# D2 step 3: where bazel-coverage says pr_lanes, build-artifacts stands
|
||||
# down and this gate takes the Bazel-built bd (bazel-ci-build-artifacts,
|
||||
# uploaded by the bazel call's `test` lane), so it waits for the call.
|
||||
needs: [detect-package-gates, build-artifacts, bazel-coverage, bazel]
|
||||
if: ${{ !cancelled() && needs.detect-package-gates.result == 'success' && needs.bazel-coverage.result == 'success' && (needs.bazel-coverage.outputs.pr_lanes == 'true' || needs.build-artifacts.result == 'success') }}
|
||||
steps:
|
||||
- name: Check applicability
|
||||
id: applicability
|
||||
run: |
|
||||
echo "run=${{ needs.detect-package-gates.outputs.mcp_package }}" >> "$GITHUB_OUTPUT"
|
||||
if [[ "${{ needs.detect-package-gates.outputs.mcp_package }}" != "true" ]]; then
|
||||
echo "MCP package gate is not applicable: ${{ needs.detect-package-gates.outputs.reason }}"
|
||||
fi
|
||||
|
||||
# D2 step 3: where build-artifacts stood down, the bd comes from the
|
||||
# bazel call's `test` lane, which runs only in mode remote; say so
|
||||
# instead of failing on a missing artifact (ci-gate is red then too,
|
||||
# BAZEL_PR_LANES_RETIRED).
|
||||
- name: Check the Bazel-built bd exists
|
||||
if: steps.applicability.outputs.run == 'true' && needs.bazel-coverage.outputs.pr_lanes == 'true'
|
||||
env:
|
||||
BAZEL_RBE_MODE: ${{ needs.bazel.outputs.rbe-mode }}
|
||||
run: |
|
||||
if [[ "$BAZEL_RBE_MODE" != "remote" ]]; then
|
||||
echo "::error::Build Artifacts stood down for Bazel / test (BAZEL_RETIRES_LEGACY_PR_LANES), but the Bazel call ran in mode '${BAZEL_RBE_MODE:-none}', so no bd was built for this gate. See BAZEL_PR_LANES_RETIRED in CI Gate / Required."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v6
|
||||
if: steps.applicability.outputs.run == 'true'
|
||||
|
||||
- name: Set up Python
|
||||
if: steps.applicability.outputs.run == 'true'
|
||||
uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
|
||||
with:
|
||||
python-version: '3.14'
|
||||
|
||||
- name: Install uv
|
||||
if: steps.applicability.outputs.run == 'true'
|
||||
run: python -m pip install uv==0.11.16
|
||||
|
||||
- name: Download build artifacts
|
||||
if: steps.applicability.outputs.run == 'true'
|
||||
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8
|
||||
with:
|
||||
name: ${{ needs.bazel-coverage.outputs.pr_lanes == 'true' && 'bazel-ci-build-artifacts' || 'ci-build-artifacts' }}
|
||||
path: ci-build-artifacts
|
||||
|
||||
- name: Verify build artifacts
|
||||
if: steps.applicability.outputs.run == 'true'
|
||||
run: |
|
||||
set -euo pipefail
|
||||
cd ci-build-artifacts
|
||||
sha256sum -c SHA256SUMS
|
||||
chmod +x bd-linux-gms-pure
|
||||
|
||||
- name: Run MCP package gate
|
||||
if: steps.applicability.outputs.run == 'true'
|
||||
env:
|
||||
BEADS_TEST_BD_BINARY: ${{ github.workspace }}/ci-build-artifacts/bd-linux-gms-pure
|
||||
run: make ci-package-mcp
|
||||
|
||||
package-npm:
|
||||
name: Package Gate (npm)
|
||||
runs-on: ubuntu-latest
|
||||
# D2 step 3: where bazel-coverage says pr_lanes, build-artifacts stands
|
||||
# down and this gate takes the Bazel-built bd (bazel-ci-build-artifacts,
|
||||
# uploaded by the bazel call's `test` lane), so it waits for the call.
|
||||
needs: [detect-package-gates, build-artifacts, bazel-coverage, bazel]
|
||||
if: ${{ !cancelled() && needs.detect-package-gates.result == 'success' && needs.bazel-coverage.result == 'success' && (needs.bazel-coverage.outputs.pr_lanes == 'true' || needs.build-artifacts.result == 'success') }}
|
||||
steps:
|
||||
- name: Check applicability
|
||||
id: applicability
|
||||
run: |
|
||||
echo "run=${{ needs.detect-package-gates.outputs.npm_package }}" >> "$GITHUB_OUTPUT"
|
||||
if [[ "${{ needs.detect-package-gates.outputs.npm_package }}" != "true" ]]; then
|
||||
echo "npm package gate is not applicable: ${{ needs.detect-package-gates.outputs.reason }}"
|
||||
fi
|
||||
|
||||
# D2 step 3: where build-artifacts stood down, the bd comes from the
|
||||
# bazel call's `test` lane, which runs only in mode remote; say so
|
||||
# instead of failing on a missing artifact (ci-gate is red then too,
|
||||
# BAZEL_PR_LANES_RETIRED).
|
||||
- name: Check the Bazel-built bd exists
|
||||
if: steps.applicability.outputs.run == 'true' && needs.bazel-coverage.outputs.pr_lanes == 'true'
|
||||
env:
|
||||
BAZEL_RBE_MODE: ${{ needs.bazel.outputs.rbe-mode }}
|
||||
run: |
|
||||
if [[ "$BAZEL_RBE_MODE" != "remote" ]]; then
|
||||
echo "::error::Build Artifacts stood down for Bazel / test (BAZEL_RETIRES_LEGACY_PR_LANES), but the Bazel call ran in mode '${BAZEL_RBE_MODE:-none}', so no bd was built for this gate. See BAZEL_PR_LANES_RETIRED in CI Gate / Required."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v6
|
||||
if: steps.applicability.outputs.run == 'true'
|
||||
|
||||
- name: Set up Node.js
|
||||
if: steps.applicability.outputs.run == 'true'
|
||||
uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v6
|
||||
with:
|
||||
node-version: '24'
|
||||
|
||||
- name: Download build artifacts
|
||||
if: steps.applicability.outputs.run == 'true'
|
||||
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8
|
||||
with:
|
||||
name: ${{ needs.bazel-coverage.outputs.pr_lanes == 'true' && 'bazel-ci-build-artifacts' || 'ci-build-artifacts' }}
|
||||
path: ci-build-artifacts
|
||||
|
||||
- name: Verify build artifacts
|
||||
if: steps.applicability.outputs.run == 'true'
|
||||
run: |
|
||||
set -euo pipefail
|
||||
cd ci-build-artifacts
|
||||
sha256sum -c SHA256SUMS
|
||||
chmod +x bd-linux-gms-pure
|
||||
|
||||
- name: Run npm package gate
|
||||
if: steps.applicability.outputs.run == 'true'
|
||||
env:
|
||||
BEADS_TEST_BD_BINARY: ${{ github.workspace }}/ci-build-artifacts/bd-linux-gms-pure
|
||||
run: make ci-package-npm
|
||||
|
||||
|
||||
# F3: package-mcp and package-npm (and the detect job that fed them) moved
|
||||
# into bazel.yml, which pr.yml calls with package-gates: "on" below. They
|
||||
# now depend on nothing but the rbe job's decision, so they no longer wait
|
||||
# on build-artifacts, bazel-coverage or the rest of the bazel call.
|
||||
pr-policy-wrapper:
|
||||
name: PR Policy (wrapper timing)
|
||||
runs-on: ubuntu-latest
|
||||
|
|
@ -1986,6 +1843,9 @@ jobs:
|
|||
with:
|
||||
build-artifact-name: bazel-ci-build-artifacts
|
||||
integration: "on"
|
||||
# F3: only pr.yml opts in; the package-mcp/package-npm jobs run inside
|
||||
# this call, needing only its rbe job.
|
||||
package-gates: "on"
|
||||
|
||||
# D2: pr-risk.yml's bazel-coverage job, verbatim (policy-tested
|
||||
# identical). Where it says a tier is covered, PR Risk skips that tier's
|
||||
|
|
@ -1995,7 +1855,13 @@ jobs:
|
|||
# lanes to have run remotely and passed in this run.
|
||||
bazel-coverage:
|
||||
name: Bazel tier coverage
|
||||
runs-on: ubuntu-latest
|
||||
# F3: same-repo PRs and merge_group get the org's Blacksmith pool; forks,
|
||||
# Dependabot and any other event stay GitHub-hosted. This job restores no
|
||||
# GitHub-saved cache, so Blacksmith's inability to see one does not cost
|
||||
# it anything. Must stay byte-identical to pr-risk.yml's copy
|
||||
# (TestPRRiskBazelCoverageJob) and to the TestSameRepoBlacksmithRunners
|
||||
# pin.
|
||||
runs-on: ${{ (github.event_name == 'merge_group' || (github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository && github.actor != 'dependabot[bot]')) && 'blacksmith-2vcpu-ubuntu-2404' || 'ubuntu-latest' }}
|
||||
timeout-minutes: 5
|
||||
outputs:
|
||||
embedded: ${{ steps.decide.outputs.embedded }}
|
||||
|
|
@ -2051,7 +1917,12 @@ jobs:
|
|||
|
||||
ci-gate:
|
||||
name: CI Gate / Required
|
||||
runs-on: ubuntu-latest
|
||||
# F3: same-repo PRs and merge_group get the org's Blacksmith pool; forks,
|
||||
# Dependabot and any other event stay GitHub-hosted. This job restores no
|
||||
# GitHub-saved cache. Must match the TestSameRepoBlacksmithRunners pin;
|
||||
# the gate's NAME must never change (ruleset requires exactly "CI Gate /
|
||||
# Required").
|
||||
runs-on: ${{ (github.event_name == 'merge_group' || (github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository && github.actor != 'dependabot[bot]')) && 'blacksmith-2vcpu-ubuntu-2404' || 'ubuntu-latest' }}
|
||||
needs:
|
||||
- build-artifacts
|
||||
- check-build-tags
|
||||
|
|
@ -2065,9 +1936,6 @@ jobs:
|
|||
- check-doc-freshness-platforms
|
||||
- pr-preflight-platforms
|
||||
- check-no-beads-changes
|
||||
- detect-package-gates
|
||||
- package-mcp
|
||||
- package-npm
|
||||
- pr-policy-wrapper
|
||||
- pr-core-wrapper
|
||||
- scripts-go-checks
|
||||
|
|
@ -2100,7 +1968,6 @@ jobs:
|
|||
CHECK_DOC_FRESHNESS_PLATFORMS
|
||||
PR_PREFLIGHT_PLATFORMS
|
||||
CHECK_NO_BEADS_CHANGES
|
||||
DETECT_PACKAGE_GATES
|
||||
PACKAGE_MCP
|
||||
PACKAGE_NPM
|
||||
PR_POLICY_WRAPPER
|
||||
|
|
@ -2137,9 +2004,12 @@ jobs:
|
|||
CHECK_DOC_FRESHNESS_PLATFORMS: ${{ needs.check-doc-freshness-platforms.result }}
|
||||
PR_PREFLIGHT_PLATFORMS: ${{ needs.pr-preflight-platforms.result }}
|
||||
CHECK_NO_BEADS_CHANGES: ${{ needs.check-no-beads-changes.result }}
|
||||
DETECT_PACKAGE_GATES: ${{ needs.detect-package-gates.result }}
|
||||
PACKAGE_MCP: ${{ needs.package-mcp.result }}
|
||||
PACKAGE_NPM: ${{ needs.package-npm.result }}
|
||||
# F3: package-mcp/package-npm now run inside the bazel call; their
|
||||
# job.status surfaces as a call output exactly like the Bazel lanes
|
||||
# below, never "skipped" on pr.yml (package-gates is always "on"
|
||||
# here).
|
||||
PACKAGE_MCP: ${{ needs.bazel.outputs.package-mcp || 'skipped' }}
|
||||
PACKAGE_NPM: ${{ needs.bazel.outputs.package-npm || 'skipped' }}
|
||||
PR_POLICY_WRAPPER: ${{ needs.pr-policy-wrapper.result }}
|
||||
PR_CORE_WRAPPER: ${{ needs.pr-core-wrapper.result }}
|
||||
SCRIPTS_GO_CHECKS: ${{ needs.scripts-go-checks.result }}
|
||||
|
|
|
|||
14
BUILD.bazel
14
BUILD.bazel
|
|
@ -169,6 +169,20 @@ filegroup(
|
|||
visibility = ["//scripts:__pkg__"],
|
||||
)
|
||||
|
||||
# F3: TestMCPPytestWorkerCountPinned (ci_workflow_test.go) reads the MCP
|
||||
# package's pytest-xdist pin directly from its manifest and lock file, so it
|
||||
# runs under `bazel test` as well as `go test`. integrations/beads-mcp has no
|
||||
# BUILD.bazel of its own (unlike npm-package/, it is not .bazelignore'd), so
|
||||
# these are ordinary sources under this package.
|
||||
filegroup(
|
||||
name = "mcp_package_policy_files",
|
||||
srcs = [
|
||||
"integrations/beads-mcp/pyproject.toml",
|
||||
"integrations/beads-mcp/uv.lock",
|
||||
],
|
||||
visibility = ["//scripts:__pkg__"],
|
||||
)
|
||||
|
||||
go_library(
|
||||
name = "beads",
|
||||
srcs = [
|
||||
|
|
|
|||
|
|
@ -98,6 +98,7 @@ dev = [
|
|||
"pytest>=9.0.3",
|
||||
"pytest-asyncio>=1.2.0",
|
||||
"pytest-cov>=7.0.0",
|
||||
"pytest-xdist>=3.8.0",
|
||||
"ruff>=0.14.0",
|
||||
"types-requests>=2.31.0",
|
||||
]
|
||||
|
|
|
|||
38
integrations/beads-mcp/uv.lock
generated
38
integrations/beads-mcp/uv.lock
generated
|
|
@ -21,7 +21,7 @@ resolution-markers = [
|
|||
"python_full_version < '3.11' and sys_platform != 'win32'",
|
||||
]
|
||||
dependencies = [
|
||||
{ name = "caio", version = "0.9.25", source = { registry = "https://pypi.org/simple" } },
|
||||
{ name = "caio", version = "0.9.25", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version < '3.11'" },
|
||||
]
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/67/e2/d7cb819de8df6b5c1968a2756c3cb4122d4fa2b8fc768b53b7c9e5edb646/aiofile-3.9.0.tar.gz", hash = "sha256:e5ad718bb148b265b6df1b3752c4d1d83024b93da9bd599df74b9d9ffcf7919b", size = 17943, upload-time = "2024-10-08T10:39:35.846Z" }
|
||||
wheels = [
|
||||
|
|
@ -41,7 +41,7 @@ resolution-markers = [
|
|||
"(python_full_version >= '3.11' and python_full_version < '3.14' and sys_platform != 'emscripten' and sys_platform != 'win32') or (python_full_version == '3.11.*' and sys_platform == 'emscripten')",
|
||||
]
|
||||
dependencies = [
|
||||
{ name = "caio", version = "0.12.2", source = { registry = "https://pypi.org/simple" } },
|
||||
{ name = "caio", version = "0.12.2", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version >= '3.11'" },
|
||||
]
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/14/31/edb06aabd8f8f0b56d659f30800795f40b93cba96be946ce179f6931e3a5/aiofile-3.12.3.tar.gz", hash = "sha256:caa6aa746b5e47e2165f7abd741b6415e49cf4d44fddc0f61844612cc3924d41", size = 21600, upload-time = "2026-08-04T22:59:27.171Z" }
|
||||
wheels = [
|
||||
|
|
@ -192,6 +192,7 @@ dev = [
|
|||
{ name = "pytest" },
|
||||
{ name = "pytest-asyncio" },
|
||||
{ name = "pytest-cov" },
|
||||
{ name = "pytest-xdist" },
|
||||
{ name = "ruff" },
|
||||
{ name = "types-requests" },
|
||||
]
|
||||
|
|
@ -210,6 +211,7 @@ dev = [
|
|||
{ name = "pytest", specifier = ">=9.0.3" },
|
||||
{ name = "pytest-asyncio", specifier = ">=1.2.0" },
|
||||
{ name = "pytest-cov", specifier = ">=7.0.0" },
|
||||
{ name = "pytest-xdist", specifier = ">=3.8.0" },
|
||||
{ name = "ruff", specifier = ">=0.14.0" },
|
||||
{ name = "types-requests", specifier = ">=2.31.0" },
|
||||
]
|
||||
|
|
@ -707,6 +709,15 @@ wheels = [
|
|||
{ url = "https://files.pythonhosted.org/packages/8a/0e/97c33bf5009bdbac74fd2beace167cab3f978feb69cc36f1ef79360d6c4e/exceptiongroup-1.3.1-py3-none-any.whl", hash = "sha256:a7a39a3bd276781e98394987d3a5701d0c4edffb633bb7a5144577f82c773598", size = 16740, upload-time = "2025-11-21T23:01:53.443Z" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "execnet"
|
||||
version = "2.1.2"
|
||||
source = { registry = "https://pypi.org/simple" }
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/bf/89/780e11f9588d9e7128a3f87788354c7946a9cbb1401ad38a48c4db9a4f07/execnet-2.1.2.tar.gz", hash = "sha256:63d83bfdd9a23e35b9c6a3261412324f964c2ec8dcd8d3c6916ee9373e0befcd", size = 166622, upload-time = "2025-11-12T09:56:37.75Z" }
|
||||
wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/ab/84/02fc1827e8cdded4aa65baef11296a9bbe595c474f0d6d758af082d849fd/execnet-2.1.2-py3-none-any.whl", hash = "sha256:67fba928dd5a544b783f6056f449e5e3931a5c378b128bc18501f7ea79e296ec", size = 40708, upload-time = "2025-11-12T09:56:36.333Z" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "fastmcp"
|
||||
version = "4.0.5"
|
||||
|
|
@ -795,8 +806,8 @@ name = "httpcore2"
|
|||
version = "2.13.1"
|
||||
source = { registry = "https://pypi.org/simple" }
|
||||
dependencies = [
|
||||
{ name = "h11" },
|
||||
{ name = "truststore" },
|
||||
{ name = "h11", marker = "python_full_version < '3.12' or python_full_version >= '3.14' or sys_platform != 'emscripten'" },
|
||||
{ name = "truststore", marker = "python_full_version < '3.12' or python_full_version >= '3.14' or sys_platform != 'emscripten'" },
|
||||
]
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/cb/f3/1db7aa2bc2524062192bb0e0323969492d1883152a232fe36eea65f4e35c/httpcore2-2.13.1.tar.gz", hash = "sha256:e0aa977abe17e69a3b820a24542a6fa88702676d83880b8d194dcd18408e5103", size = 68071, upload-time = "2026-09-23T07:47:22.372Z" }
|
||||
wheels = [
|
||||
|
|
@ -843,7 +854,7 @@ name = "importlib-metadata"
|
|||
version = "9.0.1"
|
||||
source = { registry = "https://pypi.org/simple" }
|
||||
dependencies = [
|
||||
{ name = "zipp" },
|
||||
{ name = "zipp", marker = "(python_full_version < '3.14' and sys_platform != 'emscripten') or (python_full_version < '3.12' and sys_platform == 'emscripten')" },
|
||||
]
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/6f/7e/1e7e8dc30634b93ebb3d58a3dea569ad146e656218d3960ab04f62047b29/importlib_metadata-9.0.1.tar.gz", hash = "sha256:ab830580bc0ef3db61ce8fae716389e5462b67e033018bab6d8f80ef17172f99", size = 59124, upload-time = "2026-08-28T15:30:34.646Z" }
|
||||
wheels = [
|
||||
|
|
@ -1604,6 +1615,19 @@ wheels = [
|
|||
{ url = "https://files.pythonhosted.org/packages/9d/7a/d968e294073affff457b041c2be9868a40c1c71f4a35fcc1e45e5493067b/pytest_cov-7.1.0-py3-none-any.whl", hash = "sha256:a0461110b7865f9a271aa1b51e516c9a95de9d696734a2f71e3e78f46e1d4678", size = 22876, upload-time = "2026-03-21T20:11:14.438Z" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "pytest-xdist"
|
||||
version = "3.8.0"
|
||||
source = { registry = "https://pypi.org/simple" }
|
||||
dependencies = [
|
||||
{ name = "execnet" },
|
||||
{ name = "pytest" },
|
||||
]
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/78/b4/439b179d1ff526791eb921115fca8e44e596a13efeda518b9d845a619450/pytest_xdist-3.8.0.tar.gz", hash = "sha256:7e578125ec9bc6050861aa93f2d59f1d8d085595d6551c2c90b6f4fad8d3a9f1", size = 88069, upload-time = "2025-07-01T13:30:59.346Z" }
|
||||
wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/ca/31/d4e37e9e550c2b92a9cbc2e4d0b7420a27224968580b5a447f420847c975/pytest_xdist-3.8.0-py3-none-any.whl", hash = "sha256:202ca578cfeb7370784a8c33d6d05bc6e13b4f25b5053c30a152269fd10f0b88", size = 46396, upload-time = "2025-07-01T13:30:56.632Z" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "python-dotenv"
|
||||
version = "1.2.3"
|
||||
|
|
@ -2048,8 +2072,8 @@ name = "secretstorage"
|
|||
version = "3.5.0"
|
||||
source = { registry = "https://pypi.org/simple" }
|
||||
dependencies = [
|
||||
{ name = "cryptography" },
|
||||
{ name = "jeepney" },
|
||||
{ name = "cryptography", marker = "(python_full_version < '3.12' and sys_platform == 'emscripten') or (python_full_version >= '3.14' and sys_platform == 'emscripten') or (python_full_version >= '3.15' and sys_platform == 'win32') or (sys_platform != 'emscripten' and sys_platform != 'win32')" },
|
||||
{ name = "jeepney", marker = "(python_full_version < '3.12' and sys_platform == 'emscripten') or (python_full_version >= '3.14' and sys_platform == 'emscripten') or (python_full_version >= '3.15' and sys_platform == 'win32') or (sys_platform != 'emscripten' and sys_platform != 'win32')" },
|
||||
]
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/1c/03/e834bcd866f2f8a49a85eaff47340affa3bfa391ee9912a952a1faa68c7b/secretstorage-3.5.0.tar.gz", hash = "sha256:f04b8e4689cbce351744d5537bf6b1329c6fc68f91fa666f60a380edddcd11be", size = 19884, upload-time = "2025-11-23T19:02:53.191Z" }
|
||||
wheels = [
|
||||
|
|
|
|||
|
|
@ -46,6 +46,7 @@ go_test(
|
|||
":scripts_files",
|
||||
"//:.goreleaser.yml",
|
||||
"//:bazel_policy_files",
|
||||
"//:mcp_package_policy_files",
|
||||
"//:test_sh_files",
|
||||
"//:workflow_files",
|
||||
"//internal/testutil:testdoltcommon.go",
|
||||
|
|
|
|||
|
|
@ -192,6 +192,14 @@ func TestBazelCacheModeReachesTheRC(t *testing.T) {
|
|||
}
|
||||
var wantSkips []string
|
||||
for lane, id := range bazelLaneGateIDs {
|
||||
// F3: package-mcp/package-npm skip only when the caller's
|
||||
// package-gates input is off, never because of rbe mode;
|
||||
// bazel-gate.sh knows nothing about them (its skip list is
|
||||
// mode-derived only), so this scenario's with (which never
|
||||
// sets package-gates here) must not expect them either.
|
||||
if bazelPackageJobs[lane] {
|
||||
continue
|
||||
}
|
||||
if !ran[lane] {
|
||||
wantSkips = append(wantSkips, id)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -244,6 +244,13 @@ func TestBazelWorkflowForkFarmInputs(t *testing.T) {
|
|||
}
|
||||
checkouts++
|
||||
want := map[string]string{"ref": bazelCheckoutRef, "persist-credentials": "false", "allow-unsafe-pr-checkout": bazelAllowUnsafeCheckout}
|
||||
// F3: package-mcp/package-npm's detect step diffs PR_BASE_SHA
|
||||
// against PR_HEAD_SHA (scripts/ci/detect-package-gates.sh, same
|
||||
// as pr.yml's legacy detect job used); that needs full history,
|
||||
// unlike every other lane's shallow, history-free checkout.
|
||||
if bazelPackageJobs[name] {
|
||||
want["fetch-depth"] = "0"
|
||||
}
|
||||
if !reflect.DeepEqual(step.With, want) {
|
||||
t.Errorf("%s job %s checkout with = %v, want %v", bazelWorkflowName, name, step.With, want)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -82,7 +82,10 @@ while IFS= read -r path; do
|
|||
;;
|
||||
esac
|
||||
case "$path" in
|
||||
scripts/ci/detect-package-gates.sh|.github/workflows/pr.yml|.github/workflows/main.yml|.github/workflows/pr-risk.yml|.github/workflows/ci-measurements.yml|Makefile)
|
||||
# F3: package-mcp/package-npm's job definitions (this detect step
|
||||
# included) now live in bazel.yml, not pr.yml, so a change there
|
||||
# must run both gates the same way a pr.yml/main.yml change does.
|
||||
scripts/ci/detect-package-gates.sh|.github/workflows/bazel.yml|.github/workflows/pr.yml|.github/workflows/main.yml|.github/workflows/pr-risk.yml|.github/workflows/ci-measurements.yml|Makefile)
|
||||
mcp_package=true
|
||||
npm_package=true
|
||||
;;
|
||||
|
|
|
|||
|
|
@ -4,8 +4,11 @@
|
|||
#
|
||||
# The binary is //cmd/bd:bd_for_tests, the non-race gms_pure_go cgo bd that
|
||||
# Bazel's own tests exec (//cmd/bd:bd is race built under --config=ci); run
|
||||
# after `bazel test //... --config=ci`, whose test:ci downloads it. Unlike
|
||||
# `go build`, it carries no vcs.* or CGO_ENABLED build settings, so
|
||||
# after `bazel test //... --config=ci` (whose test:ci downloads it) or after
|
||||
# `bazel build //cmd/bd:bd_for_tests` directly (bazel.yml's package gates:
|
||||
# only test:ci is defined in .bazelrc, so `bazel build --config=ci` fails).
|
||||
# Either way the same bd_for_tests output path is what this script packages.
|
||||
# Unlike `go build`, it carries no vcs.* or CGO_ENABLED build settings, so
|
||||
# `bd version` shows no commit and scripts/verify-cgo.sh would pass
|
||||
# vacuously; no consumer of the artifact reads either.
|
||||
#
|
||||
|
|
|
|||
|
|
@ -52,7 +52,11 @@ mcp_mypy() {
|
|||
|
||||
mcp_pytest() {
|
||||
cd "$MCP_DIR"
|
||||
uv run pytest --durations=50
|
||||
# Explicit worker count, not "auto": CI runners' reported CPU count
|
||||
# doesn't always match the cgroup quota, and -n 8 is pinned to measured
|
||||
# timing (tools/f3, 2026-10) on both 2 vCPU (2.7x) and 4 vCPU (~3x)
|
||||
# runners. pytest-xdist is a pinned dev dependency (pyproject.toml).
|
||||
uv run pytest -n 8 --durations=50
|
||||
}
|
||||
|
||||
mcp_build() {
|
||||
|
|
|
|||
|
|
@ -1205,11 +1205,13 @@ func assertNoUnmanagedGoCacheSteps(t *testing.T, workflows map[string]ciWorkflow
|
|||
const (
|
||||
setupGoActionFamily = "actions/setup-go"
|
||||
setupNodeActionFamily = "actions/setup-node"
|
||||
setupPythonActionFamily = "actions/setup-python"
|
||||
cacheMonolithicActionFamily = "actions/cache"
|
||||
cacheRestoreActionFamily = "actions/cache/restore"
|
||||
cacheSaveActionFamily = "actions/cache/save"
|
||||
setupGoSHA = "b7ad1dad31e06c5925ef5d2fc7ad053ef454303e"
|
||||
setupNodeSHA = "820762786026740c76f36085b0efc47a31fe5020"
|
||||
setupPythonSHA = "5fda3b95a4ea91299a34e894583c3862153e4b97"
|
||||
cacheSHA = "55cc8345863c7cc4c66a329aec7e433d2d1c52a9"
|
||||
goCacheSchema = "v2"
|
||||
goBaseTag = "gms_pure_go"
|
||||
|
|
@ -1773,7 +1775,20 @@ const (
|
|||
bazelIntegJobName = "bazel-integration"
|
||||
bazelProxiedJobName = "bazel-proxied"
|
||||
bazelServerJobName = "bazel-server-storage"
|
||||
setupBazelActionDir = ".github/actions/setup-bazel"
|
||||
// F3: the MCP and npm package gates, moved here from pr.yml so they need
|
||||
// only the rbe job. Unlike every other lane they do not mirror a Bazel
|
||||
// config; pr.yml opts them in with package-gates: "on".
|
||||
bazelPackageMCPJobName = "package-mcp"
|
||||
bazelPackageNPMJobName = "package-npm"
|
||||
setupBazelActionDir = ".github/actions/setup-bazel"
|
||||
)
|
||||
|
||||
// F3: package-mcp and package-npm, the two lanes bazel-gate.sh does not
|
||||
// know about at all - their skip reason is the caller's package-gates
|
||||
// input, never the rbe job's mode.
|
||||
var bazelPackageJobs = map[string]bool{bazelPackageMCPJobName: true, bazelPackageNPMJobName: true}
|
||||
|
||||
const (
|
||||
uploadArtifactSHA = "043fb46d1a93c77aae656e7c1c64a875d1fc6a0a"
|
||||
downloadArtifactSHA = "3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c"
|
||||
checkoutSHA = "3d3c42e5aac5ba805825da76410c181273ba90b1"
|
||||
|
|
@ -1787,8 +1802,9 @@ const (
|
|||
)
|
||||
|
||||
// bazel.yml's jobs: the rbe job that decides the execution mode, the
|
||||
// --config=ci lane, and one job per CI job a Bazel config mirrors.
|
||||
var bazelJobNames = []string{bazelDoltJobName, bazelEmbedJobName, bazelIntegJobName, bazelProxiedJobName, bazelPureJobName, bazelServerJobName, bazelJobName, bazelRBEJobName}
|
||||
// --config=ci lane, one job per CI job a Bazel config mirrors, and the two
|
||||
// package gates (F3), sorted alphabetically to match TestBazelWorkflowJobsAndExecutionMode's sort.Strings.
|
||||
var bazelJobNames = []string{bazelDoltJobName, bazelEmbedJobName, bazelIntegJobName, bazelProxiedJobName, bazelPureJobName, bazelServerJobName, bazelJobName, bazelPackageMCPJobName, bazelPackageNPMJobName, bazelRBEJobName}
|
||||
|
||||
// The lanes that only run remotely (skipped unless the rbe job chose remote);
|
||||
// bazel-integration runs remotely or with the read-only cache (bazelIntegIf);
|
||||
|
|
@ -1826,6 +1842,10 @@ var bazelLaneGateIDs = map[string]string{
|
|||
// twins run only on push to main: remotely on same-repo PRs, locally
|
||||
// with the read-only cache (mode cache) on fork and Dependabot PRs.
|
||||
bazelIntegJobName: "BAZEL_INTEGRATION",
|
||||
// F3: never skippable on pr.yml (package-gates is always "on" there), so
|
||||
// bazel-gate.sh's skip list never names them.
|
||||
bazelPackageMCPJobName: "PACKAGE_MCP",
|
||||
bazelPackageNPMJobName: "PACKAGE_NPM",
|
||||
}
|
||||
|
||||
// None today: every lane is gated. Kept so a future lane that pr.yml's call
|
||||
|
|
@ -1841,6 +1861,28 @@ var bazelAdvisoryLanes = map[string]string{}
|
|||
// lane keeps running on main.
|
||||
const bazelIntegIf = "${{ (needs.rbe.outputs.mode == 'remote' || needs.rbe.outputs.mode == 'cache') && inputs.integration != 'off' }}"
|
||||
|
||||
// F3: package-mcp and package-npm's if. Unlike every other lane's, it does
|
||||
// not read the rbe job's outputs at all - only the caller's package-gates
|
||||
// input - so these two never skip because of execution mode, only because a
|
||||
// caller left package-gates at its default "off".
|
||||
const bazelPackageGatesIf = "${{ inputs.package-gates == 'on' }}"
|
||||
|
||||
// F3: the package gates' runner. 4 vCPU, not bazel.yml's usual 2: pytest-xdist
|
||||
// -n 8 is pinned to measured timing on a 4 vCPU runner (tools/f3).
|
||||
const bazelPackageRunsOn = "${{ needs.rbe.outputs.enabled == 'true' && 'blacksmith-4vcpu-ubuntu-2404' || 'ubuntu-latest' }}"
|
||||
|
||||
// F3: the rbe job's own runner (not gated by its own outputs - it decides
|
||||
// them). Same-repo PRs and merge_group/push/dispatch/schedule (never forks)
|
||||
// get Blacksmith; a pull_request_target farm run and any fork or Dependabot
|
||||
// PR stay GitHub-hosted. Pinned verbatim by TestSameRepoBlacksmithRunners.
|
||||
const wantRBERunsOn = "${{ (github.event_name == 'push' || github.event_name == 'workflow_dispatch' || github.event_name == 'schedule' || github.event_name == 'merge_group' || (github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository && github.actor != 'dependabot[bot]')) && 'blacksmith-2vcpu-ubuntu-2404' || 'ubuntu-latest' }}"
|
||||
|
||||
// F3: the same "same-repo PR, or merge_group" Blacksmith expression used by
|
||||
// pr.yml's and pr-risk.yml's bazel-coverage/ci-gate/detect-ci-tier jobs - a
|
||||
// package-level const so every test that needs it (TestSameRepoBlacksmithRunners,
|
||||
// TestPRRiskBazelCoverageJob, ...) reads the one literal.
|
||||
const sameRepoBlacksmith2vcpu = "${{ (github.event_name == 'merge_group' || (github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository && github.actor != 'dependabot[bot]')) && 'blacksmith-2vcpu-ubuntu-2404' || 'ubuntu-latest' }}"
|
||||
|
||||
// pr.yml's call of bazel.yml: exactly these inputs (review D1 v2 N3). An rbe
|
||||
// override would put every PR in local mode and ungate the embedded tier
|
||||
// while the gate stays self-consistent; integration: "off" would drop the
|
||||
|
|
@ -1849,6 +1891,9 @@ const bazelIntegIf = "${{ (needs.rbe.outputs.mode == 'remote' || needs.rbe.outpu
|
|||
var bazelPRCallWith = map[string]string{
|
||||
"build-artifact-name": "bazel-ci-build-artifacts",
|
||||
"integration": "on",
|
||||
// F3: only pr.yml opts in; bazel-farm.yml and nightly.yml keep the
|
||||
// default "off" (TestBazelGateSimulation's other callers).
|
||||
"package-gates": "on",
|
||||
}
|
||||
|
||||
// The call's aggregate result (needs.bazel.result, through bazel-gate.sh).
|
||||
|
|
@ -1931,6 +1976,15 @@ func TestBazelWorkflowJobsAndExecutionMode(t *testing.T) {
|
|||
"RBE_INSTANCE": "${{ " + gate + "'oss' || '' }}",
|
||||
"BAZEL_FORK_CACHE": "${{ needs.rbe.outputs.mode == 'cache' && 'true' || '' }}",
|
||||
}
|
||||
// F3: the rbe job itself runs on Blacksmith for same-repo PRs (and
|
||||
// merge_group/push/dispatch/schedule, which are never forks); a
|
||||
// pull_request_target farm run and any fork or Dependabot PR stay
|
||||
// GitHub-hosted. Pinned again, verbatim, by TestSameRepoBlacksmithRunners.
|
||||
if rbe, ok := workflow.Jobs[bazelRBEJobName]; !ok {
|
||||
t.Fatalf("%s has no %s job", bazelWorkflowName, bazelRBEJobName)
|
||||
} else if rbe.RunsOn != wantRBERunsOn {
|
||||
t.Errorf("%s runs-on = %q, want %q", bazelRBEJobName, rbe.RunsOn, wantRBERunsOn)
|
||||
}
|
||||
for name, job := range workflow.Jobs {
|
||||
if name == bazelRBEJobName {
|
||||
continue
|
||||
|
|
@ -1938,18 +1992,22 @@ func TestBazelWorkflowJobsAndExecutionMode(t *testing.T) {
|
|||
if !reflect.DeepEqual([]string(job.Needs), []string{bazelRBEJobName}) {
|
||||
t.Errorf("%s needs = %v, want [%s]", name, job.Needs, bazelRBEJobName)
|
||||
}
|
||||
if job.RunsOn != wantRunsOn {
|
||||
t.Errorf("%s runs-on = %q, want %q", name, job.RunsOn, wantRunsOn)
|
||||
// F3: the package gates use a 4 vCPU runner (pytest-xdist -n 8) and
|
||||
// their own if (the caller's package-gates input, not the rbe job's
|
||||
// mode - they never skip for execution-mode reasons).
|
||||
wantJobRunsOn, wantJobIf := wantRunsOn, wantIf
|
||||
if bazelPackageJobs[name] {
|
||||
wantJobRunsOn, wantJobIf = bazelPackageRunsOn, bazelPackageGatesIf
|
||||
} else if bazelRemoteOnlyJobs[name] {
|
||||
wantJobIf = wantRemoteOnlyIf
|
||||
} else if name == bazelIntegJobName {
|
||||
wantJobIf = bazelIntegIf
|
||||
}
|
||||
want := wantIf
|
||||
if bazelRemoteOnlyJobs[name] {
|
||||
want = wantRemoteOnlyIf
|
||||
if job.RunsOn != wantJobRunsOn {
|
||||
t.Errorf("%s runs-on = %q, want %q", name, job.RunsOn, wantJobRunsOn)
|
||||
}
|
||||
if name == bazelIntegJobName {
|
||||
want = bazelIntegIf
|
||||
}
|
||||
if job.If != want {
|
||||
t.Errorf("%s if = %q, want %q", name, job.If, want)
|
||||
if job.If != wantJobIf {
|
||||
t.Errorf("%s if = %q, want %q", name, job.If, wantJobIf)
|
||||
}
|
||||
for _, step := range job.Steps {
|
||||
if step.Uses == "./"+setupBazelActionDir && !reflect.DeepEqual(step.Env, wantSetupEnv) {
|
||||
|
|
@ -1959,6 +2017,90 @@ func TestBazelWorkflowJobsAndExecutionMode(t *testing.T) {
|
|||
}
|
||||
}
|
||||
|
||||
// F3: bazelPackageRunsOn's comment and the package-mcp job's 4 vCPU runner
|
||||
// are both premised on mcp_pytest() in package-mcp.sh passing an explicit
|
||||
// "-n 8" (not "-n auto", which would reintroduce the CPU-count/cgroup-quota
|
||||
// mismatch -n 8 was pinned to avoid), and on pytest-xdist itself being a
|
||||
// locked dev dependency so that worker count is reproducible across CI runs.
|
||||
// Neither half of that premise is checked by any other policy test, so pin
|
||||
// both here directly against the script and the MCP package's manifest/lock.
|
||||
func TestMCPPytestWorkerCountPinned(t *testing.T) {
|
||||
root := sourceRepoRoot(t)
|
||||
script := readPolicyFile(t, root, "scripts/ci/package-mcp.sh")
|
||||
if !strings.Contains(script, "pytest -n 8") {
|
||||
t.Errorf("scripts/ci/package-mcp.sh mcp_pytest() does not pass an explicit -n 8")
|
||||
}
|
||||
if strings.Contains(script, "-n auto") {
|
||||
t.Errorf("scripts/ci/package-mcp.sh mcp_pytest() uses -n auto; want the pinned -n 8")
|
||||
}
|
||||
pyproject := readPolicyFile(t, root, "integrations/beads-mcp/pyproject.toml")
|
||||
if !regexp.MustCompile(`(?m)^\s*"pytest-xdist[><=]`).MatchString(pyproject) {
|
||||
t.Errorf("integrations/beads-mcp/pyproject.toml does not pin pytest-xdist as a dev dependency")
|
||||
}
|
||||
lock := readPolicyFile(t, root, "integrations/beads-mcp/uv.lock")
|
||||
if !strings.Contains(lock, "name = \"pytest-xdist\"") {
|
||||
t.Errorf("integrations/beads-mcp/uv.lock has no locked pytest-xdist entry; run uv lock")
|
||||
}
|
||||
}
|
||||
|
||||
// F3: package-mcp and package-npm's job definitions (including the very
|
||||
// detect step this script's output feeds) moved into bazel.yml, so a PR that
|
||||
// edits only bazel.yml's package-gate logic must still self-trigger both
|
||||
// gates the same way editing pr.yml/main.yml/pr-risk.yml does; otherwise a
|
||||
// change to the job that runs the gates could ship without the gates having
|
||||
// run against it. No other policy test reads this script's content.
|
||||
func TestDetectPackageGatesCoversBazelWorkflow(t *testing.T) {
|
||||
root := sourceRepoRoot(t)
|
||||
script := readPolicyFile(t, root, "scripts/ci/detect-package-gates.sh")
|
||||
re := regexp.MustCompile(`(?s)scripts/ci/detect-package-gates\.sh\|[^)]*\)\s*\n\s*mcp_package=true\s*\n\s*npm_package=true`)
|
||||
loc := re.FindString(script)
|
||||
if loc == "" {
|
||||
t.Fatalf("scripts/ci/detect-package-gates.sh has no case arm forcing both mcp_package and npm_package true alongside its own path")
|
||||
}
|
||||
if !strings.Contains(loc, ".github/workflows/bazel.yml") {
|
||||
t.Errorf("scripts/ci/detect-package-gates.sh's both-gates case arm does not include .github/workflows/bazel.yml, where the package-mcp/package-npm job definitions now live")
|
||||
}
|
||||
}
|
||||
|
||||
// F3: the exact "same-repo PR, or merge_group" Blacksmith expression, pinned
|
||||
// once per job so a future edit cannot drift one copy from another. Reads no
|
||||
// repo variable, so the rollback is a plain revert. The rbe job's own
|
||||
// version additionally covers push, workflow_dispatch and schedule (never
|
||||
// forks); every other job below reads only merge_group and pull_request.
|
||||
func TestSameRepoBlacksmithRunners(t *testing.T) {
|
||||
want := map[string]map[string]string{
|
||||
"pr.yml": {"bazel-coverage": sameRepoBlacksmith2vcpu, "ci-gate": sameRepoBlacksmith2vcpu},
|
||||
"pr-risk.yml": {"bazel-coverage": sameRepoBlacksmith2vcpu, "ci-gate": sameRepoBlacksmith2vcpu, "detect-ci-tier": sameRepoBlacksmith2vcpu},
|
||||
bazelWorkflowName: {bazelRBEJobName: wantRBERunsOn},
|
||||
}
|
||||
for file, jobs := range want {
|
||||
workflow := readCIWorkflow(t, file)
|
||||
for name, wantRunsOn := range jobs {
|
||||
job, ok := workflow.Jobs[name]
|
||||
if !ok {
|
||||
t.Fatalf("%s has no %s job", file, name)
|
||||
}
|
||||
if job.RunsOn != wantRunsOn {
|
||||
t.Errorf("%s %s runs-on = %q, want %q", file, name, job.RunsOn, wantRunsOn)
|
||||
}
|
||||
}
|
||||
}
|
||||
// No other job in pr.yml or pr-risk.yml may name a Blacksmith label: F4
|
||||
// adds one more (not in this slice's scope), but nothing here should.
|
||||
for _, file := range []string{"pr.yml", "pr-risk.yml"} {
|
||||
workflow := readCIWorkflow(t, file)
|
||||
allowed := want[file]
|
||||
for name, job := range workflow.Jobs {
|
||||
if allowed[name] != "" {
|
||||
continue
|
||||
}
|
||||
if strings.Contains(job.RunsOn, "blacksmith-") {
|
||||
t.Errorf("%s job %s runs-on %q names a Blacksmith label; only %v may", file, name, job.RunsOn, allowed)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
type bazelWorkflowCall struct {
|
||||
Inputs map[string]struct {
|
||||
Type string `yaml:"type"`
|
||||
|
|
@ -2135,7 +2277,13 @@ func TestBazelLaneIsGatedAlongsideLegacy(t *testing.T) {
|
|||
wantBazelIDs = append(wantBazelIDs, r.retiredID)
|
||||
}
|
||||
for lane, id := range bazelLaneGateIDs {
|
||||
wantBazelIDs = append(wantBazelIDs, id)
|
||||
// F3: package-mcp/package-npm's ids (PACKAGE_MCP, PACKAGE_NPM) do not
|
||||
// follow the "BAZEL" naming convention the prefix filter below
|
||||
// groups by - they predate bazel.yml and keep their names - so they
|
||||
// are checked here but excluded from wantBazelIDs.
|
||||
if !bazelPackageJobs[lane] {
|
||||
wantBazelIDs = append(wantBazelIDs, id)
|
||||
}
|
||||
if want := "${{ needs.bazel.outputs." + lane + " || 'skipped' }}"; evaluate.Env[id] != want {
|
||||
t.Errorf("ci-gate env %s = %q, want %q", id, evaluate.Env[id], want)
|
||||
}
|
||||
|
|
@ -2291,6 +2439,14 @@ func bazelLaneRunModes(t *testing.T, lane, ifExpr string, with map[string]string
|
|||
return map[string]bool{}
|
||||
}
|
||||
return map[string]bool{"remote": true, "cache": true}
|
||||
case bazelPackageGatesIf:
|
||||
// F3: unlike every other lane, these two never skip because of the
|
||||
// rbe job's decision - only because the caller turned them off
|
||||
// entirely (pr.yml always passes "on").
|
||||
if strings.EqualFold(with["package-gates"], "on") {
|
||||
return map[string]bool{"remote": true, "cache": true, "local": true, "skip": true}
|
||||
}
|
||||
return map[string]bool{}
|
||||
}
|
||||
t.Fatalf("%s if = %q: teach bazelLaneRunModes which modes run it", lane, ifExpr)
|
||||
return nil
|
||||
|
|
@ -2424,6 +2580,13 @@ func TestBazelGateSimulation(t *testing.T) {
|
|||
var wantSkips []string
|
||||
anyRuns := false
|
||||
for lane, modes := range lanes {
|
||||
// F3: bazel-gate.sh's skip list and its BAZEL aggregate are
|
||||
// mode-derived only; it has never heard of package-mcp/npm
|
||||
// (their own PACKAGE_MCP/PACKAGE_NPM scenarios are exercised
|
||||
// below, by lane, not through this script).
|
||||
if bazelPackageJobs[lane] {
|
||||
continue
|
||||
}
|
||||
if modes[mode] {
|
||||
anyRuns = true
|
||||
} else if id, gated := bazelLaneGateIDs[lane]; gated {
|
||||
|
|
@ -2697,6 +2860,7 @@ func TestBazelWorkflowActionsArePinned(t *testing.T) {
|
|||
}
|
||||
want := map[string]string{
|
||||
setupNodeActionFamily: setupNodeSHA,
|
||||
setupPythonActionFamily: setupPythonSHA,
|
||||
"actions/checkout": checkoutSHA,
|
||||
setupGoActionFamily: setupGoSHA,
|
||||
cacheRestoreActionFamily: cacheSHA,
|
||||
|
|
@ -3975,9 +4139,13 @@ func TestBazelWorkflowSecretsAndFailureSurface(t *testing.T) {
|
|||
func TestBazelRBEJobDecidesOnce(t *testing.T) {
|
||||
workflow := readCIWorkflow(t, bazelWorkflowName)
|
||||
job := workflow.job(t, bazelRBEJobName)
|
||||
if len(job.Needs) != 0 || job.If != "" || job.RunsOn != "ubuntu-latest" || len(job.Env) != 0 {
|
||||
t.Errorf("%s: needs %v, if %q, runs-on %q, env %v; want no needs, if or env, on ubuntu-latest",
|
||||
bazelRBEJobName, job.Needs, job.If, job.RunsOn, job.Env)
|
||||
// F3: runs-on picks the *venue* (Blacksmith for trusted same-repo PRs,
|
||||
// ubuntu-latest otherwise) - a separate concern from the RBE mode
|
||||
// decision (remote/cache/local/skip), which still lives solely in the
|
||||
// decide step's outputs below.
|
||||
if len(job.Needs) != 0 || job.If != "" || job.RunsOn != wantRBERunsOn || len(job.Env) != 0 {
|
||||
t.Errorf("%s: needs %v, if %q, runs-on %q, env %v; want no needs, if or env, on %q",
|
||||
bazelRBEJobName, job.Needs, job.If, job.RunsOn, job.Env, wantRBERunsOn)
|
||||
}
|
||||
wantOutputs := map[string]string{
|
||||
"enabled": "${{ steps.decide.outputs.enabled }}",
|
||||
|
|
@ -4032,6 +4200,14 @@ func TestBazelRBEJobDecidesOnce(t *testing.T) {
|
|||
if key || !rederive.MatchString(value) || strings.HasPrefix(path, ".jobs."+bazelRBEJobName+".steps[0].env.") {
|
||||
return
|
||||
}
|
||||
// F3: the rbe job's own runs-on picks a runner venue (Blacksmith vs
|
||||
// ubuntu-latest) for trusted same-repo PRs; it shares some of the
|
||||
// same trust predicates (github.actor, dependabot) as the mode
|
||||
// decision but decides something else entirely (where the decide
|
||||
// step runs, not what it decides) - not a re-derivation of mode.
|
||||
if path == ".jobs."+bazelRBEJobName+".runs-on" {
|
||||
return
|
||||
}
|
||||
// The checkout opt-in for fork code (TestBazelWorkflowForkFarmInputs
|
||||
// pins it): a checkout input, not an execution-mode decision.
|
||||
if value == bazelAllowUnsafeCheckout && strings.HasSuffix(path, ".with.allow-unsafe-pr-checkout") {
|
||||
|
|
|
|||
|
|
@ -26,18 +26,12 @@ import (
|
|||
|
||||
const (
|
||||
// The legacy jobs' if: not covered.
|
||||
prLaneLegacyIf = "needs." + prRiskCoverageJobName + ".outputs.pr_lanes != 'true'"
|
||||
// The package gates: they run whenever detection and the decision did,
|
||||
// on build-artifacts' bd, or on Bazel's where build-artifacts stood down.
|
||||
prPackageGateIf = "${{ !cancelled() && needs.detect-package-gates.result == 'success' && needs." + prRiskCoverageJobName +
|
||||
".result == 'success' && (needs." + prRiskCoverageJobName + ".outputs.pr_lanes == 'true' || needs.build-artifacts.result == 'success') }}"
|
||||
prPackageGateArtifact = "${{ needs." + prRiskCoverageJobName + ".outputs.pr_lanes == 'true' && 'bazel-ci-build-artifacts' || 'ci-build-artifacts' }}"
|
||||
prFingerprintJob = "test-dolt-server-fingerprint"
|
||||
prFingerprintID = "TEST_DOLT_SERVER_FINGERPRINT"
|
||||
prAllowlistedStep = "Run the Go tests the Bazel lane skips"
|
||||
prScriptsChecksJob = "scripts-go-checks"
|
||||
prPackageBDCheck = "Check the Bazel-built bd exists"
|
||||
prScriptsChecksID = "SCRIPTS_GO_CHECKS"
|
||||
prLaneLegacyIf = "needs." + prRiskCoverageJobName + ".outputs.pr_lanes != 'true'"
|
||||
prFingerprintJob = "test-dolt-server-fingerprint"
|
||||
prFingerprintID = "TEST_DOLT_SERVER_FINGERPRINT"
|
||||
prAllowlistedStep = "Run the Go tests the Bazel lane skips"
|
||||
prScriptsChecksJob = "scripts-go-checks"
|
||||
prScriptsChecksID = "SCRIPTS_GO_CHECKS"
|
||||
// bazel.yml's lanes for the step add --config=sole-run in mode remote.
|
||||
bazelSoleRunEnv = "${{ needs.rbe.outputs.mode == 'remote' && '--config=sole-run' || '' }}"
|
||||
bazelSoleRunArg = `${BAZEL_SOLE_RUN:+"$BAZEL_SOLE_RUN"}`
|
||||
|
|
@ -45,9 +39,12 @@ const (
|
|||
bazelSoleRunEvictionLine = "test:sole-run --experimental_remote_cache_eviction_retries=0"
|
||||
)
|
||||
|
||||
// The package gates (consumers of build-artifacts' ci-build-artifacts that
|
||||
// keep running where it stands down).
|
||||
var prPackageGates = map[string]string{"package-mcp": "PACKAGE_MCP", "package-npm": "PACKAGE_NPM"}
|
||||
// F3: the package gates moved into bazel.yml (package-mcp, package-npm);
|
||||
// they depend only on the caller's package-gates input, not on
|
||||
// bazel-coverage's decision or build-artifacts (TestPackageGateJobs). This
|
||||
// map is only their CI_GATE_REQUIRED ids, for the gate-simulation scenarios
|
||||
// below (pr.yml no longer has jobs by these names).
|
||||
var prPackageGateIDs = map[string]string{"package-mcp": "PACKAGE_MCP", "package-npm": "PACKAGE_NPM"}
|
||||
|
||||
// Each retired job's needs, exactly.
|
||||
var prLaneLegacyNeeds = map[string][]string{
|
||||
|
|
@ -172,9 +169,10 @@ func prLegacyJobResult(job string, sc bazelGateScenario) string {
|
|||
return "skipped"
|
||||
}
|
||||
}
|
||||
if _, ok := prPackageGates[job]; ok && !decided {
|
||||
return "skipped"
|
||||
}
|
||||
// F3: package-mcp/package-npm are bazel.yml call outputs now
|
||||
// (needs.bazel.outputs.package-mcp), not pr.yml job results, so
|
||||
// runPRGateStep never calls this helper for them - they are simulated
|
||||
// through sc.outputs instead (see the scenario loop below).
|
||||
return "success"
|
||||
}
|
||||
|
||||
|
|
@ -211,25 +209,27 @@ func TestPRLegacyLanesDeferToBazelLanes(t *testing.T) {
|
|||
t.Errorf("pr.yml tier lanes = %v", tier.bazelLanes)
|
||||
}
|
||||
|
||||
// Only the retired jobs, the package gates and the gate read the
|
||||
// decision; only they and the gate need build-artifacts.
|
||||
// Only the retired jobs and the gate read the decision; only they and
|
||||
// the gate need build-artifacts. The package gates moved into bazel.yml
|
||||
// (F3) and never depend on this decision or on build-artifacts at all -
|
||||
// they build bd for themselves, via Bazel or a go build fallback
|
||||
// (TestPackageGateJobs).
|
||||
for name, job := range pr.Jobs {
|
||||
_, retired := tier.jobs[name]
|
||||
_, pkg := prPackageGates[name]
|
||||
if retired || pkg || name == "ci-gate" || name == prRiskCoverageJobName {
|
||||
if retired || name == "ci-gate" || name == prRiskCoverageJobName {
|
||||
continue
|
||||
}
|
||||
if strings.Contains(job.If, prRiskCoverageJobName) || contains(job.Needs, prRiskCoverageJobName) {
|
||||
t.Errorf("%s depends on %s; only the retired jobs and the package gates may", name, prRiskCoverageJobName)
|
||||
t.Errorf("%s depends on %s; only the retired jobs may", name, prRiskCoverageJobName)
|
||||
}
|
||||
if contains(job.Needs, "build-artifacts") {
|
||||
t.Errorf("%s needs build-artifacts, which stands down on covered PRs; take the artifact like the package gates do", name)
|
||||
t.Errorf("%s needs build-artifacts, which stands down on covered PRs", name)
|
||||
}
|
||||
}
|
||||
|
||||
// Artifact consumers: the retired jobs read build-artifacts' artifact
|
||||
// (they only run where it does); the package gates read Bazel's where
|
||||
// it stood down. Nothing downloads by pattern or without a name.
|
||||
// Artifact consumers: only the retired jobs read build-artifacts'
|
||||
// artifact (they only run where it does). Nothing downloads by pattern
|
||||
// or without a name.
|
||||
for name, job := range pr.Jobs {
|
||||
for _, step := range job.Steps {
|
||||
if !strings.HasPrefix(step.Uses, "actions/download-artifact@") {
|
||||
|
|
@ -243,51 +243,15 @@ func TestPRLegacyLanesDeferToBazelLanes(t *testing.T) {
|
|||
if !strings.Contains(art, "ci-build-artifacts") {
|
||||
continue
|
||||
}
|
||||
_, retired := tier.jobs[name]
|
||||
_, pkg := prPackageGates[name]
|
||||
switch {
|
||||
case retired && art == "ci-build-artifacts":
|
||||
case pkg && art == prPackageGateArtifact:
|
||||
default:
|
||||
t.Errorf("%s downloads %q; only the retired jobs (ci-build-artifacts) and the package gates (%s) may", name, art, prPackageGateArtifact)
|
||||
if _, retired := tier.jobs[name]; !retired || art != "ci-build-artifacts" {
|
||||
t.Errorf("%s downloads %q; only the retired jobs (ci-build-artifacts) may", name, art)
|
||||
}
|
||||
if step.With["path"] != "ci-build-artifacts" {
|
||||
t.Errorf("%s downloads into %q, want ci-build-artifacts (the layout its steps read)", name, step.With["path"])
|
||||
}
|
||||
}
|
||||
}
|
||||
for name, id := range prPackageGates {
|
||||
job := pr.job(t, name)
|
||||
want := []string{"detect-package-gates", "build-artifacts", prRiskCoverageJobName, "bazel"}
|
||||
if job.If != prPackageGateIf || !reflect.DeepEqual([]string(job.Needs), want) {
|
||||
t.Errorf("%s: if %q, needs %v; want if %q, needs %v", name, job.If, job.Needs, prPackageGateIf, want)
|
||||
}
|
||||
if dl := job.step(t, "Download build artifacts"); dl.With["name"] != prPackageGateArtifact {
|
||||
t.Errorf("%s downloads %q, want %q", name, dl.With["name"], prPackageGateArtifact)
|
||||
}
|
||||
if v := job.step(t, "Verify build artifacts").Run; !strings.Contains(v, "sha256sum -c SHA256SUMS") || !strings.Contains(v, "chmod +x bd-linux-gms-pure") {
|
||||
t.Errorf("%s no longer verifies the artifact:\n%s", name, v)
|
||||
}
|
||||
if !contains(required, id) {
|
||||
t.Errorf("ci-gate does not require %s", id)
|
||||
}
|
||||
// Review L2: with the farm off (mode skip) on a covered PR, say why
|
||||
// there is no bd before the download fails on a missing artifact.
|
||||
check := job.step(t, prPackageBDCheck)
|
||||
if check.If != "steps.applicability.outputs.run == 'true' && needs."+prRiskCoverageJobName+".outputs.pr_lanes == 'true'" ||
|
||||
!reflect.DeepEqual(check.Env, map[string]string{"BAZEL_RBE_MODE": "${{ needs.bazel.outputs.rbe-mode }}"}) || check.ContinueOnError != nil ||
|
||||
job.stepIndex(t, prPackageBDCheck) > job.stepIndex(t, "Download build artifacts") {
|
||||
t.Errorf("%s step %q: if %q, env %v; want it before the download, on covered applicable runs, reading the call's mode", name, prPackageBDCheck, check.If, check.Env)
|
||||
}
|
||||
for mode, wantOK := range map[string]bool{"remote": true, "skip": false, "cache": false, "local": false, "": false} {
|
||||
cmd := exec.Command("bash", "--noprofile", "--norc", "-eo", "pipefail", "-c", check.Run)
|
||||
cmd.Env = []string{"PATH=" + os.Getenv("PATH"), "BAZEL_RBE_MODE=" + mode}
|
||||
out, err := cmd.CombinedOutput()
|
||||
if (err == nil) != wantOK || (!wantOK && !(strings.Contains(string(out), "::error::") && strings.Contains(string(out), "BAZEL_PR_LANES_RETIRED"))) {
|
||||
t.Errorf("%s bd check in mode %q: ok %v, want %v\n%s", name, mode, err == nil, wantOK, out)
|
||||
}
|
||||
}
|
||||
}
|
||||
testPackageGateJobs(t, required)
|
||||
// Bazel's artifact: bazel-test publishes it (always, after its tests)
|
||||
// under the name pr.yml passes, with build-artifacts' layout
|
||||
// (TestBazelWorkflowPublishesBuildArtifacts).
|
||||
|
|
@ -353,17 +317,25 @@ func TestPRLegacyLanesDeferToBazelLanes(t *testing.T) {
|
|||
for _, res := range []string{"skipped", "failure", "cancelled"} {
|
||||
for _, job := range []string{prFingerprintJob, "package-mcp", "package-npm", "pr-preflight-platforms", prScriptsChecksJob} {
|
||||
sc := prGateFor(t, lanes, "pull_request", "remote", cov(c))
|
||||
sc.results = map[string]string{job: res}
|
||||
// F3: package-mcp/package-npm are bazel.yml call outputs
|
||||
// (needs.bazel.outputs.package-mcp), not pr.yml job
|
||||
// results, so the gate simulation overrides sc.outputs for
|
||||
// them instead of sc.results.
|
||||
if _, pkg := prPackageGateIDs[job]; pkg {
|
||||
sc.outputs[job] = res
|
||||
} else {
|
||||
sc.results = map[string]string{job: res}
|
||||
}
|
||||
id := map[string]string{prFingerprintJob: prFingerprintID, "pr-preflight-platforms": "PR_PREFLIGHT_PLATFORMS", prScriptsChecksJob: prScriptsChecksID}[job]
|
||||
if id == "" {
|
||||
id = prPackageGates[job]
|
||||
id = prPackageGateIDs[job]
|
||||
}
|
||||
add(fmt.Sprintf("covered=%s, %s %s", c, job, res), sc, false, id)
|
||||
}
|
||||
}
|
||||
}
|
||||
// A failed decision: the retired jobs and the package gates skip
|
||||
// through needs, and the gate is red.
|
||||
// A failed decision: the retired jobs skip through needs (the package
|
||||
// gates do not depend on the decision at all, F3), and the gate is red.
|
||||
for _, res := range []string{"failure", "cancelled", "skipped"} {
|
||||
sc := prGateFor(t, lanes, "pull_request", "remote", cov(""))
|
||||
sc.coverage = res
|
||||
|
|
@ -391,6 +363,128 @@ func sortedKeys[V any](m map[string]V) []string {
|
|||
return out
|
||||
}
|
||||
|
||||
// F3: the package gates (bazel.yml's package-mcp, package-npm). They depend
|
||||
// only on the caller turning package-gates on (never on bazel-coverage or
|
||||
// build-artifacts: TestPRLegacyLanesDeferToBazelLanes already checked that
|
||||
// nothing but the retired jobs reads either), build bd for themselves - via
|
||||
// the Bazel lane's binary when the farm is up, a go build fallback
|
||||
// otherwise (package-mcp.sh/package-npm.sh's prepare_bd_binary) - and are
|
||||
// structurally identical apart from their language setup and `make` target.
|
||||
// Their runs-on/if/needs/result-recorder are already pinned for every
|
||||
// bazel.yml job by TestBazelWorkflowJobsAndExecutionMode and
|
||||
// TestBazelLaneIsGatedAlongsideLegacy; this test pins the step-by-step
|
||||
// detail those generic checks do not.
|
||||
func testPackageGateJobs(t *testing.T, prGateRequired []string) {
|
||||
t.Helper()
|
||||
workflow := readCIWorkflow(t, bazelWorkflowName)
|
||||
type pkgLane struct {
|
||||
job, detectOutput, langStepName, makeTarget string
|
||||
}
|
||||
lanes := []pkgLane{
|
||||
{bazelPackageMCPJobName, "mcp_package", "Set up Python", "make ci-package-mcp"},
|
||||
{bazelPackageNPMJobName, "npm_package", "Set up Node.js", "make ci-package-npm"},
|
||||
}
|
||||
for _, lane := range lanes {
|
||||
id := bazelLaneGateIDs[lane.job]
|
||||
if !contains(prGateRequired, id) {
|
||||
t.Errorf("ci-gate does not require %s (%s)", lane.job, id)
|
||||
}
|
||||
job, ok := workflow.Jobs[lane.job]
|
||||
if !ok {
|
||||
t.Fatalf("%s has no %s job", bazelWorkflowName, lane.job)
|
||||
}
|
||||
if !reflect.DeepEqual([]string(job.Needs), []string{bazelRBEJobName}) || job.If != bazelPackageGatesIf || job.RunsOn != bazelPackageRunsOn {
|
||||
t.Errorf("%s: needs %v, if %q, runs-on %q; want needs [%s], if %q, runs-on %q",
|
||||
lane.job, job.Needs, job.If, job.RunsOn, bazelRBEJobName, bazelPackageGatesIf, bazelPackageRunsOn)
|
||||
}
|
||||
|
||||
detectCond := "steps.detect.outputs." + lane.detectOutput + " == 'true'"
|
||||
detectIf := "${{ " + detectCond + " }}"
|
||||
bazelPathIf := "${{ " + detectCond + " && needs." + bazelRBEJobName + ".outputs.enabled == 'true' }}"
|
||||
fallbackIf := "${{ " + detectCond + " && needs." + bazelRBEJobName + ".outputs.enabled != 'true' }}"
|
||||
wantNames := []string{
|
||||
"", // checkout (no name)
|
||||
"Decide applicability",
|
||||
"Set up Bazel",
|
||||
"bazel build //cmd/bd:bd_for_tests",
|
||||
"Package the Bazel-built bd",
|
||||
"Set up Go",
|
||||
"Restore Go module cache",
|
||||
"Verify Go modules",
|
||||
"Restore non-race Go build cache",
|
||||
lane.langStepName,
|
||||
}
|
||||
if lane.job == bazelPackageMCPJobName {
|
||||
wantNames = append(wantNames, "Install uv")
|
||||
}
|
||||
wantNames = append(wantNames, "Run "+map[string]string{bazelPackageMCPJobName: "MCP", bazelPackageNPMJobName: "npm"}[lane.job]+" package gate", "Record job result")
|
||||
|
||||
var gotNames []string
|
||||
for _, s := range job.Steps {
|
||||
gotNames = append(gotNames, s.Name)
|
||||
}
|
||||
if !reflect.DeepEqual(gotNames, wantNames) {
|
||||
t.Errorf("%s step names = %q, want %q", lane.job, gotNames, wantNames)
|
||||
}
|
||||
|
||||
checkout := job.Steps[0]
|
||||
if checkout.Uses != "actions/checkout@"+checkoutSHA || checkout.With["fetch-depth"] != "0" {
|
||||
t.Errorf("%s checkout = %+v; want fetch-depth 0 (detect-package-gates.sh diffs full history)", lane.job, checkout)
|
||||
}
|
||||
|
||||
detect := job.step(t, "Decide applicability")
|
||||
wantDetectEnv := map[string]string{
|
||||
"PR_BASE_SHA": "${{ github.event.pull_request.base.sha }}",
|
||||
"PR_HEAD_SHA": "${{ github.event.pull_request.head.sha }}",
|
||||
"PUSH_BEFORE_SHA": "${{ github.event.before }}",
|
||||
"PUSH_AFTER_SHA": "${{ github.sha }}",
|
||||
}
|
||||
if detect.ID != "detect" || detect.Run != "./scripts/ci/detect-package-gates.sh" || !reflect.DeepEqual(detect.Env, wantDetectEnv) {
|
||||
t.Errorf("%s detect step: id %q, run %q, env %v; want id detect, run ./scripts/ci/detect-package-gates.sh, env %v",
|
||||
lane.job, detect.ID, detect.Run, detect.Env, wantDetectEnv)
|
||||
}
|
||||
|
||||
// The Bazel-built-bd path: gated on the farm being up, in addition
|
||||
// to detection. No --config=ci (only test:ci exists).
|
||||
buildStep := job.step(t, "bazel build //cmd/bd:bd_for_tests")
|
||||
if buildStep.If != bazelPathIf || buildStep.Run != `bazel build //cmd/bd:bd_for_tests --remote_download_regex='.*/bin/cmd/bd/bd_for_tests/bd$'` {
|
||||
t.Errorf("%s bazel build step: if %q, run %q; want if %q", lane.job, buildStep.If, buildStep.Run, bazelPathIf)
|
||||
}
|
||||
pkgBD := job.step(t, "Package the Bazel-built bd")
|
||||
if pkgBD.If != bazelPathIf || !strings.Contains(pkgBD.Run, `./scripts/ci/package-bazel-bd.sh "$RUNNER_TEMP/bd-artifacts"`) ||
|
||||
!strings.Contains(pkgBD.Run, "BEADS_TEST_BD_BINARY=$RUNNER_TEMP/bd-artifacts/bd-linux-gms-pure") {
|
||||
t.Errorf("%s package-the-Bazel-built-bd step: if %q, run %q", lane.job, pkgBD.If, pkgBD.Run)
|
||||
}
|
||||
setupBazel := job.step(t, "Set up Bazel")
|
||||
if setupBazel.If != bazelPathIf || setupBazel.Uses != "./"+setupBazelActionDir {
|
||||
t.Errorf("%s Set up Bazel: if %q, uses %q; want if %q", lane.job, setupBazel.If, setupBazel.Uses, bazelPathIf)
|
||||
}
|
||||
|
||||
// The go-build-fallback path: gated on detection and the farm being
|
||||
// down; it restores caches but never sets BEADS_TEST_BD_BINARY, so
|
||||
// prepare_bd_binary() falls back to `go build`.
|
||||
for _, name := range []string{"Set up Go", "Restore Go module cache", "Verify Go modules", "Restore non-race Go build cache"} {
|
||||
if st := job.step(t, name); st.If != fallbackIf {
|
||||
t.Errorf("%s step %q: if %q, want %q", lane.job, name, st.If, fallbackIf)
|
||||
}
|
||||
}
|
||||
|
||||
// The language setup and the gate command run whenever detection
|
||||
// did, whichever bd path provided the binary.
|
||||
if st := job.step(t, lane.langStepName); st.If != detectIf {
|
||||
t.Errorf("%s step %q: if %q, want %q", lane.job, lane.langStepName, st.If, detectIf)
|
||||
}
|
||||
gateName := "Run " + map[string]string{bazelPackageMCPJobName: "MCP", bazelPackageNPMJobName: "npm"}[lane.job] + " package gate"
|
||||
gate := job.step(t, gateName)
|
||||
if gate.If != detectIf || gate.Run != lane.makeTarget {
|
||||
t.Errorf("%s gate step: if %q, run %q; want if %q, run %q", lane.job, gate.If, gate.Run, detectIf, lane.makeTarget)
|
||||
}
|
||||
if job.stepIndex(t, gateName) != len(job.Steps)-2 {
|
||||
t.Errorf("%s gate step is not the last step before the result recorder", lane.job)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// The Dolt server fingerprint (container image vs the pinned dolt CLI the
|
||||
// Bazel dolt-server lanes start) runs on every PR in its own required job,
|
||||
// whatever bazel-coverage says, and nowhere else in pr.yml.
|
||||
|
|
|
|||
|
|
@ -271,9 +271,12 @@ func workflowEnv(t *testing.T, name string) map[string]string {
|
|||
func TestPRRiskBazelCoverageJob(t *testing.T) {
|
||||
risk := readCIWorkflow(t, prRiskWorkflowName)
|
||||
job := risk.job(t, prRiskCoverageJobName)
|
||||
if len(job.Needs) != 0 || job.If != "" || job.RunsOn != "ubuntu-latest" || len(job.Env) != 0 || job.ContinueOnError || job.TimeoutMinutes == 0 {
|
||||
t.Errorf("%s: needs %v, if %q, runs-on %q, env %v, continue-on-error %v, timeout %d; want no needs, if, env or continue-on-error, ubuntu-latest, a timeout",
|
||||
prRiskCoverageJobName, job.Needs, job.If, job.RunsOn, job.Env, job.ContinueOnError, job.TimeoutMinutes)
|
||||
// F3: this job moved to Blacksmith for same-repo PRs (and merge_group);
|
||||
// forks and Dependabot stay on ubuntu-latest (TestSameRepoBlacksmithRunners
|
||||
// pins the same literal for pr.yml's copy).
|
||||
if len(job.Needs) != 0 || job.If != "" || job.RunsOn != sameRepoBlacksmith2vcpu || len(job.Env) != 0 || job.ContinueOnError || job.TimeoutMinutes == 0 {
|
||||
t.Errorf("%s: needs %v, if %q, runs-on %q, env %v, continue-on-error %v, timeout %d; want no needs, if, env or continue-on-error, on %q, a timeout",
|
||||
prRiskCoverageJobName, job.Needs, job.If, job.RunsOn, job.Env, job.ContinueOnError, job.TimeoutMinutes, sameRepoBlacksmith2vcpu)
|
||||
}
|
||||
wantOutputs := map[string]string{}
|
||||
wantEnv := map[string]string{"PULL_REQUEST": prRiskPullRequestValue, "DEPENDABOT": prRiskDependabotValue}
|
||||
|
|
@ -332,6 +335,15 @@ func TestPRRiskBazelCoverageJob(t *testing.T) {
|
|||
if secretRef.MatchString(value) {
|
||||
t.Errorf("%s: %s reads secrets (%q); PR Risk needs none", prRiskWorkflowName, path, value)
|
||||
}
|
||||
// F3: detect-ci-tier/bazel-coverage/ci-gate's own runs-on picks a
|
||||
// runner venue (Blacksmith vs ubuntu-latest) for trusted same-repo
|
||||
// PRs; it shares some predicates (github.actor, dependabot,
|
||||
// head.repo.full_name) with the coverage decision but decides
|
||||
// something else entirely - not a re-derivation of the decision
|
||||
// (TestSameRepoBlacksmithRunners pins the literal).
|
||||
if strings.HasSuffix(path, ".runs-on") && value == sameRepoBlacksmith2vcpu {
|
||||
return
|
||||
}
|
||||
if facts.MatchString(value) && !strings.HasPrefix(path, stepEnv) && !strings.HasPrefix(path, ".jobs."+prRiskCoverageJobName+".steps[0].run") {
|
||||
t.Errorf("%s: %s re-derives the Bazel coverage decision (%q); read needs.%s.outputs", prRiskWorkflowName, path, value, prRiskCoverageJobName)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue