mirror of
https://github.com/garrytan/gstack.git
synced 2026-11-14 04:17:33 +01:00
ci: blobless clones on the PR and train path, fail-loud history reads (GSTA-203 PR 5)
Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
This commit is contained in:
1 parent
5ba425af4b
commit
6b81b1caf6
11 files changed
+442
-17
No files matched your search
@@ -45,11 +45,12 @@ jobs:
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
# Read with git and jq only: without a train block nothing below runs.
|
||||
# Read with git and jq only (history-read.sh is git alone): without a train block nothing below runs.
|
||||
- name: Read the train policy (main)
|
||||
id: policy
|
||||
run: |
|
||||
train=$(git show "${GITHUB_SHA}:.gstack/ship-policy.json" 2>/dev/null | jq -c 'if (.train | type) == "object" then .train else null end' 2>/dev/null || true)
|
||||
policy=$(bash .github/scripts/history-read.sh "$GITHUB_SHA" .gstack/ship-policy.json --absent null)
|
||||
train=$(jq -c 'if (.train | type) == "object" then .train else null end' <<<"$policy") || { echo "::error::${GITHUB_SHA}:.gstack/ship-policy.json is not valid JSON; fix the policy file" >&2; exit 1; }
|
||||
if [ -z "$train" ] || [ "$train" = null ]; then
|
||||
echo "train=false" >> "$GITHUB_OUTPUT"
|
||||
echo "- Backstop inert: main's .gstack/ship-policy.json declares no train block; per-PR gates cover main" >> "$GITHUB_STEP_SUMMARY"
|
||||
|
||||
@@ -179,13 +179,14 @@ jobs:
|
||||
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
|
||||
with:
|
||||
fetch-depth: 0
|
||||
filter: blob:none
|
||||
persist-credentials: false
|
||||
|
||||
- uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 # v2
|
||||
with:
|
||||
bun-version: 1.4.2
|
||||
|
||||
# Read with git and jq only: no repository code decides whether PR pushes start paid work.
|
||||
# Read with git and jq only (history-read.sh is git alone): no repository code decides whether PR pushes start paid work.
|
||||
- name: Read the train policy (base revision)
|
||||
id: policy
|
||||
env:
|
||||
@@ -193,9 +194,10 @@ jobs:
|
||||
DEFAULT_BRANCH: ${{ github.event.repository.default_branch }}
|
||||
run: |
|
||||
base="${BASE_SHA:-origin/${DEFAULT_BRANCH}}"
|
||||
train=$(git show "${base}:.gstack/ship-policy.json" 2>/dev/null | jq -c 'if (.train | type) == "object" then .train else null end' 2>/dev/null || true)
|
||||
artifact=$(jq -r '.record_artifact // ""' <<<"${train:-null}" 2>/dev/null || true)
|
||||
check=$(jq -r '.full_gate_check // ""' <<<"${train:-null}" 2>/dev/null || true)
|
||||
policy=$(bash .github/scripts/history-read.sh "$base" .gstack/ship-policy.json --absent null)
|
||||
train=$(jq -c 'if (.train | type) == "object" then .train else null end' <<<"$policy") || { echo "::error::${base}:.gstack/ship-policy.json is not valid JSON; fix the policy file" >&2; exit 1; }
|
||||
artifact=$(jq -r '.record_artifact // ""' <<<"${train:-null}")
|
||||
check=$(jq -r '.full_gate_check // ""' <<<"${train:-null}")
|
||||
if [ -z "$train" ] || [ "$train" = null ]; then
|
||||
echo "train=false" >> "$GITHUB_OUTPUT"
|
||||
echo "- Train policy: none at ${base}; this run routes as before" >> "$GITHUB_STEP_SUMMARY"
|
||||
@@ -470,6 +472,7 @@ jobs:
|
||||
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
|
||||
with:
|
||||
fetch-depth: 0
|
||||
filter: blob:none
|
||||
persist-credentials: false
|
||||
|
||||
- uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 # v2
|
||||
@@ -528,6 +531,7 @@ jobs:
|
||||
# Preserve full history for merge-base diff selection. Moving the
|
||||
# planner off the eval image must not change its selection inputs.
|
||||
fetch-depth: 0
|
||||
filter: blob:none
|
||||
persist-credentials: false
|
||||
|
||||
- uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 # v2
|
||||
@@ -670,6 +674,7 @@ jobs:
|
||||
# shards on the lane's first live run ("ambiguous argument
|
||||
# 'main...HEAD'"). The manifest still governs WHICH shards run.
|
||||
fetch-depth: 0
|
||||
filter: blob:none
|
||||
persist-credentials: false
|
||||
|
||||
- name: Fix bun temp
|
||||
@@ -903,6 +908,7 @@ jobs:
|
||||
with:
|
||||
ref: ${{ inputs.screen_merge_sha }}
|
||||
fetch-depth: 0
|
||||
filter: blob:none
|
||||
persist-credentials: false
|
||||
|
||||
- name: Fix bun temp
|
||||
@@ -1029,6 +1035,7 @@ jobs:
|
||||
with:
|
||||
ref: ${{ fromJSON(needs.route.outputs.bisect_refs)[matrix.slice] }}
|
||||
fetch-depth: 0
|
||||
filter: blob:none
|
||||
persist-credentials: false
|
||||
|
||||
- name: Verify the prefix checkout
|
||||
@@ -1173,6 +1180,7 @@ jobs:
|
||||
# history of its prefix commits T1..Tk for the train record.
|
||||
ref: ${{ inputs.screen_merge_sha }}
|
||||
fetch-depth: ${{ needs.plan-slices.outputs.mode == 'train' && '0' || '1' }}
|
||||
filter: blob:none
|
||||
persist-credentials: false
|
||||
|
||||
- uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 # v2
|
||||
|
||||
@@ -65,8 +65,10 @@ jobs:
|
||||
with:
|
||||
persist-credentials: false
|
||||
# Full history: the seed ratchet compares the allowlist with its
|
||||
# merge-base copy, which a depth-1 checkout cannot read.
|
||||
# merge-base copy, which a depth-1 checkout cannot read. Blobless:
|
||||
# that copy is fetched on demand, and a failed read fails the ratchet.
|
||||
fetch-depth: 0
|
||||
filter: blob:none
|
||||
- uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 # v2
|
||||
with:
|
||||
bun-version: 1.4.2
|
||||
|
||||
@@ -23,6 +23,9 @@ jobs:
|
||||
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
|
||||
with:
|
||||
fetch-depth: 0
|
||||
# Blobless: full history with file contents fetched on demand; the
|
||||
# reads below fail loudly when a fetch fails (.github/scripts/history-read.sh).
|
||||
filter: blob:none
|
||||
ref: ${{ github.event.pull_request.head.sha }}
|
||||
# The head's release_tool runs inside the gate (lib/version-gate-train.ts);
|
||||
# no token may sit in the checkout it stages. The base fetch below is public.
|
||||
@@ -49,8 +52,12 @@ jobs:
|
||||
set -euo pipefail
|
||||
PR_VERSION=$(cat VERSION | tr -d '[:space:]')
|
||||
BASE_REF="${{ github.event.pull_request.base.ref }}"
|
||||
git fetch origin "$BASE_REF" --quiet || true
|
||||
BASE_VERSION=$(git show "origin/$BASE_REF:VERSION" 2>/dev/null | tr -d '[:space:]' || echo "0.0.0.0")
|
||||
for try in 1 2 3; do
|
||||
git fetch origin "$BASE_REF" --quiet && break
|
||||
if [ "$try" = 3 ]; then echo "::error::git fetch origin $BASE_REF failed 3 times ($(git --version)). Fix: see docs/troubleshooting.md#history-read-failed (HISTORY_READ_FAILED)"; exit 1; fi
|
||||
sleep $((try * 2))
|
||||
done
|
||||
BASE_VERSION=$(bash .version-gate/.github/scripts/history-read.sh "origin/$BASE_REF" VERSION --absent 0.0.0.0 | tr -d '[:space:]')
|
||||
{
|
||||
echo "pr_version=$PR_VERSION"
|
||||
echo "base_version=$BASE_VERSION"
|
||||
|
||||
Reference in new issue
Block a user