Skip to content

Commit 130bda2

Browse files
committed
test(ci): close release admission credential and fixture gaps
Pin split dispatch and fixture identities, add credential-withdrawal controls, and retain immutable legacy inputs. Require repository-bound uploads and main-only OIDC callers while preserving four-step smoke compatibility.
1 parent 5cd4d55 commit 130bda2

5 files changed

Lines changed: 1484 additions & 25 deletions

File tree

‎scripts/ci_preflight.py‎

Lines changed: 33 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3656,6 +3656,30 @@ def release_prebuilt_consumer_findings(source: str) -> list[str]:
36563656

36573657
# Split release publication keeps the existing main-tree writer and hub
36583658
# dispatch bodies. These are step contracts, not a fixture hash or execution.
3659+
RELEASE_SPLIT_DISPATCH = '''on:
3660+
workflow_dispatch:
3661+
inputs:
3662+
bump:
3663+
description: 'Version bump'
3664+
required: true
3665+
type: choice
3666+
default: patch
3667+
options:
3668+
- patch
3669+
- minor
3670+
- major
3671+
override:
3672+
description: 'Exact version, X.Y.Z or X.Y.Z-rc.N (for example 1.0.0-rc.1); wins over bump'
3673+
required: false
3674+
type: string
3675+
default: ''
3676+
dry_run:
3677+
description: 'Rehearse: build and verify the tarballs; commit, tag, release, upload and dispatch nothing'
3678+
required: false
3679+
type: boolean
3680+
default: false
3681+
'''
3682+
36593683
RELEASE_SPLIT_RELEASE_STEPS = r''' - name: Mint org App token
36603684
id: app
36613685
uses: actions/create-github-app-token@d72941d797fd3113feb6b93fd0dec494b13a2547 # v1.12.0
@@ -3923,7 +3947,7 @@ def release_prebuilt_consumer_findings(source: str) -> list[str]:
39233947
# run_id}. -F sends prerelease as a JSON boolean and run_id as a
39243948
# number. The hub never publishes a prerelease to its stable or
39253949
# `latest` channels and pairs the engine with codegen of the same
3926-
# version (lane REL10-HUB).
3950+
# version.
39273951
- name: Dispatch engine-release -> pineforge-release
39283952
env:
39293953
GH_TOKEN: ${{ steps.app.outputs.token }}
@@ -3953,7 +3977,7 @@ def release_prebuilt_consumer_findings(source: str) -> list[str]:
39533977
prerelease: ${{ steps.bump.outputs.prerelease }}
39543978
''',
39553979
'prebuilt-x86': ''' needs: release
3956-
if: ${{ github.event_name == 'workflow_dispatch' && (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v')) && github.workflow_ref == format('pineforge-4pass/pineforge-engine/.github/workflows/release.yml@{0}', github.ref) }}
3980+
if: ${{ github.event_name == 'workflow_dispatch' && github.ref == 'refs/heads/main' && github.workflow_ref == format('pineforge-4pass/pineforge-engine/.github/workflows/release.yml@{0}', github.ref) }}
39573981
runs-on: ubuntu-24.04
39583982
permissions:
39593983
contents: read
@@ -3992,7 +4016,7 @@ def release_prebuilt_consumer_findings(source: str) -> list[str]:
39924016
run: |
39934017
set -euo pipefail
39944018
[[ "${EVENT}" == workflow_dispatch ]]
3995-
case "${REF}" in refs/heads/main|refs/tags/v*) ;; *) exit 1 ;; esac
4019+
case "${REF}" in refs/heads/main) ;; *) exit 1 ;; esac
39964020
[[ "${WORKFLOW_REF}" == "pineforge-4pass/pineforge-engine/.github/workflows/release.yml@${REF}" ]]
39974021
'''
39984022

@@ -4111,6 +4135,7 @@ def release_prebuilt_consumer_findings(source: str) -> list[str]:
41114135
if: ${{ !inputs.dry_run }}
41124136
env:
41134137
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
4138+
GH_REPO: ${{ github.repository }}
41144139
TAG: ${{ needs.release.outputs.tag }}
41154140
X86_TARBALL: ${{ needs.prebuilt-x86.outputs.tarball }}
41164141
ARM_TARBALL: ${{ needs.prebuilt-arm.outputs.tarball }}
@@ -4208,6 +4233,7 @@ def _release_split_toolchain_reader_is_pinned(workflow: str, body: str) -> bool:
42084233
or len(_JOB_HEADER.findall(_jobs_text(workflow) or '')) != len(jobs)
42094234
or _unparsed(workflow)
42104235
or _events(workflow) != {'workflow_dispatch'}
4236+
or _job_block(workflow, 'on') != _code(RELEASE_SPLIT_DISPATCH)
42114237
or _job_values(workflow, 'permissions') != ['contents: read']
42124238
or _job_values(workflow, 'env') != ['PINEFORGE_REQUIRE_RELEASE_TAGS: "1"']
42134239
or _job_values(workflow, 'defaults')
@@ -4227,6 +4253,10 @@ def _release_split_workflow_findings(workflow: str) -> list[str]:
42274253
or _unparsed(workflow)):
42284254
findings.append('release.yml split prebuilt must contain exactly release, prebuilt-x86, '
42294255
'prebuilt-arm, upload and notify-hub jobs')
4256+
if (_events(workflow) != {'workflow_dispatch'}
4257+
or _job_block(workflow, 'on') != _code(RELEASE_SPLIT_DISPATCH)):
4258+
findings.append('release.yml split prebuilt must retain exactly its workflow_dispatch '
4259+
'trigger and reviewed inputs')
42304260
if (_events(workflow) != {'workflow_dispatch'}
42314261
or _job_values(workflow, 'permissions') != ['contents: read']
42324262
or _job_values(workflow, 'env') != ['PINEFORGE_REQUIRE_RELEASE_TAGS: "1"']

0 commit comments

Comments
 (0)