Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,11 @@ versions.
only git, podman, pre-commit, gh and POSIX utilities, plus a recording podman
shim. Earns the host-contract exemption rather than relying on the
constitution validator not inspecting `language: script` hooks.
- `sdlc versions`, reporting what is installed beside what was pinned.
- `sdlc versions`, reporting what is installed beside what was pinned. The two
columns answer different questions and need not match: a wrapper image carries
its own version (`crunchtools/gourmand:1.0.0` is that packaging repo's first
release) around an upstream build (`mattdm/gourmand` v0.16.5). The tag is what
CI pins; the self-reported version is which upstream actually runs.

### Verified against trentina

Expand Down
10 changes: 6 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -146,10 +146,12 @@ The constitution validator is cloned rather than baked for a different reason:
the fleet spans `Inherits:` v1.0.0 to v1.29.0, so a baked copy would judge most
repos by rules they have not adopted.

`sdlc versions` prints what is installed next to what was pinned. Where the two
disagree — the Gourmand image tagged `1.0.0` ships a binary reporting `0.16.5` —
that is shown rather than hidden, because a version nobody can see is a version
nobody can pin.
`sdlc versions` prints what is installed next to what was pinned, because the
two answer different questions. They need not match: `crunchtools/gourmand:1.0.0`
is that packaging repo's own first release and the binary inside it is upstream
`mattdm/gourmand` v0.16.5. Both are correct. The tag is what CI pins; the
self-reported version is which upstream you are actually running, and a tag
alone does not tell you that.

## Trivy is not here

Expand Down
21 changes: 13 additions & 8 deletions sdlc
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,15 @@ VERSION_PROBE = {
def self_reported(name: str) -> str:
"""What the installed binary calls itself.

Worth printing next to the pinned tag because the two can disagree: the
gourmand image tagged 1.0.0 ships a binary that reports 0.16.5. A consuming
repo pins the image tag, so a silent gap between tag and build is exactly
the thing that makes a 'pinned' tool not pinned.
Printed beside the pinned tag because they answer different questions and a
consuming repo needs both. The pin is what CI must name; the self-reported
version is what the tool actually is.

They legitimately differ for a wrapper image: `crunchtools/gourmand:1.0.0`
is that packaging repo's own first release, and the binary inside it is
upstream mattdm/gourmand v0.16.5. Neither number is wrong -- but knowing
only the tag tells you nothing about which upstream you are running, and
knowing only the binary version tells you nothing you can pin.
"""
probe = VERSION_PROBE.get(name)
if probe is None:
Expand Down Expand Up @@ -693,10 +698,10 @@ def main() -> int:
print(f"{name:12} {pinned:24} {self_reported(name)}")
print(
"\nPin the 'pinned' column in CI so a local finding is the CI finding.\n"
"Where the two columns disagree, the image tag and the binary "
"disagree -- that is the upstream's to fix, and it is shown here "
"rather than hidden because a version nobody can see is a version "
"nobody can pin."
"The two columns answer different questions and need not match: a\n"
"wrapper image carries its own version (gourmand 1.0.0 is the\n"
"packaging release) around an upstream build (0.16.5). Both are\n"
"shown because the tag is what you pin and the binary is what runs."
)
return 0

Expand Down
11 changes: 6 additions & 5 deletions tests/contract.sh
Original file line number Diff line number Diff line change
Expand Up @@ -86,11 +86,12 @@ _bundle=$(inside sh -c 'printf %s "$SDLC_CODEQL_BUNDLE"')
check_version codeql "${_bundle#codeql-bundle-v}" \
"$(inside sh -c 'codeql version --format=terse' 2>&1)"

# Gourmand is EXEMPT from this check on purpose: its image tag and its binary
# disagree upstream (tag 1.0.0 ships a binary reporting 0.16.5). `sdlc versions`
# shows both columns so the gap is visible; asserting they match here would fail
# the build for someone else's version mismatch.
note "gourmand tag/binary mismatch is reported by 'sdlc versions', not asserted here"
# Gourmand is EXEMPT from this check, and not because of a defect: its image is
# a WRAPPER. `crunchtools/gourmand:1.0.0` is that packaging repo's own first
# release and the binary inside is upstream mattdm/gourmand v0.16.5, so the two
# numbers are both correct and asserting they match would be asserting something
# untrue. `sdlc versions` prints both columns instead.
note "gourmand's image tag is a packaging version, not the binary's -- both shown by 'sdlc versions'"

# ------------------------------------------------------- the script's own shape

Expand Down
Loading