-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
56 lines (41 loc) · 1.56 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
.PHONY: all ${MAKECMDGOALS}
MOLECULE_SCENARIO ?= default
MOLECULE_DOCKER_IMAGE ?= ubuntu2004
GALAXY_API_KEY ?=
GITHUB_REPOSITORY ?= $$(git config --get remote.origin.url | cut -d: -f 2 | cut -d. -f 1)
GITHUB_ORG = $$(echo ${GITHUB_REPOSITORY} | cut -d/ -f 1)
GITHUB_REPO = $$(echo ${GITHUB_REPOSITORY} | cut -d/ -f 2)
REQUIREMENTS = requirements.yml
all: install version lint test
test: lint
poetry run molecule test -s ${MOLECULE_SCENARIO}
install:
@type poetry >/dev/null || pip3 install poetry
@poetry install
lint: install
poetry run yamllint .
poetry run ansible-lint .
roles:
[ -f ${REQUIREMENTS} ] && yq '.$@[] | .name' -r < ${REQUIREMENTS} \
| xargs -L1 poetry run ansible-galaxy role install --force || exit 0
collections:
[ -f ${REQUIREMENTS} ] && yq '.$@[]' -r < ${REQUIREMENTS} \
| xargs -L1 echo poetry run ansible-galaxy -vvv collection install --force || exit 0
requirements: roles collections
dependency create prepare converge idempotence side-effect verify destroy login reset:
MOLECULE_DOCKER_IMAGE=${MOLECULE_DOCKER_IMAGE} poetry run molecule $@ -s ${MOLECULE_SCENARIO}
rebuild: destroy prepare create
ignore:
poetry run ansible-lint --generate-ignore
clean: destroy reset
poetry env remove $$(which python)
publish:
@echo publishing repository ${GITHUB_REPOSITORY}
@echo GITHUB_ORGANIZATION=${GITHUB_ORG}
@echo GITHUB_REPOSITORY=${GITHUB_REPO}
@poetry run ansible-galaxy role import \
--api-key ${GALAXY_API_KEY} ${GITHUB_ORG} ${GITHUB_REPO}
version:
@poetry run molecule --version
debug: version
@poetry export --dev --without-hashes