forked from k8up-io/k8up
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile.restic-integration.mk
66 lines (49 loc) · 2.18 KB
/
Makefile.restic-integration.mk
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
include Makefile.restic-integration.vars.mk
clean_targets += restic-integration-test-clean
.PHONY: restic-integration-test-setup
restic-integration-test-setup: minio-start restic-download ## Prepare to run the integration test for the restic module
.PHONY: restic-clean
restic-integration-test-clean: minio-stop ## Clean the integration test of the restic module
.PHONY: minio-address
minio-address: ## Get the address to connect to minio
@echo "http://$(minio_address)"
.PHONY: minio-reset
minio-reset: minio-stop minio-delete-config minio-start ## Reset minio's configuration and data dirs and restart minio
minio-delete-config:
rm -rf "$(minio_config)" "$(minio_data)"
.PHONY: minio-restart
minio-restart: minio-stop minio-start ## Restart minio
minio-set-alias: minio-start ## Set the alias 'restic' in mc to the minio server
@mc alias set restic "http://$(minio_address)" "$(minio_root_user)" "$(minio_root_password)"
.PHONY: minio-start
minio-start: minio-check $(minio_pid) ## Run minio
.PHONY: minio-check
minio-check: minio-clean ## Check if minio is running
@test -f "$(minio_pid)" && echo "Minio runs as PID $$(cat $(minio_pid))." || echo "Minio is not running."
.PHONY: minio-clean
minio-clean: ## Remove the minio PID file if the process is not running
@./clean.sh "$(minio_pid)"
.PHONY: minio-stop
minio-stop: ## Stop minio
@./kill.sh "$(minio_pid)"
minio-download: $(minio_path) ## Download github.com/minio/minio
restic-download: $(restic_path) ## Download github.com/restic/restic
$(minio_pid): export MINIO_ROOT_USER = $(minio_root_user)
$(minio_pid): export MINIO_ROOT_PASSWORD = $(minio_root_password)
$(minio_pid): minio-download
@mkdir -p "$(minio_data)" "$(minio_config)"
@./exec.sh "$(minio_pid)" \
"$(minio_path)" \
server "$(minio_data)" \
"--address" "$(minio_address)" \
"--config-dir" "$(minio_config)"
@while ! curl --silent "http://$(minio_address)" > /dev/null; do echo "Waiting for server http://$(minio_address) to become ready"; sleep 0.5; done
$(minio_path): | $(go_bin)
curl $(curl_args) --output "$@" "$(minio_url)"
chmod +x "$@"
"$@" --version
$(restic_path): | $(go_bin)
curl $(curl_args) "$(restic_url)" | \
bunzip2 > "$@"
chmod +x "$@"
"$@" version