diff --git a/.gitea/workflows/ci-badge.yml b/.gitea/workflows/ci-badge.yml index 497da04..50e141a 100644 --- a/.gitea/workflows/ci-badge.yml +++ b/.gitea/workflows/ci-badge.yml @@ -13,6 +13,8 @@ concurrency: jobs: publish: runs-on: alkane-fast + container: + image: gitea.bluefla.re/blueflare/alkane-ci@sha256:43bd4048ac01dff914ffb02ce5f2a07be37b5b0512ada66423247aebc74f0732 permissions: actions: read contents: write diff --git a/.gitea/workflows/fast-pr.yml b/.gitea/workflows/fast-pr.yml index 760252e..8cd03d1 100644 --- a/.gitea/workflows/fast-pr.yml +++ b/.gitea/workflows/fast-pr.yml @@ -12,6 +12,8 @@ concurrency: jobs: source: runs-on: alkane-fast + container: + image: gitea.bluefla.re/blueflare/alkane-ci@sha256:43bd4048ac01dff914ffb02ce5f2a07be37b5b0512ada66423247aebc74f0732 env: CARGO_TARGET_DIR: target CARGO_BUILD_JOBS: 2 @@ -19,6 +21,8 @@ jobs: - uses: actions/checkout@v4 with: fetch-depth: 0 + - name: Check runner image pins + run: python3 ci/check-runner-image.py - name: Detect README-only change id: surface run: | diff --git a/.gitea/workflows/main.yml b/.gitea/workflows/main.yml index 56c4adc..52ab444 100644 --- a/.gitea/workflows/main.yml +++ b/.gitea/workflows/main.yml @@ -11,6 +11,8 @@ concurrency: jobs: verify-and-release: runs-on: alkane-ci + container: + image: gitea.bluefla.re/blueflare/alkane-ci@sha256:43bd4048ac01dff914ffb02ce5f2a07be37b5b0512ada66423247aebc74f0732 env: CARGO_TARGET_DIR: target permissions: diff --git a/.gitea/workflows/next.yml b/.gitea/workflows/next.yml index 1b7b789..173c452 100644 --- a/.gitea/workflows/next.yml +++ b/.gitea/workflows/next.yml @@ -11,6 +11,8 @@ concurrency: jobs: build: runs-on: alkane-fast + container: + image: gitea.bluefla.re/blueflare/alkane-ci@sha256:43bd4048ac01dff914ffb02ce5f2a07be37b5b0512ada66423247aebc74f0732 env: CARGO_TARGET_DIR: target CARGO_BUILD_JOBS: 2 diff --git a/ci/check-runner-image.py b/ci/check-runner-image.py new file mode 100644 index 0000000..3381847 --- /dev/null +++ b/ci/check-runner-image.py @@ -0,0 +1,35 @@ +#!/usr/bin/env python3 +# SPDX-License-Identifier: MIT +"""Keep OS jobs on the verified Alkane runner image.""" + +from pathlib import Path +import re +import sys + +import yaml + + +ROOT = Path(__file__).resolve().parents[1] +IMAGE = (ROOT / "ci/runner-image.txt").read_text().strip() + + +def main() -> int: + if not re.fullmatch( + r"gitea\.bluefla\.re/blueflare/alkane-ci@sha256:[0-9a-f]{64}", IMAGE + ): + print("Runner image must be pinned by Gitea registry digest", file=sys.stderr) + return 1 + for path in sorted((ROOT / ".gitea/workflows").glob("*.yml")): + workflow = yaml.load(path.read_text(), Loader=yaml.BaseLoader) + for name, job in workflow.get("jobs", {}).items(): + if job.get("runs-on") not in {"alkane-ci", "alkane-fast"}: + continue + if job.get("container", {}).get("image") != IMAGE: + print(f"{path.name}: {name} has a different runner image", file=sys.stderr) + return 1 + print("OS runner image pins: PASS") + return 0 + + +if __name__ == "__main__": + raise SystemExit(main()) diff --git a/ci/runner-image.txt b/ci/runner-image.txt new file mode 100644 index 0000000..21db8c2 --- /dev/null +++ b/ci/runner-image.txt @@ -0,0 +1 @@ +gitea.bluefla.re/blueflare/alkane-ci@sha256:43bd4048ac01dff914ffb02ce5f2a07be37b5b0512ada66423247aebc74f0732