-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathMakefile
100 lines (68 loc) · 3.18 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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
cwd = $(shell pwd)
virtualenv_dir = $(cwd)/venv
python_base_path = $(shell which python3.6)
kops_iam_id = kops
# defaults
region ?= ap-southeast-2
account_name ?= domainsandbox
debug ?= False # True or False
.PHONY: ensure_venv
ensure_venv:
test -d venv || virtualenv -p $(python_base_path) $(virtualenv_dir)
.PHONY: install-deps
install-deps: ensure_venv
$(virtualenv_dir)/bin/pip install -r requirements/dev.txt
.PHONY: isort
isort:
. $(virtualenv_dir)/bin/activate; isort --recursive --quiet kforce/ bin/ tests/ # --check-only
.PHONY: yapf
yapf:
. $(virtualenv_dir)/bin/activate; yapf --recursive --in-place kforce/ bin/ tests/ setup.py conftest.py
.PHONY: pytest
pytest:
. $(virtualenv_dir)/bin/activate; py.test --spec --cov=kforce --cov-report html --cov-report term tests
.PHONY: test
test: isort yapf pytest
.PHONY: test-watch
test-watch:
. $(virtualenv_dir)/bin/activate; ptw --onpass "say passed" --onfail "say failed"
.PHONY: test
pypi-upload:
python setup.py sdist upload -r pypi
PHONY: install
install:
$(virtualenv_dir)/bin/python setup.py install
.PHONY: ensure_iam
ensure_iam: install-deps
# create group
. $(virtualenv_dir)/bin/activate; aws iam create-group --group-name $(kops_iam_id)
# attach group policies
aws iam attach-group-policy --policy-arn arn:aws:iam::aws:policy/AmazonEC2FullAccess --group-name $(kops_iam_id)
aws iam attach-group-policy --policy-arn arn:aws:iam::aws:policy/AmazonRoute53FullAccess --group-name $(kops_iam_id)
aws iam attach-group-policy --policy-arn arn:aws:iam::aws:policy/AmazonS3FullAccess --group-name $(kops_iam_id)
aws iam attach-group-policy --policy-arn arn:aws:iam::aws:policy/IAMFullAccess --group-name $(kops_iam_id)
aws iam attach-group-policy --policy-arn arn:aws:iam::aws:policy/AmazonVPCFullAccess --group-name $(kops_iam_id)
# create user
aws iam create-user --user-name $(kops_iam_id)
# add user to group
aws iam add-user-to-group --user-name $(kops_iam_id) --group-name $(kops_iam_id)
# echo hint
@echo Now, create access key using $(kops_iam_id) account to execute other cmd!
.PHONY: create_access_key
create_access_key:
. $(virtualenv_dir)/bin/activate; aws iam create-access-key --user-name $(kops_iam_id)
.PHONY: new # initialize config for a new cluster (force=[True|False] - overwrite existing files or not)
new:
. $(virtualenv_dir)/bin/activate; ./bin/kforce new --account-name=$(account_name) --env=$(env) --vpc-id=$(vpc_id) --region=$(region) --debug=$(debug) $(force)
.PHONY: build
build:
. $(virtualenv_dir)/bin/activate; ./bin/kforce build --account-name=$(account_name) --env=$(env) --vpc-id=$(vpc_id) --region=$(region) --debug=$(debug)
.PHONY: diff
diff:
. $(virtualenv_dir)/bin/activate; ./bin/kforce diff --account-name=$(account_name) --env=$(env) --vpc-id=$(vpc_id) --region=$(region) --debug=$(debug)
.PHONY: apply
apply:
. $(virtualenv_dir)/bin/activate; ./bin/kforce apply --account-name=$(account_name) --env=$(env) --vpc-id=$(vpc_id) --region=$(region) --debug=$(debug)
.PHONY: install_addons
install_addons:
. $(virtualenv_dir)/bin/activate; ./bin/kforce install_addons --account-name=$(account_name) --env=$(env) --vpc-id=$(vpc_id) --region=$(region) --debug=$(debug)