forked from k8up-io/k8up
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile.restic-integration.mk
73 lines (55 loc) · 2.44 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
67
68
69
70
71
72
73
# Set Shell to bash, otherwise some targets fail with dash/zsh etc.
SHELL := /bin/bash
# Disable built-in rules
MAKEFLAGS += --no-builtin-rules
MAKEFLAGS += --no-builtin-variables
.SUFFIXES:
.SECONDARY:
include Makefile.restic-integration.vars.mk
.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_ACCESS_KEY = $(minio_root_user)
$(minio_pid): export MINIO_SECRET_KEY = $(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): $(integrationtest_dir_created)
curl $(curl_args) --output "$(minio_path)" "$(minio_url)"
chmod +x "$(minio_path)"
"$(minio_path)" --version
$(restic_path): $(integrationtest_dir_created)
curl $(curl_args) "$(restic_url)" | \
bunzip2 > "$(restic_path)"
chmod +x "$(restic_path)"
"$(restic_path)" version