agilestacks / git-service

Git Service over SSH and HTTP, backed by Git CLI. API and authn / authz callouts.
Other
0 stars 0 forks source link

Git service restore from backup fails because of the different filenames of backup file #13

Closed eLco closed 6 years ago

eLco commented 6 years ago

Git service restore from backup may fails because of the different filenames of backup archive in S3 bucket and in component output.

kubectl --context="red.agilestacks.io" --namespace="automation-hub" exec git-b5df8c489-lggcn -- /bin/sh -c \
        "tar cjf - -C /git . | aws s3 cp - s3://files.red.agilestacks.io/backup/git-service/git-service/2018-07-02-17-41-03.tar.bz"
Outputs:
kind = git-service
component.git-service.snapshot = s3://files.red.agilestacks.io/backup/git-service/git-service/2018-07-02-17-41-04.tar.bz

This is caused by two times evaluation of this code:

TS              ?= $(shell date +"%Y-%m-%d-%H-%M-%S")
BACKUP_SNAPSHOT ?= s3://$(CLOUD_BUCKET)/backup/git-service/$(COMPONENT_NAME)/$(TS).tar.bz

...

"tar cjf - -C $(REPOS_PATH) . | aws s3 cp - $(BACKUP_SNAPSHOT)"
@echo Outputs:
@echo kind = git-service
@echo component.git-service.snapshot = $(BACKUP_SNAPSHOT)
arkadijs commented 6 years ago

What is your make -v? It works for me, both in toolbox and with Apple supplied GNU Make 3.81.

bash-4.3# cat >Makefile
TS ?= $(shell date +"%Y-%m-%d-%H-%M-%S")
Z := $(shell sleep 2)
SNAPSHOT ?= s3:///$(TS).tar.bz

deploy:
    @echo $(TS)
    @echo $(Z)
    @sleep 2
    @echo $(SNAPSHOT)

bash-4.3# make deploy
2018-07-02-20-34-32

s3:///2018-07-02-20-34-32.tar.bz
eLco commented 6 years ago

make -v GNU Make 3.81 Copyright (C) 2006 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

This program built for i386-apple-darwin11.3.0