Skip to content

Commit

Permalink
Calculate tags and version automatically
Browse files Browse the repository at this point in the history
Signed-off-by: Andrei Kvapil <kvapss@gmail.com>
  • Loading branch information
kvaps committed Apr 23, 2024
1 parent ca79f72 commit e6a7a01
Show file tree
Hide file tree
Showing 40 changed files with 108 additions and 109 deletions.
25 changes: 0 additions & 25 deletions hack/prepare_release.sh

This file was deleted.

14 changes: 6 additions & 8 deletions packages/apps/http-cache/Makefile
Original file line number Diff line number Diff line change
@@ -1,22 +1,20 @@
PUSH := 1
LOAD := 0
REGISTRY := ghcr.io/aenix-io/cozystack
NGINX_CACHE_TAG = v0.1.0
TAG := v0.3.1

include ../../../scripts/common-envs.mk

image: image-nginx

image-nginx:
docker buildx build --platform linux/amd64 --build-arg ARCH=amd64 images/nginx-cache \
--provenance false \
--tag $(REGISTRY)/nginx-cache:$(NGINX_CACHE_TAG) \
--tag $(REGISTRY)/nginx-cache:$(NGINX_CACHE_TAG)-$(TAG) \
--cache-from type=registry,ref=$(REGISTRY)/nginx-cache:$(NGINX_CACHE_TAG) \
--tag $(REGISTRY)/nginx-cache:$(call gentag,$(NGINX_CACHE_TAG)) \
--tag $(REGISTRY)/nginx-cache:$(call gentag,$(NGINX_CACHE_TAG)-$(TAG)) \
--cache-from type=registry,ref=$(REGISTRY)/nginx-cache:latest \
--cache-to type=inline \
--metadata-file images/nginx-cache.json \
--push=$(PUSH) \
--load=$(LOAD)
echo "$(REGISTRY)/nginx-cache:$(NGINX_CACHE_TAG)" > images/nginx-cache.tag
echo "$(REGISTRY)/nginx-cache:$(call gentag,$(NGINX_CACHE_TAG))" > images/nginx-cache.tag

