Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
403cce8
Add BATS harness and baseline tests for validate-action-pins
lex57ukr Apr 18, 2026
836ce3c
Introduce subcommand dispatch for validate-action-pins
lex57ukr Apr 18, 2026
0a0bd09
Add list subcommand to validate-action-pins
lex57ukr Apr 18, 2026
93f1771
Support branch pins in validate-action-pins check
lex57ukr Apr 18, 2026
ebca57b
Add updates subcommand to validate-action-pins
lex57ukr Apr 18, 2026
47995a5
Add cross-file resolve_cache coverage for validate-action-pins
lex57ukr Apr 18, 2026
1aac567
Reframe updates as an upgrade inventory
lex57ukr Apr 18, 2026
5f9b218
Add missing words to cspell configuration
lex57ukr Apr 18, 2026
26b19ba
Break list and updates man sections into scannable paragraphs
lex57ukr Apr 18, 2026
494c3b3
Update cspell configuration and fix spelling in tests
lex57ukr Apr 18, 2026
e2eaae8
Narrow shellcheck disables in validate-action-pins.bats to SC2154
lex57ukr Apr 18, 2026
2abd916
Scope bats SC2154 suppression to the Makefile, not per-file
lex57ukr Apr 18, 2026
ba9509f
Refactor validate-action-pins for clarity
lex57ukr Apr 18, 2026
6d55502
Consolidate dedup idiom and effective-ref derivation
lex57ukr Apr 18, 2026
6805def
Promote dedup sets to module scope and drop nameref indirection
lex57ukr Apr 18, 2026
1c027e4
Add "dedup" and "nameref" to cspell dictionary
lex57ukr Apr 18, 2026
6bfee9c
Add --only filter for check and updates
lex57ukr Apr 18, 2026
5309d01
Make list --only tap the API for authoritative classification
lex57ukr Apr 18, 2026
79634cc
Harden gh_api: curl retries, verbose stderr, auth vs reach, rate-limi…
lex57ukr Apr 18, 2026
e2841ed
Extract the semver-like tag pattern to a single module constant
lex57ukr Apr 18, 2026
6b6655b
Skip uses: inside YAML comment lines when parsing
lex57ukr Apr 18, 2026
7907471
Document the fixtures/ URL-to-path mirroring convention
lex57ukr Apr 18, 2026
a04dee7
Reorganize bats tests by abstraction layer and per-tool directory
lex57ukr Apr 18, 2026
19c7969
Prefix subcommand bats files with `subcommand-`
lex57ukr Apr 18, 2026
f7dff97
Wire test-bats into CI and escalate preflight on a zero rate-limit
lex57ukr Apr 18, 2026
795e069
Harden curl flags: --max-time, shared probe constant, HTTP 429 path
lex57ukr Apr 18, 2026
38af306
Use a RETURN trap for preflight tempfile cleanup
lex57ukr Apr 18, 2026
8d014bc
Split main() into _short_circuit_help_version and _parse_cli_args
lex57ukr Apr 18, 2026
7c5b269
Extract preflight's transport-specific probes into named helpers
lex57ukr Apr 18, 2026
355c6bf
Clarify _include_pin and parse_uses_line doc comments
lex57ukr Apr 18, 2026
72fc17e
Tighten cmd_updates output: unify TSV printf, extract _emit_update_plain
lex57ukr Apr 18, 2026
bc9e798
Allow subcommand to appear anywhere in the arg list
lex57ukr Apr 18, 2026
41f8d06
Update man page to catch up with recent script changes
lex57ukr Apr 19, 2026
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
14 changes: 14 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,20 @@ jobs:
- name: Lint
run: make lint

bats:
name: BATS
runs-on: ubuntu-latest
container: ghcr.io/knight-owl-dev/ci-tools:latest
steps:
- name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2

# The default BATS_RUNNER docker-runs the ci-tools image for local
# macOS users who may not have bats installed. In CI we're already
# inside that image, so override to run bats directly.
- name: Run BATS tests
run: make test-bats BATS_RUNNER=bats

