Skip to content

Commit

Permalink
feat: generate extensions descriptions file as part of extensions image
Browse files Browse the repository at this point in the history
Add all authors and descriptions to the `descriptions.yaml` file, then
add this file to the published `extensions` docker image.

Signed-off-by: Artem Chernyshev <artem.chernyshev@talos-systems.com>
(cherry picked from commit 57503cc)
  • Loading branch information
Unix4ever authored and smira committed Dec 26, 2023
1 parent 39024ae commit d0879ba
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 4 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# THIS FILE WAS AUTOMATICALLY GENERATED, PLEASE DO NOT EDIT.
#
# Generated on 2023-11-02T15:50:53Z by kres latest.
# Generated on 2023-12-25T17:44:28Z by kres latest.

_out
internal/extensions/image-digests
internal/extensions/descriptions.yaml
22 changes: 21 additions & 1 deletion .kres.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ kind: common.Build
spec:
ignoredPaths:
- "internal/extensions/image-digests"
- "internal/extensions/descriptions.yaml"
---
kind: auto.CustomSteps
spec:
Expand All @@ -55,6 +56,8 @@ spec:
toplevel: true
- name: internal/extensions/image-digests
toplevel: true
- name: internal/extensions/descriptions.yaml
toplevel: true
- name: sign-images
toplevel: true
---
Expand All @@ -70,7 +73,7 @@ spec:
- name: PKGS
defaultValue: v1.6.0-9-g8fa73db
depends:
- internal/extensions/image-digests
- internal/extensions/descriptions.yaml
script:
- |
@$(MAKE) docker-$@ TARGET_ARGS="--tag=$(EXTENSIONS_IMAGE_REF) --push=$(PUSH)"
Expand Down Expand Up @@ -104,9 +107,26 @@ spec:
- extensions-metadata
script:
- |
@echo "Generating image digests..."
@cat _out/extensions-metadata | xargs -I{} sh -c 'echo {}@$$(crane digest {})' > internal/extensions/image-digests
---
kind: custom.Step
name: internal/extensions/descriptions.yaml
spec:
makefile:
enabled: true
phony: true
depends:
- internal/extensions/image-digests
script:
- |
@echo "Generating image descriptions..."
@echo -n "" > internal/extensions/descriptions.yaml
@for image in $(shell cat internal/extensions/image-digests); do \
crane export $$image - | tar x -O --occurrence=1 manifest.yaml | yq -r ". += {\"$$image\": {\"author\": .metadata.author, \"description\": .metadata.description}} | del(.metadata, .version)" - >> internal/extensions/descriptions.yaml; \
done
---
kind: custom.Step
name: sign-images
spec:
makefile:
Expand Down
13 changes: 11 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# THIS FILE WAS AUTOMATICALLY GENERATED, PLEASE DO NOT EDIT.
#
# Generated on 2023-12-22T08:42:50Z by kres latest.
# Generated on 2023-12-26T13:31:34Z by kres latest.

# common variables

Expand Down Expand Up @@ -163,7 +163,7 @@ deps.png: ## Generates a dependency graph of the Pkgfile.
@$(BLDR) graph | dot -Tpng -o deps.png

.PHONY: extensions
extensions: internal/extensions/image-digests
extensions: internal/extensions/descriptions.yaml
@$(MAKE) docker-$@ TARGET_ARGS="--tag=$(EXTENSIONS_IMAGE_REF) --push=$(PUSH)"

.PHONY: extensions-metadata
Expand All @@ -174,8 +174,17 @@ extensions-metadata: $(ARTIFACTS)/bldr

.PHONY: internal/extensions/image-digests
internal/extensions/image-digests: extensions-metadata
@echo "Generating image digests..."
@cat _out/extensions-metadata | xargs -I{} sh -c 'echo {}@$$(crane digest {})' > internal/extensions/image-digests

.PHONY: internal/extensions/descriptions.yaml
internal/extensions/descriptions.yaml: internal/extensions/image-digests
@echo "Generating image descriptions..."
@echo -n "" > internal/extensions/descriptions.yaml
@for image in $(shell cat internal/extensions/image-digests); do \
crane export $$image - | tar x -O --occurrence=1 manifest.yaml | yq -r ". += {\"$$image\": {\"author\": .metadata.author, \"description\": .metadata.description}} | del(.metadata, .version)" - >> internal/extensions/descriptions.yaml; \
done

.PHONY: sign-images
sign-images:
@for image in $(shell crane export $(EXTENSIONS_IMAGE_REF) | tar x --to-stdout image-digests) $(EXTENSIONS_IMAGE_REF)@$$(crane digest $(EXTENSIONS_IMAGE_REF)); do \
Expand Down
2 changes: 2 additions & 0 deletions internal/extensions/pkg.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,5 @@ variant: scratch
finalize:
- from: /pkg/image-digests
to: /image-digests
- from: /pkg/descriptions.yaml
to: /descriptions.yaml

0 comments on commit d0879ba

Please sign in to comment.