update:
tag=$$(git ls-remote --tags --sort="v:refname" https://github.com/chrislim2888/IP2Location-C-Library | awk -F'[/^]' 'END{print $$3}') && \
Expand Down
14 changes: 6 additions & 8 deletions packages/apps/kubernetes/Makefile
Original file line number Diff line number Diff line change
@@ -1,19 +1,17 @@
PUSH := 1
LOAD := 0
REGISTRY := ghcr.io/aenix-io/cozystack
TAG := v0.3.1
UBUNTU_CONTAINER_DISK_TAG = v1.29.1

include ../../../scripts/common-envs.mk

image: image-ubuntu-container-disk

image-ubuntu-container-disk:
docker buildx build --platform linux/amd64 --build-arg ARCH=amd64 images/ubuntu-container-disk \
--provenance false \
--tag $(REGISTRY)/ubuntu-container-disk:$(UBUNTU_CONTAINER_DISK_TAG) \
--tag $(REGISTRY)/ubuntu-container-disk:$(UBUNTU_CONTAINER_DISK_TAG)-$(TAG) \
--cache-from type=registry,ref=$(REGISTRY)/ubuntu-container-disk:$(UBUNTU_CONTAINER_DISK_TAG) \
--tag $(REGISTRY)/ubuntu-container-disk:$(call gentag,$(UBUNTU_CONTAINER_DISK_TAG)) \
--tag $(REGISTRY)/ubuntu-container-disk:$(call gentag,$(UBUNTU_CONTAINER_DISK_TAG)-$(TAG)) \
--cache-from type=registry,ref=$(REGISTRY)/ubuntu-container-disk:latest \
--cache-to type=inline \
--metadata-file images/ubuntu-container-disk.json \
--push=$(PUSH) \
--load=$(LOAD)
echo "$(REGISTRY)/ubuntu-container-disk:$(UBUNTU_CONTAINER_DISK_TAG)" > images/ubuntu-container-disk.tag
echo "$(REGISTRY)/ubuntu-container-disk:$(call gentag,$(UBUNTU_CONTAINER_DISK_TAG))" > images/ubuntu-container-disk.tag
6 changes: 0 additions & 6 deletions packages/core/Makefile

This file was deleted.

3 changes: 2 additions & 1 deletion packages/core/fluxcd/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
apiVersion: v2
name: cozy-fluxcd
version: 0.3.1
version: 0.0.0 # Placeholder, the actual version will be automatically set during the build process
3 changes: 2 additions & 1 deletion packages/core/installer/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
apiVersion: v2
name: cozy-installer
version: 0.3.1
version: 0.0.0 # Placeholder, the actual version will be automatically set during the build process
25 changes: 12 additions & 13 deletions packages/core/installer/Makefile
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
NAME=installer
NAMESPACE=cozy-system
PUSH := 1
LOAD := 0
REGISTRY := ghcr.io/aenix-io/cozystack
TAG := v0.3.1

TALOS_VERSION=$(shell awk '/^version:/ {print $$2}' images/talos/profiles/installer.yaml)

include ../../../scripts/common-envs.mk

show:
helm template -n $(NAMESPACE) $(NAME) .

Expand All @@ -24,33 +23,33 @@ image-cozystack:
make -C ../../.. repos
docker buildx build -f images/cozystack/Dockerfile ../../.. \
--provenance false \
--tag $(REGISTRY)/cozystack:$(TAG) \
--cache-from type=registry,ref=$(REGISTRY)/cozystack:$(TAG) \
--tag $(REGISTRY)/cozystack:$(call settag,$(TAG)) \
--cache-from type=registry,ref=$(REGISTRY)/cozystack:latest \
--cache-to type=inline \
--metadata-file images/cozystack.json \
--push=$(PUSH) \
--load=$(LOAD)
echo "$(REGISTRY)/cozystack:$(TAG)" > images/cozystack.tag
echo "$(REGISTRY)/cozystack:$(call settag,$(TAG))" > images/cozystack.tag

image-talos:
test -f ../../../_out/assets/installer-amd64.tar || make talos-installer
docker load -i ../../../_out/assets/installer-amd64.tar
docker tag ghcr.io/siderolabs/installer:$(TALOS_VERSION) ghcr.io/aenix-io/cozystack/talos:$(TALOS_VERSION)
docker push ghcr.io/aenix-io/cozystack/talos:$(TALOS_VERSION)
docker tag ghcr.io/siderolabs/installer:$(TALOS_VERSION) ghcr.io/aenix-io/cozystack/talos:$(call settag,$(TALOS_VERSION))
docker push ghcr.io/aenix-io/cozystack/talos:$(call settag,$(TALOS_VERSION))

image-matchbox:
test -f ../../../_out/assets/kernel-amd64 || make talos-kernel
test -f ../../../_out/assets/initramfs-metal-amd64.xz || make talos-initramfs
docker buildx build -f images/matchbox/Dockerfile ../../.. \
--provenance false \
--tag $(REGISTRY)/matchbox:$(TAG) \
--tag $(REGISTRY)/matchbox:$(TALOS_VERSION)-$(TAG) \
--cache-from type=registry,ref=$(REGISTRY)/matchbox:$(TALOS_VERSION) \
--tag $(REGISTRY)/matchbox:$(call settag,$(TAG)) \
--tag $(REGISTRY)/matchbox:$(call settag,$(TALOS_VERSION)-$(TAG)) \
--cache-from type=registry,ref=$(REGISTRY)/matchbox:latest \
--cache-to type=inline \
--metadata-file images/matchbox.json \
--push=$(PUSH) \
--load=$(LOAD)
echo "$(REGISTRY)/matchbox:$(TALOS_VERSION)" > images/matchbox.tag
echo "$(REGISTRY)/matchbox:$(call settag,$(TALOS_VERSION))" > images/matchbox.tag

assets: talos-iso talos-nocloud

Expand Down
3 changes: 2 additions & 1 deletion packages/core/platform/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
apiVersion: v2
name: cozy-platform
version: 0.3.1
version: 0.0.0 # Placeholder, the actual version will be automatically set during the build process
10 changes: 3 additions & 7 deletions packages/system/Makefile
Original file line number Diff line number Diff line change
@@ -1,13 +1,9 @@
OUT=../../_out/repos/system
VERSION := 0.3.1

gen: fix-chartnames
include ../../scripts/common-envs.mk

repo: fix-chartnames
repo:
rm -rf "$(OUT)"
mkdir -p "$(OUT)"
helm package -d "$(OUT)" $$(find . -mindepth 2 -maxdepth 2 -name Chart.yaml | awk 'sub("/Chart.yaml", "")')
helm package -d "$(OUT)" $$(find . -mindepth 2 -maxdepth 2 -name Chart.yaml | awk 'sub("/Chart.yaml", "")') --version $(VERSION)
cd "$(OUT)" && helm repo index .

fix-chartnames:
find . -name Chart.yaml -maxdepth 2 | awk -F/ '{print $$2}' | while read i; do printf "name: cozy-%s\nversion: $(VERSION)\n" "$$i" > "$$i/Chart.yaml"; done
3 changes: 2 additions & 1 deletion packages/system/capi-operator/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
apiVersion: v2
name: cozy-capi-operator
version: 0.3.1
version: 0.0.0 # Placeholder, the actual version will be automatically set during the build process
3 changes: 2 additions & 1 deletion packages/system/capi-providers/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
apiVersion: v2
name: cozy-capi-providers
version: 0.3.1
version: 0.0.0 # Placeholder, the actual version will be automatically set during the build process
3 changes: 2 additions & 1 deletion packages/system/cert-manager-issuers/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
apiVersion: v2
name: cozy-cert-manager-issuers
version: 0.3.1
version: 0.0.0 # Placeholder, the actual version will be automatically set during the build process
3 changes: 2 additions & 1 deletion packages/system/cert-manager/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
apiVersion: v2
name: cozy-cert-manager
version: 0.3.1
version: 0.0.0 # Placeholder, the actual version will be automatically set during the build process
3 changes: 2 additions & 1 deletion packages/system/cilium/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
apiVersion: v2
name: cozy-cilium
version: 0.3.1
version: 0.0.0 # Placeholder, the actual version will be automatically set during the build process
3 changes: 2 additions & 1 deletion packages/system/clickhouse-operator/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
apiVersion: v2
name: cozy-clickhouse-operator
version: 0.3.1
version: 0.0.0 # Placeholder, the actual version will be automatically set during the build process
3 changes: 2 additions & 1 deletion packages/system/dashboard/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
apiVersion: v2
name: cozy-dashboard
version: 0.3.1
version: 0.0.0 # Placeholder, the actual version will be automatically set during the build process
17 changes: 7 additions & 10 deletions packages/system/dashboard/Makefile
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
NAME=dashboard
NAMESPACE=cozy-$(NAME)
PUSH := 1
LOAD := 0
REPOSITORY := ghcr.io/aenix-io/cozystack
TAG := v0.3.1

include ../../../scripts/common-envs.mk
include ../../../scripts/package-system.mk

update: update-chart update-dockerfiles
Expand All @@ -30,21 +27,21 @@ update-dockerfiles:
image-dashboard:
docker buildx build images/dashboard \
--provenance false \
--tag $(REPOSITORY)/dashboard:$(TAG) \
--cache-from type=registry,ref=$(REPOSITORY)/dashboard:$(TAG) \
--tag $(REGISTRY)/dashboard:$(call gentag,$(TAG)) \
--cache-from type=registry,ref=$(REGISTRY)/dashboard:latest \
--cache-to type=inline \
--metadata-file images/dashboard.json \
--push=$(PUSH) \
--load=$(LOAD)
echo "$(REPOSITORY)/dashboard:$(TAG)" > images/dashboard.tag
echo "$(REGISTRY)/dashboard:$(call gentag,$(TAG))" > images/dashboard.tag

image-kubeapps-apis:
docker buildx build images/kubeapps-apis \
--provenance false \
--tag $(REPOSITORY)/kubeapps-apis:$(TAG) \
--cache-from type=registry,ref=$(REPOSITORY)/kubeapps-apis:$(TAG) \
--tag $(REGISTRY)/kubeapps-apis:$(call gentag,$(TAG)) \
--cache-from type=registry,ref=$(REGISTRY)/kubeapps-apis:latest \
--cache-to type=inline \
--metadata-file images/kubeapps-apis.json \
--push=$(PUSH) \
--load=$(LOAD)
echo "$(REPOSITORY)/kubeapps-apis:$(TAG)" > images/kubeapps-apis.tag
echo "$(REGISTRY)/kubeapps-apis:$(call gentag,$(TAG))" > images/kubeapps-apis.tag
3 changes: 2 additions & 1 deletion packages/system/grafana-oncall/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
apiVersion: v2
name: cozy-grafana-oncall
version: 0.3.1
version: 0.0.0 # Placeholder, the actual version will be automatically set during the build process
3 changes: 2 additions & 1 deletion packages/system/grafana-operator/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
apiVersion: v2
name: cozy-grafana-operator
version: 0.3.1
version: 0.0.0 # Placeholder, the actual version will be automatically set during the build process
3 changes: 2 additions & 1 deletion packages/system/ingress-nginx/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
apiVersion: v2
name: cozy-ingress-nginx
version: 0.3.1
version: 0.0.0 # Placeholder, the actual version will be automatically set during the build process
3 changes: 2 additions & 1 deletion packages/system/kafka-operator/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
apiVersion: v2
name: cozy-kafka-operator
version: 0.3.1
version: 0.0.0 # Placeholder, the actual version will be automatically set during the build process
3 changes: 2 additions & 1 deletion packages/system/kamaji-etcd/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
apiVersion: v2
name: cozy-kamaji-etcd
version: 0.3.1
version: 0.0.0 # Placeholder, the actual version will be automatically set during the build process
3 changes: 2 additions & 1 deletion packages/system/kamaji/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
apiVersion: v2
name: cozy-kamaji
version: 0.3.1
version: 0.0.0 # Placeholder, the actual version will be automatically set during the build process
3 changes: 2 additions & 1 deletion packages/system/kubeovn/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
apiVersion: v2
name: cozy-kubeovn
version: 0.3.1
version: 0.0.0 # Placeholder, the actual version will be automatically set during the build process
3 changes: 2 additions & 1 deletion packages/system/kubevirt-cdi-operator/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
apiVersion: v2
name: cozy-kubevirt-cdi-operator
version: 0.3.1
version: 0.0.0 # Placeholder, the actual version will be automatically set during the build process
3 changes: 2 additions & 1 deletion packages/system/kubevirt-cdi/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
apiVersion: v2
name: cozy-kubevirt-cdi
version: 0.3.1
version: 0.0.0 # Placeholder, the actual version will be automatically set during the build process
3 changes: 2 additions & 1 deletion packages/system/kubevirt-csi-node/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
apiVersion: v2
name: cozy-kubevirt-csi-node
version: 0.3.1
version: 0.0.0 # Placeholder, the actual version will be automatically set during the build process
3 changes: 2 additions & 1 deletion packages/system/kubevirt-operator/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
apiVersion: v2
name: cozy-kubevirt-operator
version: 0.3.1
version: 0.0.0 # Placeholder, the actual version will be automatically set during the build process
3 changes: 2 additions & 1 deletion packages/system/kubevirt/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
apiVersion: v2
name: cozy-kubevirt
version: 0.3.1
version: 0.0.0 # Placeholder, the actual version will be automatically set during the build process
3 changes: 2 additions & 1 deletion packages/system/linstor/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
apiVersion: v2
name: cozy-linstor
version: 0.3.1
version: 0.0.0 # Placeholder, the actual version will be automatically set during the build process
3 changes: 2 additions & 1 deletion packages/system/mariadb-operator/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
apiVersion: v2
name: cozy-mariadb-operator
version: 0.3.1
version: 0.0.0 # Placeholder, the actual version will be automatically set during the build process
3 changes: 2 additions & 1 deletion packages/system/metallb/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
apiVersion: v2
name: cozy-metallb
version: 0.3.1
version: 0.0.0 # Placeholder, the actual version will be automatically set during the build process
3 changes: 2 additions & 1 deletion packages/system/monitoring/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
apiVersion: v2
name: cozy-monitoring
version: 0.3.1
version: 0.0.0 # Placeholder, the actual version will be automatically set during the build process
3 changes: 2 additions & 1 deletion packages/system/piraeus-operator/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
apiVersion: v2
name: cozy-piraeus-operator
version: 0.3.1
version: 0.0.0 # Placeholder, the actual version will be automatically set during the build process
3 changes: 2 additions & 1 deletion packages/system/postgres-operator/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
apiVersion: v2
name: cozy-postgres-operator
version: 0.3.1
version: 0.0.0 # Placeholder, the actual version will be automatically set during the build process
3 changes: 2 additions & 1 deletion packages/system/rabbitmq-operator/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
apiVersion: v2
name: cozy-rabbitmq-operator
version: 0.3.1
version: 0.0.0 # Placeholder, the actual version will be automatically set during the build process
3 changes: 2 additions & 1 deletion packages/system/redis-operator/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
apiVersion: v2
name: cozy-redis-operator
version: 0.3.1
version: 0.0.0 # Placeholder, the actual version will be automatically set during the build process
3 changes: 2 additions & 1 deletion packages/system/telepresence/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
apiVersion: v2
name: cozy-telepresence
version: 0.3.1
version: 0.0.0 # Placeholder, the actual version will be automatically set during the build process
3 changes: 2 additions & 1 deletion packages/system/victoria-metrics-operator/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
apiVersion: v2
name: cozy-victoria-metrics-operator
version: 0.3.1
version: 0.0.0 # Placeholder, the actual version will be automatically set during the build process
10 changes: 10 additions & 0 deletions scripts/common-envs.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
REGISTRY := ghcr.io/aenix-io/cozystack
PUSH := 1
LOAD := 0
VERSION = $(patsubst v%,%,$(shell git describe --tags --abbrev=0))
TAG = $(shell git describe --tags --exact-match 2>/dev/null || echo latest)

# Returns 'latest' if the git tag is not assigned, otherwise returns the provided value
define gentag
$(if $(filter $(TAG),latest),latest,$(1))
endef

0 comments on commit e6a7a01

Please sign in to comment.