@@ -16,11 +16,12 @@ CACHE_FROM ?= $(IMAGE_TAG)
1616OS ?= $(shell uname)
1717CURRENT_DIR ?= $(dir $(abspath $(lastword $(MAKEFILE_LIST ) ) ) )
1818
19- # Yamllint docker image
19+ YAML_CONFIG_PATH ?= .github/.yamllint.yaml
20+
2021YAML_LINT_RUNNER ?= $(DOCKER ) run --rm $$(tty -s && echo "-it" || echo ) \
2122 -v $(PWD ) :/data \
2223 cytopia/yamllint:latest \
23- -c ./.github/.yamllint.yaml \
24+ -c $( YAML_CONFIG_PATH ) \
2425 -f colored .
2526
2627ACTION_LINT_RUNNER ?= $(DOCKER ) run --rm $$(tty -s && echo "-it" || echo ) \
@@ -35,6 +36,13 @@ MARKDOWN_LINT_RUNNER ?= $(DOCKER) run --rm $$(tty -s && echo "-it" || echo) \
3536 davidanson/markdownlint-cli2-rules:latest \
3637 --config ".github/.markdownlint.json"
3738
39+ ANSIBLE_LINT_RUNNER ?= $(DOCKER ) run --rm $$(tty -s && echo "-it" || echo ) \
40+ -v $(shell pwd) :/code \
41+ -e YAMLLINT_CONFIG_FILE=$(YAML_CONFIG_PATH ) \
42+ --workdir /code \
43+ pipelinecomponents/ansible-lint:latest \
44+ ansible-lint --show-relpath --config-file ".github/.ansible-lint.yml"
45+
3846#
3947# Self documenting Makefile code
4048# ------------------------------------------------------------------------------------
@@ -91,7 +99,7 @@ PHONY: all
9199# ------------------------------------------------------------------------------------
92100build : # # Build default docker image
93101 cd $(CURRENT_DIR )$(DOCKERFILE_DIR ) ; \
94- docker build -t $(IMAGE_TAG ) .
102+ $( DOCKER ) build -t $(IMAGE_TAG ) .
95103PHONY : build
96104
97105analyze : # # Analyze docker image
@@ -101,19 +109,19 @@ analyze: ## Analyze docker image
101109
102110build-from-cache : # # Build default docker image using cached layers
103111 cd $(CURRENT_DIR )$(DOCKERFILE_DIR ) ; \
104- docker build --cache-from $(CACHE_FROM ) . -t $(IMAGE_TAG )
112+ $( DOCKER ) build --cache-from $(CACHE_FROM ) . -t $(IMAGE_TAG )
105113PHONY : build-from-cache
106114
107115pull : # # Pulls docker image from upstream
108- docker pull $(IMAGE_TAG )
116+ $( DOCKER ) pull $(IMAGE_TAG )
109117.PHONY : pull
110118
111119push : # # Pushes image to upstream
112- docker push $(IMAGE_TAG )
120+ $( DOCKER ) push $(IMAGE_TAG )
113121.PHONY : push
114122
115123ssh : # # Login into built image
116- docker run --rm -it -v $(PWD ) /:/opt/docker-php-base $(IMAGE_TAG ) sh
124+ $( DOCKER ) run --rm -it -v $(PWD ) /:/opt/docker-php-base $(IMAGE_TAG ) sh
117125.PHONY : ssh
118126
119127#
@@ -144,7 +152,7 @@ hooks: ## Install git hooks from pre-commit-config
144152 pre-commit autoupdate
145153.PHONY : hooks
146154
147- lint : lint-yaml lint-actions lint-md # # Runs all linting commands
155+ lint : lint-yaml lint-actions lint-md lint-ansible # # Runs all linting commands
148156.PHONY : lint
149157
150158lint-yaml : # # Lints yaml files inside project
@@ -164,21 +172,9 @@ lint-md-dry: ## Lint all markdown files using markdownlint-cli2 in dry-run mode
164172.PHONY : lint-md-dry
165173
166174lint-ansible : # # Lint ansible files inside project
167- ansible-lint .
175+ @ $( ANSIBLE_LINT_RUNNER ) . | tee -a $( MAKE_LOGFILE )
168176.PHONY : lint-ansible
169177
170- lint-docker : # # Run hadolint linter over dist Dockerfiles
171- hadolint -V ./dist/base/8.1-cli-alpine/Dockerfile
172- hadolint -V ./dist/base/8.1-fpm-alpine/Dockerfile
173- hadolint -V ./dist/base/8.1-supervisord-alpine/Dockerfile
174- hadolint -V ./dist/base/8.2-cli-alpine/Dockerfile
175- hadolint -V ./dist/base/8.2-fpm-alpine/Dockerfile
176- hadolint -V ./dist/base/8.2-supervisord-alpine/Dockerfile
177- hadolint -V ./dist/base/8.3-cli-alpine/Dockerfile
178- hadolint -V ./dist/base/8.3-fpm-alpine/Dockerfile
179- hadolint -V ./dist/base/8.3-supervisord-alpine/Dockerfile
180- .PHONY : lint-docker
181-
182178#
183179# Release
184180# ------------------------------------------------------------------------------------
0 commit comments