# Builds run on ubuntu-latest (x86_64) for both architectures. The tools
# are bash scripts, so nfpm produces valid debs regardless of host arch.
# Architecture-specific testing happens in test-deb using native runners.
Expand Down
29 changes: 25 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,14 @@ IMAGE_TAG ?= $(IMAGE):local
VALIDATE_ACTION_PINS := $(shell \
command -v validate-action-pins 2>/dev/null \
|| echo images/ci-tools/bin/validate-action-pins)
# Pass `-t` to `docker run` when stdin is a terminal, so TTY-aware tools
# (bats pretty output, etc.) see a real terminal inside the container.
# Override with `DOCKER_TTY=` (empty) or `DOCKER_TTY=-t` (force) as needed.
DOCKER_TTY ?= $(shell test -t 0 && echo -t)

.PHONY: sync resolve build verify scan clean \
lint lint-fix lint-lockfile lint-docker lint-sh lint-sh-fmt lint-sh-fmt-fix \
lint-actions lint-md lint-md-fix lint-man man test-package help
lint-actions lint-md lint-md-fix lint-man man test-package test-bats help

# Resolve latest versions, build, and verify image
sync: resolve build verify
Expand All @@ -28,15 +32,15 @@ build:

# Verify all tools in the built image
verify:
@docker run --rm \
@docker run --rm $(DOCKER_TTY) \
-v $(CURDIR)/scripts:/scripts \
-v $(CURDIR)/images/$(IMAGE)/versions.lock:/versions.lock:ro \
$(IMAGE_TAG) /scripts/$(IMAGE)/verify.sh

# Scan image for vulnerabilities
scan: build
@echo "Scanning $(IMAGE_TAG) for vulnerabilities..."
@docker run --rm \
@docker run --rm $(DOCKER_TTY) \
-v /var/run/docker.sock:/var/run/docker.sock \
-v $(CURDIR)/images/$(IMAGE)/.trivyignore:/.trivyignore:ro \
aquasec/trivy:0.70.0 image \
Expand All @@ -59,10 +63,17 @@ lint-lockfile:
lint-docker:
@echo "Linting Dockerfiles..." && hadolint images/*/Dockerfile && echo "OK"

# Lint shell scripts
# Lint shell scripts.
#
# Bats files reference variables bats sets at runtime (output,
# BATS_TEST_DIRNAME, BATS_TEST_TMPDIR, ...) plus helper-exported ones
# that shellcheck can't trace across bats_load_library. SC2154
# ("referenced but not assigned") is suppressed for that directory
# only, not globally.
lint-sh:
@echo "Linting shell scripts..." \
&& shellcheck scripts/*.sh scripts/*/*.sh tests/deb/*.sh images/*/bin/* \
&& shellcheck -e SC2154 tests/bats/*/*.bash tests/bats/*/*/*/*.bats \
&& echo "OK"

# Check shell script formatting
Expand Down Expand Up @@ -106,6 +117,15 @@ man:
test-package:
@./tests/deb/test-all.sh

# Run BATS tests. BATS_RUNNER defaults to running inside the ci-tools
# container via `docker run`, so `make test-bats` works from a stock
# macOS host without needing bats installed. CI (already inside the
# container) overrides with `BATS_RUNNER=bats` to avoid
# docker-in-docker.
BATS_RUNNER ?= docker run --rm $(DOCKER_TTY) -v $(CURDIR):/work -w /work $(IMAGE_TAG) bats
test-bats:
@$(BATS_RUNNER) -r tests/bats/

# Remove local image
clean:
@echo "Removing $(IMAGE_TAG) ..."
Expand Down Expand Up @@ -135,6 +155,7 @@ help:
@echo " make lint-sh-fmt Check shell script formatting"
@echo " make lint-sh-fmt-fix Fix shell script formatting"
@echo " make man Preview man pages"
@echo " make test-bats Run BATS tests inside the ci-tools image"
@echo " make test-package Build and test deb package locally"
@echo " make help Show this message"
@echo ""
Expand Down
8 changes: 8 additions & 0 deletions cspell.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"busted",
"chktex",
"cosign",
"dedup",
"devops",
"extglob",
"hadolint",
Expand All @@ -16,17 +17,24 @@
"markdownlint",
"mikefarah",
"minimatch",
"nameref",
"nfpm",
"nocurl",
"nojq",
"nosuch",
"picomatch",
"rsync",
"shellcheck",
"shfmt",
"sigstore",
"startswith",
"stdlib",
"stubdir",
"stylelint",
"subcmd",
"syscall",
"tinyglobby",
"tonumber",
"trivy",
"xmlstarlet"
]
Expand Down
Loading