forked from aristanetworks/avd
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
63 lines (52 loc) · 2.2 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
MOLECULE ?= eos_cli_config_gen
ANSIBLE_OPTIONS ?=
.PHONY: help
help: ## Display help message
@grep -E '^[0-9a-zA-Z_-]+\.*[0-9a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
###############################################################################
# docker containers target #
###############################################################################
.PHONY: run
run: ## Execute molecule TEST sequence. By default eos_cli_config_gen. Can be set with MOLECULE=
cd .. && \
molecule test --scenario-name $(MOLECULE) -- $(ANSIBLE_OPTIONS)
.PHONY: converge
converge: ## Execute molecule CONVERGE sequence. By default eos_cli_config_gen. Can be set with MOLECULE=
cd .. && \
molecule converge --scenario-name $(MOLECULE) -- $(ANSIBLE_OPTIONS)
.PHONY: designs-4.0-schema
designs-4.0-schema: ## Execute molecule scenarios for eos_designs 4.0 schema updates.
cd .. && \
molecule converge --scenario-name eos_designs_unit_tests -- $(ANSIBLE_OPTIONS)
cd .. && \
molecule converge --scenario-name eos_designs_unit_tests_v4.0 -- $(ANSIBLE_OPTIONS)
.PHONY: refresh-facts
refresh-facts: ## Run all molecule scenarios
@while read -r MOLECULE_SCENARIO; do \
if [ -d "$$MOLECULE_SCENARIO" ]; then\
echo "Run scenario for "$$MOLECULE_SCENARIO && \
cd .. ; \
molecule converge --scenario-name $$MOLECULE_SCENARIO -- $(ANSIBLE_OPTIONS); \
cd ./molecule ; \
fi \
done <MOLECULE_SCENARIOS.txt
.PHONY: commit-facts
commit-facts: ## Commit updated facts for CI
git status --short
git add .
git commit --no-verify -m 'CI(molecule): Update Molecule artifacts' ./
.PHONY: test-git-status
test-git-status: ## Run post molecule script to check git status
sh ../../../../.github/git-repo-state-monitor.sh
.PHONY: sync-facts
sync-facts: refresh-facts commit-facts ## Refresh and commit CI artifacts
.PHONY: cleanup
destroy: ## destroy all molecule scenarios
@for MOLECULE_SCENARIO in * ; do \
if [ -d "$$MOLECULE_SCENARIO" ]; then\
echo "Run scenario for "$$MOLECULE_SCENARIO && \
cd .. ; \
molecule cleanup --scenario-name $$MOLECULE_SCENARIO -- $(ANSIBLE_OPTIONS); \
cd ./molecule ; \
fi \
done