Repository navigation
chore: float the sdlc gates on quay.io/crunchtools/sdlc #35
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,52 @@ | ||
| # The repo's own checks, from quay.io/crunchtools/sdlc -- the same image, the | ||
| # same launcher and the same commands the laptop's hooks run, so a green push | ||
| # predicts a green CI (constitution XII). Nothing here pins a release: the | ||
| # image prints its own launcher, and both float on :latest. | ||
| # | ||
| # The variable SDLC_IMAGE -- a repository's, or the organization's for the | ||
| # whole fleet -- picks other tooling: `main` for what has merged to python-sdlc | ||
| # and not been released, or a release such as `0.9.0` to hold one back. A | ||
| # variable, which only an admin sets, rather than a line a pull request could | ||
| # change in passing. | ||
| # | ||
| # Gourmand runs as its own job, not inside `sdlc ci`: XII has CI run push's | ||
| # checks except Gourmand and Gatehouse, which run through their own workflows | ||
| # (Gatehouse: gatehouse.yml). | ||
| # | ||
| # The job NAME `sdlc ci` is the required check in the org ruleset "Python SDLC | ||
| # gates", and the Gourmand job keeps the name its own workflow gave it. Renaming | ||
| # a job stops it gating, silently. | ||
| # | ||
| # python-sdlc's examples/ci.yml, written by scripts/convert_repo.py. Copy it | ||
| # unchanged. | ||
|
|
||
| name: CI | ||
|
|
||
| on: | ||
| push: | ||
| branches: [main, master] | ||
| pull_request: | ||
| workflow_dispatch: | ||
|
|
||
| permissions: | ||
| contents: read | ||
|
|
||
| jobs: | ||
| sdlc: | ||
| name: sdlc ci | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | ||
| with: | ||
| persist-credentials: false | ||
|
|
||
| # .sdlc/bin/sdlc is python-sdlc's bin/sdlc-bootstrap: it asks the image | ||
| # for its launcher and runs it, as the hooks do. | ||
| - name: sdlc ci | ||
| env: | ||
| SDLC_IMAGE: ${{ vars.SDLC_IMAGE }} | ||
| run: .sdlc/bin/sdlc ci | ||
|
|
||
| gourmand: | ||
| name: Code Quality (Gourmand) | ||
| uses: crunchtools/gatehouse/.github/workflows/gourmand.yml@v0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,17 +1,36 @@ | ||
| # Every check runs from quay.io/crunchtools/sdlc (constitution XII). Nothing | ||
| # here pins it: .sdlc/bin/sdlc asks the image for its own launcher and runs it, | ||
| # so the launcher, the image and every tool inside it float together on | ||
| # :latest -- for this laptop and, through .github/workflows/ci.yml, for CI. | ||
| # There is no `rev:` to bump, ever. | ||
| # | ||
| # SDLC_IMAGE=main git push judges this push with what has merged to | ||
| # python-sdlc and not been released. A repo opts | ||
| # its CI in with the repository variable SDLC_IMAGE. | ||
| # | ||
| # What each hook runs is configured in pyproject.toml ([tool.sdlc.commit], | ||
| # [tool.sdlc.push], [tool.sdlc.ci]) or, in a repo with no pyproject.toml, | ||
| # sdlc.toml. `.sdlc/bin/sdlc tiers` prints it. | ||
| # | ||
| # `default_install_hook_types` must name both: without pre-push, `pre-commit | ||
| # install` wires only the commit hook and every verdict silently stops running. | ||
|
|
||
| default_install_hook_types: [pre-commit, pre-push] | ||
|
|
||
| repos: | ||
| - repo: local | ||
| hooks: | ||
| - id: gourmand | ||
| name: Gourmand (AI slop detection) | ||
| entry: podman --events-backend=none run --rm --log-driver=none -v .:/src:Z -w /src quay.io/crunchtools/gourmand:latest check --full | ||
| - id: sdlc-commit | ||
| name: sdlc commit | ||
| entry: .sdlc/bin/sdlc commit | ||
| language: system | ||
| pass_filenames: false | ||
| always_run: true | ||
| stages: [pre-commit, pre-merge-commit] | ||
| - id: gatehouse | ||
| name: Gatehouse (AI code review, staged diff) | ||
| entry: bash -c 'git diff --cached | podman --events-backend=none run --rm --log-driver=none -i --env-file "$HOME/.config/mcp-env/gatehouse.env" -v .:/src:ro,Z -w /src quay.io/crunchtools/gatehouse:latest --stdin' | ||
| - id: sdlc-push | ||
| name: sdlc push | ||
| entry: .sdlc/bin/sdlc push | ||
| language: system | ||
| pass_filenames: false | ||
| always_run: true | ||
| stages: [pre-commit, pre-merge-commit] | ||
| stages: [pre-push] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,62 @@ | ||
| #!/bin/sh | ||
| # Run `sdlc` with no `rev:` to pin: get the launcher from the image, then run it. | ||
| # | ||
| # The launcher (bin/sdlc) ships inside quay.io/crunchtools/sdlc, so it floats | ||
| # with the image tag exactly as the tools in the image do: `:latest` by | ||
| # default, SDLC_IMAGE=main for what has merged and not been released, a | ||
| # release such as SDLC_IMAGE=0.9.0, or SDLC_IMAGE=@sha256:<digest>. Nothing | ||
| # else: this file runs whatever it pulls, so it pulls from that one repository. | ||
| # A seat trying a local build runs a python-sdlc clone's bin/sdlc instead. The | ||
| # image prints the launcher with its own ref written into it (`sdlc launcher | ||
| # <ref>`), so the launcher and the image it starts cannot disagree. | ||
| # | ||
| # A converted repo carries this file as .sdlc/bin/sdlc, and its hooks and its | ||
| # CI job run it (scripts/convert_repo.py writes it). Nothing in it names a | ||
| # release, so nothing ever bumps it, and the constitution pins its bytes. An | ||
| # `sdlc` RPM would install the same file as /usr/bin/sdlc. | ||
| # | ||
| # Host contract: podman and POSIX sh, nothing else. Never a pipe into `sh`: a | ||
| # failed pull would hand sh nothing, and nothing runs and exits 0. An image | ||
| # that cannot print its launcher is a 2 -- the gate could not run. | ||
|
|
||
| set -u | ||
|
|
||
| FLEET=quay.io/crunchtools/sdlc | ||
| refuse() { | ||
| printf 'sdlc: GATE CANNOT RUN: SDLC_IMAGE=%s is not main, latest, X.Y.Z or @sha256:<64 hex> of %s\n' \ | ||
| "${SDLC_IMAGE:-}" "$FLEET" >&2 | ||
| exit 2 | ||
| } | ||
|
|
||
| # The value, with the repository named in full or not at all. | ||
| want=${SDLC_IMAGE:-latest} | ||
| case $want in | ||
| "$FLEET":*) want=${want#"$FLEET":} ;; | ||
| "$FLEET"@*) want=${want#"$FLEET"} ;; | ||
| esac | ||
| case $want in | ||
| main|latest) image=$FLEET:$want ;; | ||
| @sha256:*) | ||
| hex=${want#@sha256:} | ||
| case $hex in *[!0-9a-f]*) refuse ;; esac | ||
| [ "${#hex}" -eq 64 ] || refuse | ||
| image=$FLEET$want ;; | ||
| *[!0-9.]*|.*|*.|*..*|*.*.*.*) refuse ;; | ||
| *.*.*) image=$FLEET:$want ;; | ||
| *) refuse ;; | ||
| esac | ||
|
|
||
| dir=$(mktemp -d) || exit 2 | ||
| trap 'rm -rf "$dir"' EXIT | ||
| trap 'exit 2' HUP INT TERM | ||
|
|
||
| # --pull=newer: :latest moves, and a stale local copy is how a two-week-old | ||
| # reviewer once judged trentina. Offline, podman keeps the copy it has. | ||
| if ! podman --events-backend=none run --rm --log-driver=none --network=none \ | ||
| --cap-drop=all --security-opt=no-new-privileges --pull=newer \ | ||
| -- "$image" launcher "$image" > "$dir/sdlc" || [ ! -s "$dir/sdlc" ]; then | ||
| printf 'sdlc: GATE CANNOT RUN: %s could not print its launcher\n' "$image" >&2 | ||
| exit 2 | ||
| fi | ||
| # The launcher reads SDLC_IMAGE too; it gets the full reference checked here. | ||
| SDLC_IMAGE=$image sh "$dir/sdlc" "$@" | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LOW (General Review): If creating the temporary directory fails, the wrapper exits with status 2 but provides no diagnostic. This makes an environmental failure harder to distinguish from other gate startup failures.
Suggestion: Print a brief error to stderr before exiting, such as
sdlc: GATE CANNOT RUN: could not create temporary directory.Evidence:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not a bug: .sdlc/bin/sdlc is the shared floating bootstrap, byte-identical in every repo and pinned by sha256 in constitution v1.46.0. Pulling sdlc:latest on each run is the design (python-sdlc 0.9.0).