From af01ac95b8a09574e26799eb23aeff56a5264c74 Mon Sep 17 00:00:00 2001 From: Devon Bautista <17506592+synackd@users.noreply.github.com> Date: Thu, 5 Mar 2026 18:08:40 -0700 Subject: [PATCH 1/8] docs(README.md): fixes and updates Fix incorrect Docker paths, update config output, and update status invocation. Signed-off-by: Devon Bautista <17506592+synackd@users.noreply.github.com> --- README.md | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 2ade694e..0864f89d 100644 --- a/README.md +++ b/README.md @@ -95,6 +95,7 @@ default-cluster: foobar log: format: rfc3339 level: warning +timeout: 30s ``` @@ -103,7 +104,7 @@ log: Test access by contacting an API endpoint not requiring an access token: ```bash -$ ochami bss status +$ ochami bss service status {"bss-status":"running"} ``` @@ -177,7 +178,7 @@ sudo make install ### Pulling ```bash -docker pull ghcr.io/synackd/ochami:latest +docker pull ghcr.io/openchami/ochami:latest ``` ### Building @@ -199,6 +200,6 @@ docker build . --tag ochami:dirty ### Running ```bash -docker run ghcr.io/synackd/ochami:latest ochami --ignore-config help +docker run ghcr.io/openchami/ochami:latest ochami --ignore-config help ``` The above incantation will print out the command line's help message. From 169d740e451ebff24232db500bb5ff01a1b8f106 Mon Sep 17 00:00:00 2001 From: Devon Bautista <17506592+synackd@users.noreply.github.com> Date: Thu, 5 Mar 2026 18:11:35 -0700 Subject: [PATCH 2/8] build(Makefile): add goreleaser-* targets Signed-off-by: Devon Bautista <17506592+synackd@users.noreply.github.com> --- Makefile | 45 +++++++++++++++++++++++++++++++++++++++------ README.md | 7 +++++++ 2 files changed, 46 insertions(+), 6 deletions(-) diff --git a/Makefile b/Makefile index 9aedb95d..821648e5 100644 --- a/Makefile +++ b/Makefile @@ -3,13 +3,14 @@ # SPDX-License-Identifier: MIT # Set path to commands -GO ?= $(shell command -v go 2>/dev/null) -GIT ?= $(shell command -v git 2>/dev/null) +GO ?= $(shell command -v go 2>/dev/null) +GORELEASER ?= $(shell command -v goreleaser 2>/dev/null) +GIT ?= $(shell command -v git 2>/dev/null) # Use HOSTCMD to not conflict with Make's $(HOSTNAME) -HOSTCMD ?= $(shell command -v hostname 2>/dev/null) -INSTALL ?= $(shell command -v install 2>/dev/null) -SCDOC ?= $(shell command -v scdoc 2>/dev/null) -SHELL ?= /bin/sh +HOSTCMD ?= $(shell command -v hostname 2>/dev/null) +INSTALL ?= $(shell command -v install 2>/dev/null) +SCDOC ?= $(shell command -v scdoc 2>/dev/null) +SHELL ?= /bin/sh INSTALL_PROGRAM ?= $(INSTALL) -Dm755 INSTALL_DATA ?= $(INSTALL) -Dm644 @@ -78,6 +79,38 @@ binaries: $(NAME) .PHONY: unittest unittest: + +.PHONY: goreleaser-build +goreleaser-build: +ifeq ($(GO),) + $(error go command not found.) +endif +ifeq ($(GORELEASER),) + $(error goreleaser command not found.) +endif + env \ + GOVERSION=$(GOVER) \ + BUILD_HOST=$(BUILDHOST) \ + BUILD_USER=$(BUILDUSER) \ + $(GORELEASER) build $(GORELEASER_OPTS) + +.PHONY: goreleaser-release +goreleaser-release: +ifeq ($(GO),) + $(error go command not found.) +endif +ifeq ($(GORELEASER),) + $(error goreleaser command not found.) +endif + env \ + GOVERSION=$(GOVER) \ + BUILD_HOST=$(BUILDHOST) \ + BUILD_USER=$(BUILDUSER) \ + $(GORELEASER) release $(GORELEASER_OPTS) + +.PHONY: goreleaser-clean +goreleaser-clean: ## Clean Goreleaser files (remove dist/) + $(RM) -rf dist/ ifeq ($(GO),) $(error go command not found.) endif diff --git a/README.md b/README.md index 0864f89d..23e548d5 100644 --- a/README.md +++ b/README.md @@ -155,6 +155,13 @@ goreleaser build --clean --snapshot --single-target Remove `--single-target` to build for all targets. +There is also a `goreleaser-build` make target that sets variables +automatically: + +```bash +make GORELEASER_OPTS='--clean --snapshot --single-target' goreleaser-build +``` + ### Make Make provides convenient and quick building for fast iteration and development. From 45db16218de6ed754018c58db5c0916fff554cdb Mon Sep 17 00:00:00 2001 From: Devon Bautista <17506592+synackd@users.noreply.github.com> Date: Thu, 5 Mar 2026 18:12:48 -0700 Subject: [PATCH 3/8] build(Makefile): reorganize variables to avoid repetition Signed-off-by: Devon Bautista <17506592+synackd@users.noreply.github.com> --- Makefile | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/Makefile b/Makefile index 821648e5..3e458981 100644 --- a/Makefile +++ b/Makefile @@ -15,15 +15,6 @@ SHELL ?= /bin/sh INSTALL_PROGRAM ?= $(INSTALL) -Dm755 INSTALL_DATA ?= $(INSTALL) -Dm644 -IMPORT := github.com/OpenCHAMI/ochami/ - -prefix ?= /usr/local -exec_prefix ?= $(prefix) -bindir ?= $(exec_prefix)/bin -mandir ?= $(exec_prefix)/man -libexecdir ?= $(prefix)/usr/libexec/ochami -sharedir ?= $(prefix)/usr/share - # Check that commands are present ifeq ($(GIT),) $(error git command not found.) @@ -42,6 +33,7 @@ endif rwildcard = $(foreach d,$(wildcard $(1:=/*)),$(call rwildcard,$d,$2) $(filter $(subst *,%,$2),$d)) NAME ?= ochami +IMPORT := github.com/OpenCHAMI/$(NAME)/ VERSION ?= $(shell $(GIT) describe --tags --always --dirty --broken --abbrev=0) TAG ?= $(shell $(GIT) describe --tags --always --abbrev=0) BRANCH ?= $(shell $(GIT) branch --show-current) @@ -71,6 +63,13 @@ MAN5BIN := $(filter %.5,$(MANBIN)) HELPERS := extras/scripts/ochami-discovery-old2new.py +prefix ?= /usr/local +exec_prefix ?= $(prefix) +bindir ?= $(exec_prefix)/bin +mandir ?= $(exec_prefix)/man +libexecdir ?= $(prefix)/usr/libexec/$(NAME) +sharedir ?= $(prefix)/usr/share + .PHONY: all all: binaries From 963ded4e696d3ad3006afc8057232194f56469ad Mon Sep 17 00:00:00 2001 From: Devon Bautista <17506592+synackd@users.noreply.github.com> Date: Thu, 5 Mar 2026 18:15:12 -0700 Subject: [PATCH 4/8] build(Makefile): add 'test' target to perform all tests Signed-off-by: Devon Bautista <17506592+synackd@users.noreply.github.com> --- .github/workflows/test.yml | 2 +- Makefile | 8 ++++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index d1aaf7ae..6e41a7a6 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -27,4 +27,4 @@ jobs: fetch-tags: 1 fetch-depth: 0 - name: Run Go unit tests - run: go test ./... + run: make test diff --git a/Makefile b/Makefile index 3e458981..dbaf09fd 100644 --- a/Makefile +++ b/Makefile @@ -76,8 +76,6 @@ all: binaries .PHONY: binaries binaries: $(NAME) -.PHONY: unittest -unittest: .PHONY: goreleaser-build goreleaser-build: @@ -110,6 +108,12 @@ endif .PHONY: goreleaser-clean goreleaser-clean: ## Clean Goreleaser files (remove dist/) $(RM) -rf dist/ + +.PHONY: test +test: unit-test ## Run all tests + +.PHONY: unit-test +unit-test: ## Run unit tests only ifeq ($(GO),) $(error go command not found.) endif From 75c48e8812e3f56d25eb836c33a1204100572863 Mon Sep 17 00:00:00 2001 From: Devon Bautista <17506592+synackd@users.noreply.github.com> Date: Thu, 5 Mar 2026 18:15:40 -0700 Subject: [PATCH 5/8] build(Makefile): add 'help' target Signed-off-by: Devon Bautista <17506592+synackd@users.noreply.github.com> --- Makefile | 48 +++++++++++++++++++++++++++++------------------- README.md | 2 ++ 2 files changed, 31 insertions(+), 19 deletions(-) diff --git a/Makefile b/Makefile index dbaf09fd..0f6d2a14 100644 --- a/Makefile +++ b/Makefile @@ -6,6 +6,7 @@ GO ?= $(shell command -v go 2>/dev/null) GORELEASER ?= $(shell command -v goreleaser 2>/dev/null) GIT ?= $(shell command -v git 2>/dev/null) +AWK ?= $(shell command -v awk 2>/dev/null) # Use HOSTCMD to not conflict with Make's $(HOSTNAME) HOSTCMD ?= $(shell command -v hostname 2>/dev/null) INSTALL ?= $(shell command -v install 2>/dev/null) @@ -71,14 +72,23 @@ libexecdir ?= $(prefix)/usr/libexec/$(NAME) sharedir ?= $(prefix)/usr/share .PHONY: all -all: binaries +all: binaries ## Build everything .PHONY: binaries -binaries: $(NAME) +binaries: $(NAME) ## Build binaries +.PHONY: help +help: ## Show this help +ifeq ($(AWK),) + $(error awk command not found.) +endif + @$(AWK) 'BEGIN {FS = ":.*##"; printf "\nUsage:\n make \033[36m[VAR=val]... \033[0m\n\nTargets:\n"} \ + /^[a-zA-Z0-9_\/.-]+:.*##/ { \ + printf " \033[36m%-22s\033[0m %s\n", $$1, $$2 \ + }' $(MAKEFILE_LIST) .PHONY: goreleaser-build -goreleaser-build: +goreleaser-build: ## Run `goreleaser build` (accepts GORELEASER_OPTS) ifeq ($(GO),) $(error go command not found.) endif @@ -92,7 +102,7 @@ endif $(GORELEASER) build $(GORELEASER_OPTS) .PHONY: goreleaser-release -goreleaser-release: +goreleaser-release: ## Run `goreleaser release` (accepts GORELEASER_OPTS) ifeq ($(GO),) $(error go command not found.) endif @@ -120,38 +130,38 @@ endif $(GO) test -cover -v ./... .PHONY: clean -clean: +clean: ## Clean Go build artifacts ifeq ($(GO),) $(error go command not found.) endif $(GO) clean -i -x .PHONY: clean-man -clean-man: +clean-man: ## Clean generated manual pages rm -f $(MANBIN) .PHONY: clean-completions -clean-completions: +clean-completions: ## Clean generated shell completions rm -rf completions/ -completions: $(NAME) +completions: $(NAME) ## Generate shell completions ./scripts/completions.sh .PHONY: distclean -distclean: clean clean-completions clean-man +distclean: clean clean-completions clean-man ## Clean everything (prepare for distribution) .PHONY: install -install: install-prog install-helper install-completions install-man +install: install-prog install-helper install-completions install-man ## Install everything .PHONY: install-prog -install-prog: $(NAME) +install-prog: $(NAME) ## Install program ifeq ($(INSTALL),) $(error install command not found.) endif $(INSTALL_PROGRAM) $(NAME) $(DESTDIR)$(bindir)/$(NAME) .PHONY: install-helper -install-helper: $(HELPERS) +install-helper: $(HELPERS) ## Install helper scripts ifeq ($(INSTALL),) $(error install command not found.) endif @@ -160,7 +170,7 @@ endif done .PHONY: install-completions -install-completions: completions +install-completions: completions ## Install shell completions ifeq ($(INSTALL),) $(error install command not found.) endif @@ -169,7 +179,7 @@ endif $(INSTALL_DATA) ./completions/ochami.zsh $(DESTDIR)$(sharedir)/zsh/site-functions/_ochami .PHONY: install-man -install-man: $(MANBIN) +install-man: $(MANBIN) ## Install manual pages ifeq ($(INSTALL),) $(error install command not found.) endif @@ -179,7 +189,7 @@ endif $(INSTALL_DATA) $(MAN5BIN) $(DESTDIR)$(mandir)/man5/ .PHONY: man -man: $(MANBIN) +man: $(MANBIN) ## Generate manual pages man/%: man/%.sc ifeq ($(SCDOC),) @@ -188,20 +198,20 @@ endif $(SCDOC) < $< > $@ .PHONY: uninstall -uninstall: uninstall-prog uninstall-completions uninstall-man +uninstall: uninstall-prog uninstall-completions uninstall-man ## Uninstall everything .PHONY: uninstall-prog -uninstall-prog: +uninstall-prog: ## Uninstall program rm -f $(DESTDIR)$(bindir)/$(NAME) .PHONY: uninstall-completions -uninstall-completions: +uninstall-completions: ## Uninstall shell completions rm -f $(DESTDIR)/usr/share/bash-completion/completions/ochami rm -f $(DESTDIR)/usr/share/fish/vendor_completions.d/ochami.fish rm -f $(DESTDIR)/usr/share/zsh/site-functions/_ochami .PHONY: uninstall-man -uninstall-man: +uninstall-man: ## Uninstall manual pages rm -f $(foreach man1page,$(subst man/,,$(MAN1BIN)),$(DESTDIR)$(mandir)/man1/$(man1page)) rm -f $(foreach man5page,$(subst man/,,$(MAN5BIN)),$(DESTDIR)$(mandir)/man5/$(man5page)) diff --git a/README.md b/README.md index 23e548d5..1c4ae15d 100644 --- a/README.md +++ b/README.md @@ -166,6 +166,8 @@ make GORELEASER_OPTS='--clean --snapshot --single-target' goreleaser-build Make provides convenient and quick building for fast iteration and development. +Run `make help` to see available targets. + Linker flags are used to embed build metadata into the binary. Building can simply be done via: From 4c2bf439c3dbffa28e290a418b7b1da278d68f55 Mon Sep 17 00:00:00 2001 From: Devon Bautista <17506592+synackd@users.noreply.github.com> Date: Thu, 5 Mar 2026 18:41:32 -0700 Subject: [PATCH 6/8] build(Makefile): add 'check-reuse' target Signed-off-by: Devon Bautista <17506592+synackd@users.noreply.github.com> --- Makefile | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Makefile b/Makefile index 0f6d2a14..f7a7fb15 100644 --- a/Makefile +++ b/Makefile @@ -7,6 +7,7 @@ GO ?= $(shell command -v go 2>/dev/null) GORELEASER ?= $(shell command -v goreleaser 2>/dev/null) GIT ?= $(shell command -v git 2>/dev/null) AWK ?= $(shell command -v awk 2>/dev/null) +REUSE ?= $(shell command -v reuse 2>/dev/null) # Use HOSTCMD to not conflict with Make's $(HOSTNAME) HOSTCMD ?= $(shell command -v hostname 2>/dev/null) INSTALL ?= $(shell command -v install 2>/dev/null) @@ -119,6 +120,13 @@ endif goreleaser-clean: ## Clean Goreleaser files (remove dist/) $(RM) -rf dist/ +.PHONY: check-reuse +check-reuse: +ifeq ($(REUSE),) + $(error reuse command not found) +endif + reuse lint + .PHONY: test test: unit-test ## Run all tests From 56ccc96c0e9301596eab40ad975d16fddd7debc9 Mon Sep 17 00:00:00 2001 From: Devon Bautista <17506592+synackd@users.noreply.github.com> Date: Thu, 5 Mar 2026 18:38:42 -0700 Subject: [PATCH 7/8] build(Makefile): add 'lint' target Signed-off-by: Devon Bautista <17506592+synackd@users.noreply.github.com> --- Makefile | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/Makefile b/Makefile index f7a7fb15..1c363b45 100644 --- a/Makefile +++ b/Makefile @@ -3,16 +3,17 @@ # SPDX-License-Identifier: MIT # Set path to commands -GO ?= $(shell command -v go 2>/dev/null) -GORELEASER ?= $(shell command -v goreleaser 2>/dev/null) -GIT ?= $(shell command -v git 2>/dev/null) -AWK ?= $(shell command -v awk 2>/dev/null) -REUSE ?= $(shell command -v reuse 2>/dev/null) +GO ?= $(shell command -v go 2>/dev/null) +GOLANGCI_LINT ?= $(shell command -v golangci-lint 2>/dev/null) +GORELEASER ?= $(shell command -v goreleaser 2>/dev/null) +GIT ?= $(shell command -v git 2>/dev/null) +AWK ?= $(shell command -v awk 2>/dev/null) +REUSE ?= $(shell command -v reuse 2>/dev/null) # Use HOSTCMD to not conflict with Make's $(HOSTNAME) -HOSTCMD ?= $(shell command -v hostname 2>/dev/null) -INSTALL ?= $(shell command -v install 2>/dev/null) -SCDOC ?= $(shell command -v scdoc 2>/dev/null) -SHELL ?= /bin/sh +HOSTCMD ?= $(shell command -v hostname 2>/dev/null) +INSTALL ?= $(shell command -v install 2>/dev/null) +SCDOC ?= $(shell command -v scdoc 2>/dev/null) +SHELL ?= /bin/sh INSTALL_PROGRAM ?= $(INSTALL) -Dm755 INSTALL_DATA ?= $(INSTALL) -Dm644 @@ -127,6 +128,13 @@ ifeq ($(REUSE),) endif reuse lint +.PHONY: lint +lint: +ifeq ($(GOLANGCI_LINT),) + $(error golangci-lint command not found) +endif + $(GOLANGCI_LINT) run + .PHONY: test test: unit-test ## Run all tests From 6b476e2fd0286b0c95b383f49e1d303653dee27d Mon Sep 17 00:00:00 2001 From: Devon Bautista <17506592+synackd@users.noreply.github.com> Date: Thu, 5 Mar 2026 18:44:22 -0700 Subject: [PATCH 8/8] ci: unit-tests -> tests (uses 'make test') Signed-off-by: Devon Bautista <17506592+synackd@users.noreply.github.com> --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 6e41a7a6..3be81bef 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -14,7 +14,7 @@ on: pull_request: jobs: - unit_tests: + tests: runs-on: ubuntu-latest steps: - name: Set up latest stable Go