Skip to content

Commit 232d044

Browse files
committed
Improved help
1 parent 2c44a96 commit 232d044

File tree

7 files changed

+70
-136
lines changed

7 files changed

+70
-136
lines changed

Makefile

+4-70
Original file line numberDiff line numberDiff line change
@@ -69,81 +69,15 @@ info: ; $(info $(M) Runtime info...)
6969

7070
.PHONY:
7171
help:
72-
@echo
73-
@echo "General targets:"
74-
@echo " all (default) Build all tools"
75-
@echo " help Display help for targets"
76-
@echo " clean Remove all temporary files"
77-
@echo " metadata.json Generate inventory from tools/*/manifest.json"
78-
@echo " metadata.json--build Build metadata image from @metadata/ and metadata.json"
79-
@echo " metadata.json--push Push metadata image"
80-
@echo " metadata.json--show Push metadata image"
81-
@echo
82-
@echo "Dependency management:"
83-
@echo " renovate.json Generate from tools/*/manifest.json"
84-
@echo " tools/<tool>/manifest.json Generate from tools/*/manifest.yaml"
85-
@echo
86-
@echo "Reflection:"
87-
@echo " info Display configuration data"
88-
@echo " list List available tools"
89-
@echo " size Display storage usage"
90-
@echo " <tool>--show Display directory contents"
91-
@echo
92-
@echo "Building:"
93-
@echo " tools/<tool>/Dockerfile Generate from tools/*/Dockerfile.template"
94-
@echo " base Build base container image for all tool installations"
95-
@echo " <tool> Build container image for specific tool"
96-
@echo " <tool>--debug Build container image specific tool and enter shell"
97-
@echo " <tool>--test Test a tool in a container image"
98-
@echo " <tool>--deep Build container image including all dependencies"
99-
@echo " debug Enter shell in base image"
100-
@echo " push Push all container images"
101-
@echo " <tool>--push Push container image for specific tool"
102-
@echo " <tool>--inspect Inspect pushed container image for specific tool"
103-
@echo " tag-usage Show how many times the tag is used"
104-
@echo " assert-no-hardcoded-version Display tools with hardcoded versions"
105-
@echo
106-
@echo "Security:"
107-
@echo " cosign.key Create cosign key pair"
108-
@echo " metadata.json--sign Sign metadata container image"
109-
@echo " sign Sign all container images"
110-
@echo " <tool>--sign Sign container image for specific tool"
111-
@echo " sbom Create SBoM for all tools"
112-
@echo " <tool>--sbom Create SBoM for a specific tool"
113-
@echo " tools/<tool>/sbom.json Create SBoM for specific tool"
114-
@echo " <tool>--scan Scan SBoM for vulnerabilities"
115-
@echo " attest Attest SBoM for all tools"
116-
@echo " <tool>--attest Attest SBoM for specific tool"
117-
@echo " install Push, sign and attest all container images"
118-
@echo " <tool>--install Push, sign and attest container image for specific tool"
119-
@echo
120-
@echo "Git operations:"
121-
@echo " recent Show tools changed in the last 3 days"
122-
@echo " recent-days--<N> Show tools changed in the last <N> days"
123-
@echo
124-
@echo "Helper tools:"
125-
@echo " $(HELPER)/var/lib/uniget/manifests/<tool>.json"
126-
@echo " Install specified tool to helper/"
127-
@echo
128-
@echo "GHCR:"
129-
@echo " clean-registry-untagged Remove all untagged container images"
130-
@echo " clean-ghcr-unused--<tool> Remove a tag on all container images"
131-
@echo " ghcr-orphaned List container image without a tools/<tool>/manifest.yaml"
132-
@echo " ghcr-exists--<tool> Check is a container image exists"
133-
@echo " ghcr-exists Check if all container images exist"
134-
@echo " ghcr-inspect List tags for all container images"
135-
@echo " <tool>--ghcr-tags Display tags for a container image"
136-
@echo " <tool>--ghcr-inspect Display API object for a container image"
137-
@echo " delete-ghcr--<tool> Delete container image"
138-
@echo " ghcr-private List all private container images"
72+
@awk 'BEGIN {FS = ":.*?## "} /^[a-zA-Z_-]+:.*?## / {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}' $(MAKEFILE_LIST)
13973
@echo
14074
@echo "Reminder: foo-% => \$$@=foo-bar \$$*=bar"
14175
@echo
14276
@echo "Only some tools: TOOLS_RAW=\$$(jq -r '.tools[].name' metadata.json | grep ^k | xargs echo) make info"
14377
@echo
14478

