ci: make the lint, getdeps, and release gates fail honestly

Three gate-correctness fixes:

- lint: `command typos && typos ./ || echo skipping` ran typos twice (POSIX
  `command` executes it) and, via `&& ... || echo`, turned a real typo finding
  (nonzero exit) into the "not installed" message with exit 0 - so spelling
  issues could never fail the gate. Use `command -v` to test presence and run
  typos once, letting its findings surface.

- getdeps: `curl -sSfL ... | sh` took the pipeline's exit from sh, and make's
  /bin/sh has no pipefail, so a failed or partial download of the golangci-lint
  installer was reported as success and a truncated script could run. Download
  to a temp file under `set -e` (with a trap to clean it up) and execute that,
  so a curl failure aborts the target. Verified: a 404 now exits nonzero
  instead of silently continuing.

- release: workflow_dispatch checked out github.ref (the branch it ran from)
  while naming artifacts after the input tag, so a release could be built from
  one ref and published under another. Pin checkout to the requested tag.

Not addressed here: the server's release container image is still only built
by the publish-time docker-release workflow, never in CI (MC covers this in
its test-release). Flagged for a separate decision.

Co-authored-by: Claude <noreply@anthropic.com>
This commit is contained in:
Feng Ruohang
2026-08-05 01:06:12 +08:00
parent aa51393694
commit 021110b451
2 changed files with 11 additions and 2 deletions
+6 -2
View File
@@ -25,8 +25,12 @@ help: ## print this help
getdeps: ## fetch necessary dependencies
@mkdir -p ${GOPATH}/bin
@if [ ! -x "$(GOLANGCI)" ]; then \
set -e; \
echo "Installing golangci-lint $(GOLANGCI_VERSION)"; \
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/$(GOLANGCI_VERSION)/install.sh | sh -s -- -b $(GOLANGCI_DIR) $(GOLANGCI_VERSION); \
script=$$(mktemp); \
trap 'rm -f "$$script"' EXIT; \
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/$(GOLANGCI_VERSION)/install.sh -o "$$script"; \
sh "$$script" -b $(GOLANGCI_DIR) $(GOLANGCI_VERSION); \
fi
crosscompile: ## cross compile minio
@@ -53,7 +57,7 @@ check-gen: ## check for updated autogenerated files
lint: getdeps ## runs golangci-lint suite of linters
@echo "Running $@ check"
@$(GOLANGCI) run --build-tags kqueue --timeout=10m --config ./.golangci.yml
@command typos && typos ./ || echo "typos binary is not found.. skipping.."
@if command -v typos >/dev/null 2>&1; then typos ./; else echo "typos binary is not found.. skipping.."; fi
lint-fix: getdeps ## runs golangci-lint suite of linters with automatic fixes
@echo "Running $@ check"