forked from litmuschaos/litmus
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
57 lines (48 loc) · 1.61 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
# Makefile for building Litmus and its tools
# Reference Guide - https://www.gnu.org/software/make/manual/make.html
#
# Internal variables or constants.
# NOTE - These will be executed when any make target is invoked.
#
IS_DOCKER_INSTALLED = $(shell which docker >> /dev/null 2>&1; echo $$?)
# list of playbooks which should be validated
#PLAYBOOKS = $(shell find ./ -iname 'test.yml' -printf '%P\n')
PLAYBOOKS = $(shell find ./ -iname *.yml -printf '%P\n' | grep 'ansible_logic.yml')
.PHONY: all
all: all-tools ansible-syntax-check
.PHONY: help
help:
@echo ""
@echo "Usage:-"
@echo "\tmake all -- [default] builds the litmus containers"
@echo ""
_build_check_docker:
@if [ $(IS_DOCKER_INSTALLED) -eq 1 ]; \
then echo "" \
&& echo "ERROR:\tdocker is not installed. Please install it before build." \
&& echo "" \
&& exit 1; \
fi;
.PHONY: deps
deps: _build_check_docker
.PHONY: all-tools
all-tools: ansible-runner-image
.PHONY: ansible-runner-image
ansible-runner-image:
@echo "------------------"
@echo "--> Build ansible-runner image"
@echo "------------------"
sudo docker build . -f build/ansible-runner/Dockerfile -t litmuschaos/ansible-runner:ci
REPONAME="litmuschaos" IMGNAME="ansible-runner" IMGTAG="ci" ./hack/push
.PHONY: ansible-syntax-check
ansible-syntax-check:
@echo "------------------"
@echo "--> Check playbook syntax"
@echo "------------------"
rc_sum=0; \
for playbook in $(PLAYBOOKS); do \
sudo docker run --rm -ti --entrypoint=ansible-playbook litmuschaos/ansible-runner:ci \
$${playbook} --syntax-check -i /etc/ansible/hosts -v; \
rc_sum=$$((rc_sum+$$?)); \
done; \
exit $${rc_sum}