Warn on build toolchain version drift (#27) #77

Merged
claude merged 3 commits from issue27_toolchain_versioning into main 2026-07-08 10:03:50 +01:00
claude commented 2026-07-08 08:25:36 +01:00 (Migrated from gitlab.keyop.co.uk)

Closes #27.

Adds .tool-versions pinning exact go/golangci-lint/goreleaser/gitleaks/yamllint versions, and scripts/check-tool-versions.sh (wired in as make check-tool-versions, a new prerequisite of build/test/lint/package/release/coverage/coverage-html) which checks every one against what's actually installed and prints a WARNING: for each mismatch or missing tool.

Per the ticket: every tool is checked before any warning is printed (no stopping at the first mismatch), and it never fails the build - a drift is a hint to investigate, not a hard gate. Also updated setup-goreleaser/setup-gitleaks to install the exact pinned version instead of @latest.

No .gitlab-ci.yml change needed - make lint/make test/make package already depend on the new target, so CI gets this for free.

See the plan comment on #27 for more detail.

Closes #27. Adds `.tool-versions` pinning exact `go`/`golangci-lint`/`goreleaser`/`gitleaks`/`yamllint` versions, and `scripts/check-tool-versions.sh` (wired in as `make check-tool-versions`, a new prerequisite of `build`/`test`/`lint`/`package`/`release`/`coverage`/`coverage-html`) which checks every one against what's actually installed and prints a `WARNING:` for each mismatch or missing tool. Per the ticket: every tool is checked before any warning is printed (no stopping at the first mismatch), and it never fails the build - a drift is a hint to investigate, not a hard gate. Also updated `setup-goreleaser`/`setup-gitleaks` to install the exact pinned version instead of `@latest`. No `.gitlab-ci.yml` change needed - `make lint`/`make test`/`make package` already depend on the new target, so CI gets this for free. See the plan comment on #27 for more detail.
claude commented 2026-07-08 08:25:36 +01:00 (Migrated from gitlab.keyop.co.uk)

requested review from @danny

requested review from @danny
claude commented 2026-07-08 08:25:36 +01:00 (Migrated from gitlab.keyop.co.uk)

assigned to @claude

assigned to @claude
danny (Migrated from gitlab.keyop.co.uk) approved these changes 2026-07-08 08:25:36 +01:00
danny commented 2026-07-08 08:39:32 +01:00 (Migrated from gitlab.keyop.co.uk)

Let's add shellcheck here too - needs to be at least v0.10.0 (as this is what would be installed in the CI image).

Let's add shellcheck here too - needs to be at least v0.10.0 (as this is what would be installed in the CI image).
danny commented 2026-07-08 08:41:16 +01:00 (Migrated from gitlab.keyop.co.uk)

Shellcheck raises 'SC2329' for these functions ('function is never invoked'). This is informational only, and expected in this case. Ensure we add shellcheck excludes for these functions so that shellcheck output is clean.

Shellcheck raises 'SC2329' for these functions ('function is never invoked'). This is informational only, and expected in this case. Ensure we add shellcheck excludes for these functions so that shellcheck output is clean.
danny commented 2026-07-08 08:41:16 +01:00 (Migrated from gitlab.keyop.co.uk)

It would be better if we could set ranges on these. E.g. go >= 1.26.0 would be fine in this project, but for other values we may want exact values (e.g. golangci-lint == 2.11.4).
Will require some changes to the check-tool-versions.sh script too.

It would be better if we could set ranges on these. E.g. go >= 1.26.0 would be fine in this project, but for other values we may want exact values (e.g. golangci-lint == 2.11.4). Will require some changes to the check-tool-versions.sh script too.
danny commented 2026-07-08 08:41:16 +01:00 (Migrated from gitlab.keyop.co.uk)

Conceptually all Ok, but would like to go a bit further, as per comments.

Conceptually all Ok, but would like to go a bit further, as per comments.
danny commented 2026-07-08 08:41:16 +01:00 (Migrated from gitlab.keyop.co.uk)

requested changes

requested changes
claude commented 2026-07-08 08:46:10 +01:00 (Migrated from gitlab.keyop.co.uk)

mentioned in commit 5fd8c5811c

mentioned in commit 5fd8c5811c69bf6602418c77c99ba0cfbae5773e
claude commented 2026-07-08 08:46:11 +01:00 (Migrated from gitlab.keyop.co.uk)

changed this line in version 2 of the diff

changed this line in [version 2 of the diff](/keyop/go/nfq_forwarder/-/merge_requests/36/diffs?diff_id=350&start_sha=d5dfb4a2afe8fe9c032b6dd4fab939b7db14f7d3#9ba7c617c5f5ab743b969efd7c87ef3877ee7265_13_9)
claude commented 2026-07-08 08:46:11 +01:00 (Migrated from gitlab.keyop.co.uk)

changed this line in version 2 of the diff

changed this line in [version 2 of the diff](/keyop/go/nfq_forwarder/-/merge_requests/36/diffs?diff_id=350&start_sha=d5dfb4a2afe8fe9c032b6dd4fab939b7db14f7d3#9ba7c617c5f5ab743b969efd7c87ef3877ee7265_9_9)
claude commented 2026-07-08 08:46:11 +01:00 (Migrated from gitlab.keyop.co.uk)

added 1 commit

  • 5fd8c581 - Address review: version operators, shellcheck (#27)

Compare with previous version

added 1 commit <ul><li>5fd8c581 - Address review: version operators, shellcheck (#27)</li></ul> [Compare with previous version](/keyop/go/nfq_forwarder/-/merge_requests/36/diffs?diff_id=350&start_sha=d5dfb4a2afe8fe9c032b6dd4fab939b7db14f7d3)
claude commented 2026-07-08 08:46:31 +01:00 (Migrated from gitlab.keyop.co.uk)

Added: shellcheck >= 0.10.0 in .tool-versions, wired into make lint (shellcheck scripts/*), and added to .gitlab-ci.yml's defensive apt-get install list alongside yamllint/iptables.

Added: `shellcheck >= 0.10.0` in .tool-versions, wired into `make lint` (shellcheck scripts/*), and added to .gitlab-ci.yml's defensive apt-get install list alongside yamllint/iptables.
claude commented 2026-07-08 08:46:32 +01:00 (Migrated from gitlab.keyop.co.uk)

Added a # shellcheck disable=SC2329 directly above each installed_version_ function (per-function, not a blanket file-level disable) - shellcheck scripts/* is clean now.

Added a `# shellcheck disable=SC2329` directly above each installed_version_<tool> function (per-function, not a blanket file-level disable) - `shellcheck scripts/*` is clean now.
claude commented 2026-07-08 08:46:32 +01:00 (Migrated from gitlab.keyop.co.uk)

.tool-versions lines are now <tool> <op> <version> with op one of ==, >=, >, <=, < - go and shellcheck use >=, the other four keep == (matching that a patch difference in those has caused real problems before). check-tool-versions.sh's new version_compare/version_satisfies do numeric comparison via GNU sort -V (not a plain string match, which would get e.g. 2.9 vs 2.10 backwards).

.tool-versions lines are now `<tool> <op> <version>` with op one of ==, >=, >, <=, < - go and shellcheck use >=, the other four keep == (matching that a patch difference in those has caused real problems before). check-tool-versions.sh's new version_compare/version_satisfies do numeric comparison via GNU sort -V (not a plain string match, which would get e.g. 2.9 vs 2.10 backwards).
claude commented 2026-07-08 08:46:33 +01:00 (Migrated from gitlab.keyop.co.uk)

resolved all threads

resolved all threads
claude commented 2026-07-08 08:46:43 +01:00 (Migrated from gitlab.keyop.co.uk)

All three review comments addressed in 5fd8c58:

  1. shellcheck >= 0.10.0 added to .tool-versions, wired into make lint, and added to the CI defensive-install list.
  2. Per-function # shellcheck disable=SC2329 directives added for the indirectly-invoked installed_version_<tool> functions - shellcheck scripts/* now clean.
  3. .tool-versions lines now take an operator (==/>=/>/<=/<) - go/shellcheck use >=, the rest keep ==. Comparison is numeric (GNU sort -V), not lexical.

make lint/make test both pass clean, including the new shellcheck step. Ready for another look.

All three review comments addressed in `5fd8c58`: 1. `shellcheck >= 0.10.0` added to `.tool-versions`, wired into `make lint`, and added to the CI defensive-install list. 2. Per-function `# shellcheck disable=SC2329` directives added for the indirectly-invoked `installed_version_<tool>` functions - `shellcheck scripts/*` now clean. 3. `.tool-versions` lines now take an operator (`==`/`>=`/`>`/`<=`/`<`) - `go`/`shellcheck` use `>=`, the rest keep `==`. Comparison is numeric (GNU `sort -V`), not lexical. `make lint`/`make test` both pass clean, including the new `shellcheck` step. Ready for another look.
danny commented 2026-07-08 09:59:28 +01:00 (Migrated from gitlab.keyop.co.uk)

LGTM

LGTM
danny commented 2026-07-08 09:59:28 +01:00 (Migrated from gitlab.keyop.co.uk)

approved this merge request

approved this merge request
danny (Migrated from gitlab.keyop.co.uk) scheduled this pull request to auto merge when all checks succeed 2026-07-08 09:59:37 +01:00
claude commented 2026-07-08 10:02:56 +01:00 (Migrated from gitlab.keyop.co.uk)

aborted the automatic merge because the source branch was updated. Learn more.

aborted the automatic merge because the source branch was updated. [Learn more](https://gitlab.keyop.co.uk/help/ci/pipelines/merge_trains.md#merge-request-dropped-from-the-merge-train).
claude commented 2026-07-08 10:02:56 +01:00 (Migrated from gitlab.keyop.co.uk)

added 1 commit

  • 08aa545e - Fix shellcheck 0.10.0 CI failure: suppress SC2317 too (#27)

Compare with previous version

added 1 commit <ul><li>08aa545e - Fix shellcheck 0.10.0 CI failure: suppress SC2317 too (#27)</li></ul> [Compare with previous version](/keyop/go/nfq_forwarder/-/merge_requests/36/diffs?diff_id=352&start_sha=5fd8c5811c69bf6602418c77c99ba0cfbae5773e)
claude commented 2026-07-08 10:03:50 +01:00 (Migrated from gitlab.keyop.co.uk)

mentioned in commit cb8f04b3e8

mentioned in commit cb8f04b3e8653f9d21f85d84c7e64eff8a1d7342
claude (Migrated from gitlab.keyop.co.uk) merged commit cb8f04b3e8 into main 2026-07-08 10:03:50 +01:00
claude commented 2026-07-08 10:04:44 +01:00 (Migrated from gitlab.keyop.co.uk)

mentioned in issue #27

mentioned in issue #27
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
keyop-go/nfq_forwarder!77
No description provided.