14579
.PHONY:
146-
clean:
80+
clean: ## Remove all temporary files
14781
@set -o errexit; \
14882
rm -f metadata.json; \
14983
rm -rf helper; \
@@ -156,11 +90,11 @@ clean:
15690
done
15791

15892
.PHONY:
159-
list:
93+
list: ## List available tools
16094
@echo "$(ALL_TOOLS_RAW)"
16195

16296
.PHONY:
163-
$(addsuffix --show,$(ALL_TOOLS_RAW)):%--show: $(TOOLS_DIR)/$*
97+
$(addsuffix --show,$(ALL_TOOLS_RAW)):%--show: $(TOOLS_DIR)/$* ## Display directory contents
16498
@ls -l $(TOOLS_DIR)/$*
16599

166100
-include .env.mk

make/dev.mk

+3-3
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@ renovate.json: \
22
scripts/renovate.sh \
33
renovate-root.json \
44
metadata.json \
5-
; $(info $(M) Updating $@...)
5+
; $(info $(M) Updating $@...) ## Update renovate configuration
66
@bash scripts/renovate.sh
77

88
.PHONY:
9-
size:
9+
size: ## Display storage usage
1010
@set -o errexit; \
1111
export VERSION=$(VERSION); \
1212
bash scripts/usage.sh $(TOOLS_RAW)
@@ -16,7 +16,7 @@ recent: \
1616
recent-days--3
1717

1818
.PHONY:
19-
recent-days--%:
19+
recent-days--%: ## Show tools changed in the last N days
2020
@set -o errexit; \
2121
CHANGED_TOOLS="$$( \
2222
git log --pretty=format: --name-only --since="$* days ago" \

make/ghcr.mk

+13-13
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
.PHONY:
22
clean-registry-untagged: \
33
$(HELPER)/var/lib/uniget/manifests/gh.json \
4-
$(HELPER)/var/lib/uniget/manifests/gojq.json
4+
$(HELPER)/var/lib/uniget/manifests/gojq.json ## Remove all untagged container images
55
@set -o errexit; \
66
if test -z "$${GH_TOKEN}" && ! test -f "$${HOME}/.config/gh/hosts.yml"; then \
77
echo "### Error: Need GH_TOKEN or configured gh."; \
@@ -21,7 +21,7 @@ clean-registry-untagged: \
2121
.PHONY:
2222
clean-registry-untagged--%: \
2323
$(HELPER)/var/lib/uniget/manifests/gh.json \
24-
$(HELPER)/var/lib/uniget/manifests/gojq.json
24+
$(HELPER)/var/lib/uniget/manifests/gojq.json ## Remove a tag on all container images
2525
@set -o errexit; \
2626
if test -z "$${GH_TOKEN}" && ! test -f "$${HOME}/.config/gh/hosts.yml"; then \
2727
echo "### Error: Need GH_TOKEN or configured gh."; \
@@ -38,7 +38,7 @@ clean-registry-untagged--%: \
3838
.PHONY:
3939
clean-ghcr-unused--%: \
4040
$(HELPER)/var/lib/uniget/manifests/gh.json \
41-
$(HELPER)/var/lib/uniget/manifests/gojq.json
41+
$(HELPER)/var/lib/uniget/manifests/gojq.json ## ???
4242
@set -o errexit; \
4343
if test -z "$${GH_TOKEN}" && ! test -f "$${HOME}/.config/gh/hosts.yml"; then \
4444
echo "### Error: Need GH_TOKEN or configured gh."; \
@@ -58,7 +58,7 @@ clean-ghcr-unused--%: \
5858
.PHONY:
5959
ghcr-orphaned: \
6060
$(HELPER)/var/lib/uniget/manifests/gh.json \
61-
$(HELPER)/var/lib/uniget/manifests/gojq.json
61+
$(HELPER)/var/lib/uniget/manifests/gojq.json ## List container image without a tools/<tool>/manifest.yaml
6262
@set -o errexit; \
6363
gh api --paginate /users/$(OWNER)/packages?package_type=container | jq --raw-output '.[].name' \
6464
| cut -d/ -f2 \
@@ -73,17 +73,17 @@ ghcr-orphaned: \
7373

