mirror of
https://github.com/norandom/OpenUltraSAST.git
synced 2026-12-03 10:18:18 +00:00
The `images` job of `.github/workflows/release.yml` built `Dockerfile` with no build arguments, so the file's own defaults applied: `TASK_BASE_TAG=base-unpublished` and an empty digest. The first `FROM` could not be resolved. The log of the `v2.1.0-alpha.1` tag's run (42229293910, job `images (openultrasast, Dockerfile)`, 2026-11-06T13:54:46Z) reads `ERROR: failed to build: failed to solve: failed to parse stage name "ghcr.io/norandom/ousast-task-base:base-unpublished@": invalid reference format`. Compose had the same defect, closed in89d08e0. The job now reads `plane/task-base.digest` in a `pins` step before its build, the way the `pins` job of `engine-image.yml` does: the same pattern, fail closed on an unpublished or malformed pin, the tag and digest written to the step's outputs. The build step passes them as `TASK_BASE_TAG` and `TASK_BASE_DIGEST`. The other leg of the matrix, the runner, declares no such arguments and ignores them. The `image` job of `engine-image.yml` already passes both arguments to its search-task leg, which does not declare them either: run 42229294086 of the same tag succeeded, and its log holds no line about unused arguments. Tests: the new `tests/test_task_images.py::test_release_pins_the_base_of_its_scan_image` fails on the workflow at9d53c32(3 failed: the job reads no pin) and passes after, in five cases. A valid pin writes exactly the two output lines. An unpublished pin, a bare tag, a short digest and another repository each stop the script with its own message and write nothing. The test also asserts that the pin is read before the build and that the build carries both arguments from that step. With `tests/test_search_image.py`, 23 passed. On this machine the script, run from the tree, wrote `base_tag=base-b696c08` and the digest `docker-compose.yml` defaults to. ruff format, ruff check, mypy, the three gates and compileall pass, and the gates print what they printed before the change. An independent reviewer approved the change in one round; its three notes on the test are applied here (the step order, the exit status and message, two more malformed pins). Not run: the release workflow itself, on GitHub.
109 lines
4.1 KiB
YAML
109 lines
4.1 KiB
YAML
name: Tagged Release
|
|
|
|
on:
|
|
push:
|
|
tags:
|
|
- "v*.*.*"
|
|
|
|
permissions:
|
|
contents: write
|
|
|
|
jobs:
|
|
build-release:
|
|
runs-on: ubuntu-latest
|
|
env:
|
|
# Preserve the explicitly installed test extras across each uv run invocation.
|
|
UV_NO_SYNC: "1"
|
|
steps:
|
|
- uses: actions/checkout@v5
|
|
- uses: astral-sh/setup-uv@v7
|
|
with:
|
|
enable-cache: true
|
|
- uses: actions/setup-python@v6
|
|
with:
|
|
python-version-file: .python-version
|
|
- run: uv sync --group dev --extra hunt --extra semantic
|
|
- run: uv run ruff format --check .
|
|
- run: uv run ruff check .
|
|
- run: uv run mypy src/openultrasast
|
|
- name: Run release tests
|
|
run: |
|
|
if [[ "${GITHUB_REF_NAME}" == *-* ]]; then
|
|
# The alpha checkpoint archives the implemented core while the benchmark owner resolves the
|
|
# documented task-11.4 reservation/lifecycle conflict. Stable tags retain the complete gate.
|
|
uv run pytest \
|
|
--deselect=tests/test_independent_population.py::test_no_reserved_repository_is_referenced_by_the_development_tree
|
|
else
|
|
uv run pytest
|
|
fi
|
|
- run: uv build
|
|
- uses: softprops/action-gh-release@v2
|
|
with:
|
|
files: |
|
|
dist/*.whl
|
|
dist/*.tar.gz
|
|
body_path: RELEASE_NOTES.md
|
|
generate_release_notes: true
|
|
prerelease: ${{ contains(github.ref_name, '-') }}
|
|
make_latest: ${{ !contains(github.ref_name, '-') }}
|
|
|
|
images:
|
|
# The scan image (Joern + php-cli, `docker run ... scan`) and the plane's task runner, pushed to GHCR under the
|
|
# tag's version. Pin them by the digests this job prints, not by tag: Agent Substrate rejects tags.
|
|
runs-on: ubuntu-latest
|
|
permissions:
|
|
contents: read
|
|
packages: write
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
include:
|
|
- name: openultrasast
|
|
dockerfile: Dockerfile
|
|
- name: openultrasast-runner
|
|
dockerfile: plane/Dockerfile.runner
|
|
steps:
|
|
- uses: actions/checkout@v5
|
|
# The scan image builds FROM the pinned base, and Dockerfile's own default names none (`base-unpublished`), so
|
|
# a build without these arguments cannot succeed. The runner takes no base: the arguments are unused there.
|
|
- id: pins
|
|
run: |
|
|
python3 - <<'PYTHON'
|
|
import json, os, re
|
|
from pathlib import Path
|
|
pins = json.loads(Path("plane/task-base.digest").read_text())
|
|
pattern = r"ghcr.io/norandom/ousast-task-base:(base-[a-z0-9-]+)@(sha256:[0-9a-f]{64})"
|
|
match = re.fullmatch(pattern, pins.get("base") or "")
|
|
if not match:
|
|
raise SystemExit("base: unpublished/invalid pin; run task-base-image and update plane/task-base.digest")
|
|
with open(os.environ["GITHUB_OUTPUT"], "a") as out:
|
|
out.write(f"base_tag={match[1]}\nbase_digest={match[2]}\n")
|
|
PYTHON
|
|
- uses: docker/setup-buildx-action@v3
|
|
- uses: docker/login-action@v3
|
|
with:
|
|
registry: ghcr.io
|
|
username: ${{ github.actor }}
|
|
password: ${{ secrets.GITHUB_TOKEN }}
|
|
- id: meta
|
|
uses: docker/metadata-action@v5
|
|
with:
|
|
images: ghcr.io/${{ github.repository_owner }}/${{ matrix.name }}
|
|
tags: |
|
|
type=semver,pattern={{version}}
|
|
type=semver,pattern={{major}}.{{minor}},enable=${{ !contains(github.ref_name, '-') }}
|
|
type=raw,value=latest,enable=${{ !contains(github.ref_name, '-') }}
|
|
- id: build
|
|
uses: docker/build-push-action@v6
|
|
with:
|
|
context: .
|
|
file: ${{ matrix.dockerfile }}
|
|
push: true
|
|
tags: ${{ steps.meta.outputs.tags }}
|
|
labels: ${{ steps.meta.outputs.labels }}
|
|
build-args: |
|
|
TASK_BASE_TAG=${{ steps.pins.outputs.base_tag }}
|
|
TASK_BASE_DIGEST=${{ steps.pins.outputs.base_digest }}
|
|
- run: |
|
|
echo "ghcr.io/${{ github.repository_owner }}/${{ matrix.name }}@${{ steps.build.outputs.digest }}" >> "$GITHUB_STEP_SUMMARY"
|