forked from DFE-Digital/get-into-teaching-app
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
85 lines (68 loc) · 2.92 KB
/
Makefile
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
74
75
76
77
78
79
80
81
82
83
84
85
ifndef VERBOSE
.SILENT:
endif
help:
echo "Secrets:"
echo " This makefile gives the user the ability to safely display and edit azure secrets which are used by this project. "
echo ""
echo "Commands:"
echo " edit-app-secrets - Edit Application specific Secrets."
echo " print-app-secrets - Display Application specific Secrets."
echo ""
echo "Parameters:"
echo "All commands take the parameter development|review|test|production"
echo ""
echo "Examples:"
echo ""
echo "To edit the Application secrets for Development"
echo " make development edit-app-secrets"
echo ""
APPLICATION_SECRETS=APP-KEYS
CONTENT_SECRETS=CONTENT-KEYS
PAGESPEED_SECRETS=PAGE-SPEED-KEYS
DOCKER_IMAGE=get-into-teaching-app
.PHONY: development
development:
$(eval export KEY_VAULT=s146d01-kv)
$(eval export AZ_SUBSCRIPTION=s146-getintoteachingwebsite-development)
.PHONY: review
review:
$(eval export KEY_VAULT=s146d01-kv)
$(eval export AZ_SUBSCRIPTION=s146-getintoteachingwebsite-development)
.PHONY: test
test:
$(eval export KEY_VAULT=s146t01-kv)
$(eval export AZ_SUBSCRIPTION=s146-getintoteachingwebsite-test)
.PHONY: production
production:
$(eval export KEY_VAULT=s146p01-kv)
$(eval export AZ_SUBSCRIPTION=s146-getintoteachingwebsite-production)
set-azure-account: ${environment}
echo "Logging on to ${AZ_SUBSCRIPTION}"
az account set -s ${AZ_SUBSCRIPTION}
clean:
[ ! -f fetch_config.rb ] \
rm -f fetch_config.rb \
|| true
install-fetch-config:
[ ! -f fetch_config.rb ] \
&& echo "Installing fetch_config.rb" \
&& curl -s https://raw.githubusercontent.com/DFE-Digital/bat-platform-building-blocks/master/scripts/fetch_config/fetch_config.rb -o fetch_config.rb \
&& chmod +x fetch_config.rb \
|| true
edit-app-secrets: install-fetch-config set-azure-account
./fetch_config.rb -s azure-key-vault-secret:${KEY_VAULT}/${APPLICATION_SECRETS} -e -d azure-key-vault-secret:${KEY_VAULT}/${APPLICATION_SECRETS} -f yaml -c
print-app-secrets: install-fetch-config set-azure-account
./fetch_config.rb -s azure-key-vault-secret:${KEY_VAULT}/${APPLICATION_SECRETS} -f yaml
edit-content-secrets: install-fetch-config set-azure-account
./fetch_config.rb -s azure-key-vault-secret:${KEY_VAULT}/${CONTENT_SECRETS} -e -d azure-key-vault-secret:${KEY_VAULT}/${CONTENT_SECRETS} -f yaml -c
print-content-secrets: install-fetch-config set-azure-account
./fetch_config.rb -s azure-key-vault-secret:${KEY_VAULT}/${CONTENT_SECRETS} -f yaml
edit-ps-secrets: install-fetch-config set-azure-account
./fetch_config.rb -s azure-key-vault-secret:${KEY_VAULT}/${PAGESPEED_SECRETS} -e -d azure-key-vault-secret:${KEY_VAULT}/${PAGESPEED_SECRETS} -f yaml -c
print-ps-secrets: install-fetch-config set-azure-account
./fetch_config.rb -s azure-key-vault-secret:${KEY_VAULT}/${PAGESPEED_SECRETS} -f yaml
docker:
docker build . -t ${DOCKER_IMAGE}
specs:
docker run -t --rm -e RAILS_ENV=test ${DOCKER_IMAGE} rspec spec/features/funding_widget_spec.rb