7474
.PHONY:
7575
ghcr-exists--%: \
76-
$(HELPER)/var/lib/uniget/manifests/gh.json
76+
$(HELPER)/var/lib/uniget/manifests/gh.json ## Check if a container image exists
7777
@gh api --paginate "users/$(OWNER)/packages/container/uniget%2F$*" >/dev/null 2>&1
7878

7979
.PHONY:
8080
ghcr-exists: \
81-
$(addprefix ghcr-exists--,$(TOOLS_RAW))
81+
$(addprefix ghcr-exists--,$(TOOLS_RAW)) ## Check if all container images exist
8282

8383
.PHONY:
8484
ghcr-inspect: \
8585
$(HELPER)/var/lib/uniget/manifests/gh.json \
86-
$(HELPER)/var/lib/uniget/manifests/gojq.json
86+
$(HELPER)/var/lib/uniget/manifests/gojq.json ## List tags for all container images
8787
@set -o errexit; \
8888
gh api --paginate /users/$(OWNER)/packages?package_type=container | jq --raw-output '.[].name' \
8989
| while read NAME; do \
@@ -95,7 +95,7 @@ ghcr-inspect: \
9595
.PHONY:
9696
$(addsuffix --ghcr-tags,$(ALL_TOOLS_RAW)):%--ghcr-tags: \
9797
$(HELPER)/var/lib/uniget/manifests/gh.json \
98-
$(HELPER)/var/lib/uniget/manifests/gojq.json
98+
$(HELPER)/var/lib/uniget/manifests/gojq.json ## Display tags for a container image
9999
@set -o errexit; \
100100
gh api --paginate "users/$(OWNER)/packages/container/uniget%2F$*/versions" \
101101
| jq --raw-output '.[] | "\(.metadata.container.tags[]);\(.name);\(.id)"' \
@@ -104,7 +104,7 @@ $(addsuffix --ghcr-tags,$(ALL_TOOLS_RAW)):%--ghcr-tags: \
104104
.PHONY:
105105
$(addsuffix --ghcr-inspect,$(ALL_TOOLS_RAW)):%--ghcr-inspect: \
106106
$(HELPER)/var/lib/uniget/manifests/gh.json \
107-
$(HELPER)/var/lib/uniget/manifests/yq.json
107+
$(HELPER)/var/lib/uniget/manifests/yq.json ## Display API object for a container image
108108
@set -o errexit; \
109109
gh api --paginate "users/$(OWNER)/packages/container/uniget%2F$*" \
110110
| yq --prettyPrint
@@ -113,7 +113,7 @@ $(addsuffix --ghcr-inspect,$(ALL_TOOLS_RAW)):%--ghcr-inspect: \
113113
$(addsuffix --ghcr-delete-test,$(ALL_TOOLS_RAW)):%--ghcr-delete-test: \
114114
$(HELPER)/var/lib/uniget/manifests/gh.json \
115115
$(HELPER)/var/lib/uniget/manifests/yq.json \
116-
; $(info $(M) Removing tag test from tool $*...)
116+
; $(info $(M) Removing tag test from tool $*...) ## ???
117117
@\
118118
helper/usr/local/bin/gh api --paginate "users/$(OWNER)/packages/container/uniget%2F$*/versions" \
119119
| jq --raw-output '.[] | select(.metadata.container.tags[] | contains("test")) | .id' \
@@ -123,7 +123,7 @@ $(addsuffix --ghcr-delete-test,$(ALL_TOOLS_RAW)):%--ghcr-delete-test: \
123123
.PHONY:
124124
delete-ghcr--%: \
125125
$(HELPER)/var/lib/uniget/manifests/gh.json \
126-
$(HELPER)/var/lib/uniget/manifests/gojq.json
126+
$(HELPER)/var/lib/uniget/manifests/gojq.json ## Delete container image
127127
@set -o errexit; \
128128
if test -z "$${GH_TOKEN}" && ! test -f "$${HOME}/.config/gh/hosts.yml"; then \
129129
echo "### Error: Need GH_TOKEN or configured gh."; \
@@ -141,7 +141,7 @@ delete-ghcr--%: \
141141
.PHONY:
142142
ghcr-private: \
143143
$(HELPER)/var/lib/uniget/manifests/gh.json \
144-
$(HELPER)/var/lib/uniget/manifests/gojq.json
144+
$(HELPER)/var/lib/uniget/manifests/gojq.json ## List all private container images
145145
@set -o errexit; \
146146
gh api --paginate "users/$(OWNER)/packages?package_type=container&visibility=private" \
147147
| jq '.[] | "\(.name);\(.html_url)"' \
@@ -151,6 +151,6 @@ ghcr-private: \
151151
$(addsuffix --ghcr-private,$(ALL_TOOLS_RAW)): \
152152
$(HELPER)/var/lib/uniget/manifests/gh.json \
153153
$(HELPER)/var/lib/uniget/manifests/gojq.json \
154-
; $(info $(M) Testing that $* is publicly visible...)
154+
; $(info $(M) Testing that $* is publicly visible...) ## ???
155155
@gh api "users/$(OWNER)/packages/container/uniget%2F$*" \
156156
| jq --exit-status 'select(.visibility == "public")' >/dev/null 2>&1

