cozystack/packages/core/platform/Makefile
Andrei Kvapil 51d0001589
move Makefiles to hack
Signed-off-by: Andrei Kvapil <kvapss@gmail.com>
2025-11-25 18:23:30 +01:00

30 lines
1.2 KiB
Makefile

NAME=cozystack-platform
NAMESPACE=cozy-system
include ../../../hack/common-envs.mk
include ../../../hack/package.mk
image: image-migrations
image-migrations:
docker buildx build images/migrations \
--tag $(REGISTRY)/platform-migrations:$(call settag,$(TAG)) \
--cache-from type=registry,ref=$(REGISTRY)/platform-migrations:latest \
--cache-to type=inline \
--metadata-file images/migrations.json \
$(BUILDX_ARGS)
IMAGE="$(REGISTRY)/platform-migrations:$(call settag,$(TAG))@$$(yq e '."containerimage.digest"' images/migrations.json -o json -r)" \
yq -i '.migrations.image = strenv(IMAGE)' values.yaml
rm -f images/migrations.json
generate:
@echo "Generating target version from migrations..."
@LAST_MIGRATION=$$(ls -1 images/migrations/migrations/ 2>/dev/null | grep -E '^[0-9]+$$' | sort -n | tail -1); \
if [ -z "$$LAST_MIGRATION" ]; then \
echo "Error: No migration files found" >&2; \
exit 1; \
fi; \
TARGET_VERSION=$$((LAST_MIGRATION + 1)); \
echo "Last migration: $$LAST_MIGRATION, Target version: $$TARGET_VERSION"; \
yq -i '.migrations.targetVersion = $$TARGET_VERSION' values.yaml; \
echo "Updated targetVersion to $$TARGET_VERSION in values.yaml"