Add pburl and pblastreport companion tools to the RPM
node-lookup output is useful for pivoting to Puppetboard, but there was no quick way to turn a list of hosts into Puppetboard node-page URLs or to see when each host last ran Puppet. These two tools close that gap and ship in the same RPM so they are available wherever node-lookup is. - Add pburl: reads hostnames from args or piped node-lookup output and prints "<host> <puppetboard-node-page-url>". - Add pblastreport: prints "<host>\t<last-report-time>\t<url>" using report_timestamp from the PuppetDB v4 nodes endpoint. Supports --relative/-r (relative age) and --timezone/-z <IANA> (default: local timezone). - Add internal/puppet package shared by both tools: config load, PuppetDB nodes query, Puppetboard URL construction, and no-TTY-safe stdin host reading. - Add puppetboard_url config key (env NODE_LOOKUP_PUPPETBOARD_URL) to the shared config so config init/show scaffold it for the whole tool family. - Build all three binaries individually (each is its own main package) and generate per-binary bash/zsh/fish completions in the Makefile, build-rpm.sh, and nfpm spec; cross-compile and attach all three per os/arch in the release pipeline. - Document the tools, config key, and env var in AGENTS.md.
This commit is contained in:
@@ -17,16 +17,22 @@ steps:
|
||||
memory: 2Gi
|
||||
cpu: 2
|
||||
|
||||
# Build the linux/amd64 binary into dist/ (consumed by the RPM step) plus the
|
||||
# cross-platform binaries attached to the Gitea release.
|
||||
# Build all binaries into dist/ (consumed by the RPM step) plus the
|
||||
# cross-platform binaries attached to the Gitea release. Each tool is a
|
||||
# separate main package, so they are built individually per os/arch.
|
||||
- name: build
|
||||
image: git.unkin.net/unkin/almalinux9-gobuilder:20260606
|
||||
commands:
|
||||
- make build VERSION=${CI_COMMIT_TAG}
|
||||
- GOOS=linux GOARCH=amd64 go build -ldflags="-s -w -X main.version=${CI_COMMIT_TAG}" -o node-lookup-linux-amd64 ./...
|
||||
- GOOS=linux GOARCH=arm64 go build -ldflags="-s -w -X main.version=${CI_COMMIT_TAG}" -o node-lookup-linux-arm64 ./...
|
||||
- GOOS=darwin GOARCH=amd64 go build -ldflags="-s -w -X main.version=${CI_COMMIT_TAG}" -o node-lookup-darwin-amd64 ./...
|
||||
- GOOS=darwin GOARCH=arm64 go build -ldflags="-s -w -X main.version=${CI_COMMIT_TAG}" -o node-lookup-darwin-arm64 ./...
|
||||
- |
|
||||
for entry in "node-lookup:." "pburl:./cmd/pburl" "pblastreport:./cmd/pblastreport"; do
|
||||
name="${entry%%:*}"; pkg="${entry##*:}"
|
||||
for osarch in linux/amd64 linux/arm64 darwin/amd64 darwin/arm64; do
|
||||
GOOS="${osarch%/*}" GOARCH="${osarch#*/}" \
|
||||
go build -ldflags="-s -w -X main.version=${CI_COMMIT_TAG}" \
|
||||
-o "${name}-${osarch%/*}-${osarch#*/}" "${pkg}"
|
||||
done
|
||||
done
|
||||
depends_on: [test]
|
||||
backend_options:
|
||||
kubernetes:
|
||||
@@ -113,6 +119,14 @@ steps:
|
||||
node-lookup-linux-arm64 \
|
||||
node-lookup-darwin-amd64 \
|
||||
node-lookup-darwin-arm64 \
|
||||
pburl-linux-amd64 \
|
||||
pburl-linux-arm64 \
|
||||
pburl-darwin-amd64 \
|
||||
pburl-darwin-arm64 \
|
||||
pblastreport-linux-amd64 \
|
||||
pblastreport-linux-arm64 \
|
||||
pblastreport-darwin-amd64 \
|
||||
pblastreport-darwin-arm64 \
|
||||
--login gitea --repo "${CI_REPO}"
|
||||
depends_on: [upload-rpm]
|
||||
backend_options:
|
||||
|
||||
Reference in New Issue
Block a user