REGISTRY := public.ecr.aws/zero-downtime IMAGE := alpine-builder REGION := us-east-1 include .ci/podman.mk BUILDER := v3.16.2 PKG := '*' CF_DIST := E1YFUJXMCXT2RN ARCH := '' BUILDER_RELEASE = $(shell echo $(BUILDER) | sed -e 's/-.*$$//') RELEASE := $(shell echo $(BUILDER_RELEASE) | sed -e 's/\.[0-9]$$//') .PHONY: apk aports download upload packages invalidate_cdn aarch64-toolchain: @podman run -it --rm \ -v ${PWD}/distfiles:/var/cache/distfiles \ -v ${PWD}/packages:/home/alpine/packages \ -v ${PWD}/aports:/home/alpine/aports \ -v ${HOME}/.gitconfig/:/home/alpine/.gitconfig:ro \ -v ${HOME}/.abuild/:/home/alpine/.abuild:ro \ $(REGISTRY)/$(IMAGE):$(TAG) aarch64-toolchain packages: reset-permissions mkdir -p packages/kubezero/aarch64 packages/kubezero/x86_64 distfiles: mkdir -p distfiles aports: reset-permissions @[ -d aports/.git ] && { cd aports; git pull origin $(BUILDER_RELEASE); } @[ -d aports/.git ] || { git clone https://gitlab.alpinelinux.org/alpine/aports.git && \ cd aports && git checkout $(BUILDER_RELEASE); } apk: packages distfiles podman run -it --rm \ -v ${PWD}/distfiles:/var/cache/distfiles \ -v ${PWD}/packages:/home/alpine/packages \ -v ${PWD}/aports:/home/alpine/aports \ -v ${PWD}/kubezero:/home/alpine/kubezero \ -v ${HOME}/.gitconfig/:/home/alpine/.gitconfig:ro \ -v ${HOME}/.abuild/:/home/alpine/.abuild:ro \ $(REGISTRY)/$(IMAGE):$(TAG) $(PKG) $(ARCH) reset-permissions: @[ -d aports ] && doas chown -R $(USER): aports @[ -d distfiles ] && doas chown -R $(USER): distfiles @[ -d packages ] && doas chown -R $(USER): packages @[ -d kubezero ] && doas chown -R $(USER): kubezero download: aws s3 sync s3://zero-downtime-web/cdn/alpine/$(RELEASE)/kubezero/x86_64/ packages/kubezero/x86_64/ --exclude APKINDEX.tar.gz aws s3 sync s3://zero-downtime-web/cdn/alpine/$(RELEASE)/kubezero/aarch64/ packages/kubezero/aarch64/ --exclude APKINDEX.tar.gz invalidate_cdn: aws cloudfront create-invalidation --distribution $(CF_DIST) --paths "/alpine/*" upload: invalidate_cdn aws s3 sync --delete packages/kubezero/x86_64/ s3://zero-downtime-web/cdn/alpine/$(RELEASE)/kubezero/x86_64/ --exclude APKINDEX.tar.gz aws s3 sync --delete packages/kubezero/aarch64/ s3://zero-downtime-web/cdn/alpine/$(RELEASE)/kubezero/aarch64/ --exclude APKINDEX.tar.gz aws s3 cp packages/kubezero/x86_64/APKINDEX.tar.gz s3://zero-downtime-web/cdn/alpine/$(RELEASE)/kubezero/x86_64/ --cache-control max-age=1 aws s3 cp packages/kubezero/aarch64/APKINDEX.tar.gz s3://zero-downtime-web/cdn/alpine/$(RELEASE)/kubezero/aarch64/ --cache-control max-age=1