make/helper.mk

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
.PHONY:
22
$(addprefix helper--,$(ALL_TOOLS_RAW)):helper--%: \
3-
$(HELPER)/var/lib/uniget/manifests/%.json
3+
$(HELPER)/var/lib/uniget/manifests/%.json ## ???
44

5-
$(HELPER)/var/lib/uniget/manifests/%.json:
5+
$(HELPER)/var/lib/uniget/manifests/%.json: ## Install specified tool to helper/
66
@if ! type uniget >/dev/null 2>&1; then \
77
echo "Please install uniget"; \
88
exit 1; \

make/metadata.mk

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
metadata.json: \
22
$(HELPER)/var/lib/uniget/manifests/gojq.json \
33
$(addsuffix /manifest.json,$(ALL_TOOLS)) \
4-
; $(info $(M) Creating $@...)
4+
; $(info $(M) Creating $@...) ## Generate inventory from tools/*/manifest.json
55
@jq --slurp --arg revision "$(GIT_COMMIT_SHA)" '{"revision": $$revision, "tools": map(.tools[])}' $(addsuffix /manifest.json,$(ALL_TOOLS)) >metadata.json
66

77
.PHONY:
8-
metadata.json--show:%--show:
8+
metadata.json--show:%--show: ## Push metadata image
99
@less $*
1010

1111
.PHONY:
1212
metadata.json--build: \
1313
metadata.json \
1414
@metadata/Dockerfile builders \
15-
; $(info $(M) Building metadata image for $(GIT_COMMIT_SHA)...)
15+
; $(info $(M) Building metadata image for $(GIT_COMMIT_SHA)...) ## Build metadata image from @metadata/ and metadata.json
1616
@set -o errexit; \
1717
if ! docker buildx build . \
1818
--builder uniget \
@@ -32,20 +32,20 @@ metadata.json--push: \
3232
PUSH=true
3333
metadata.json--push: \
3434
metadata.json--build \
35-
; $(info $(M) Pushing metadata image...)
35+
; $(info $(M) Pushing metadata image...) ## Push metadata image
3636

3737
.PHONY:
3838
metadata.json--sign: \
3939
$(HELPER)/var/lib/uniget/manifests/cosign.json \
4040
cosign.key \
41-
; $(info $(M) Signing metadata image...)
41+
; $(info $(M) Signing metadata image...) ## ???
4242
@set -o errexit; \
4343
source .env; \
4444
cosign sign --key cosign.key $(REGISTRY)/$(REPOSITORY_PREFIX)metadata:$(DOCKER_TAG)
4545

4646
.PHONY:
4747
metadata.json--keyless-sign: \
4848
$(HELPER)/var/lib/uniget/manifests/cosign.json \
49-
; $(info $(M) Keyless signing metadata image...)
49+
; $(info $(M) Keyless signing metadata image...) ## ???
5050
@set -o errexit; \
5151
COSIGN_EXPERIMENTAL=1 cosign sign $(REGISTRY)/$(REPOSITORY_PREFIX)metadata:$(DOCKER_TAG)

0 commit comments

Comments
 (0)