Files
Andrey Kolkov 651a6e3023 fix(backups): harden the redis restore AOF wait and image build
Wait for the throwaway loader's AOF rewrite to finish - no rewrite in
flight, last one ok, base AOF on disk - instead of a bare
aof_rewrite_in_progress:0 check, which right after `appendonly yes` can
fall through before the scheduled rewrite starts and replay an absent or
half-written base AOF. Same fix in the example strategy.

Declare the package image targets PHONY and serialize image-redis-backup
after image-backupstrategy-controller so their `yq -i values.yaml` digest
stamps cannot race under `make -j`. Run the demo cleanup under `set -e`
(every delete is already --ignore-not-found) so a real API failure aborts
instead of printing "Cleanup complete" over a half-torn-down demo.

Assisted-By: LLM
Signed-off-by: Andrey Kolkov <androndo@gmail.com>
2026-09-09 16:23:12 +04:00

38 lines
1.7 KiB
Makefile

NAME=backupstrategy-controller
NAMESPACE=cozy-backup-controller
include ../../../hack/common-envs.mk
include ../../../hack/package.mk
# PHONY so a stray file/dir named `image` cannot mark the aggregate up to date
# and skip both builds.
.PHONY: image image-backupstrategy-controller image-redis-backup
image: image-backupstrategy-controller image-redis-backup
image-backupstrategy-controller:
docker buildx build -f images/backupstrategy-controller/Dockerfile ../../.. \
$(call image-tags,backupstrategy-controller,v$(COZYSTACK_VERSION)) \
$(call cache-args,backupstrategy-controller) \
--metadata-file images/backupstrategy-controller.json \
$(BUILDX_ARGS)
IMAGE="$(REGISTRY)/backupstrategy-controller:$(IMAGE_TAG)@$$(yq e '."containerimage.digest"' images/backupstrategy-controller.json -o json -r)" \
yq -i '.backupStrategyController.image = strenv(IMAGE)' values.yaml
rm -f images/backupstrategy-controller.json
# Depends on image-backupstrategy-controller so the two recipes never rewrite
# values.yaml concurrently under `make -j image` — each stamps a digest with
# `yq -i`, and a concurrent write would drop one of them.
image-redis-backup: image-backupstrategy-controller
docker buildx build -f images/redis-backup/Dockerfile images/redis-backup \
$(call image-tags,redis-backup,v$(COZYSTACK_VERSION)) \
$(call cache-args,redis-backup) \
--metadata-file images/redis-backup.json \
$(BUILDX_ARGS)
IMAGE="$(REGISTRY)/redis-backup:$(IMAGE_TAG)@$$(yq e '."containerimage.digest"' images/redis-backup.json -o json -r)" \
yq -i '.backupStrategyController.redisBackupClientImage = strenv(IMAGE)' values.yaml
rm -f images/redis-backup.json
test:
helm unittest .