alpine-zdt-images/Makefile

33 lines
1.3 KiB
Makefile

OVERLAY := $(shell pwd)/overlay
# FILTER := --only 3.15 kubezero --skip aarch64
FILTER := --only 3.15 --skip aarch64
STEP := publish
all: build
build:
cd alpine-cloud-images && ./build $(STEP) --clean --revise $(FILTER) --custom $(OVERLAY)/zdt --vars $(OVERLAY)/zdt/zdt.hcl
clean:
rm -rf alpine-cloud-images/work
# Adds all tracked encrypted files to .gitignore as safety net
age-add-gitignore:
@touch .gitignore; for f in $$(yq eval .paths[] .age.yml); do grep -qxF $$f .gitignore || echo $$f >> .gitignore; done
# Decrypts all secrets and removes the .age file
age-unseal:
@for f in $$(yq eval .paths[] .age.yml); do \
age --decrypt -i ~/.ssh/git.age -o $$f $$f.age && rm $$f.age; \
done
# Encrypts all secrets, but compares the local unencrypted files with the decrypted content from the index first
# If there are no diffs, just restore the .age file from the index and delete the unaltered local unencrypted file
# If there are changes re-encrypt
age-seal:
@keys=$$(yq eval .keys[] .age.yml | sed -e 's/^/-r /' ); \
for f in $$(yq eval .paths[] .age.yml); do \
[ -f $$f ] || continue; \
git restore $${f}.age 2>/dev/null && age --decrypt -i ~/.ssh/git.age $$f.age | diff -q - $$f 2>/dev/null 1>&2 && \
rm -f $$f || ( rm -f $$f.age; age --encrypt $$keys -o $$f.age $$f && rm -f $$f; ); done