Zack Williams | 2894e4f | 2020-09-17 09:45:17 -0700 | [diff] [blame] | 1 | # users Makefile |
| 2 | # |
| 3 | # SPDX-FileCopyrightText: © 2020 Open Networking Foundation <support@opennetworking.org> |
| 4 | # SPDX-License-Identifier: Apache-2.0 |
| 5 | |
| 6 | SHELL = bash -eu -o pipefail |
| 7 | |
| 8 | .DEFAULT_GOAL := help |
| 9 | .PHONY: test lint yamllint ansiblelint license help passwd |
| 10 | |
| 11 | passwd: ## encrypt a password using required hash types |
| 12 | python goodpassword.py |
| 13 | |
| 14 | test: ## run tests on the playbook with molecule |
| 15 | molecule --version |
| 16 | molecule test |
| 17 | |
| 18 | lint: yamllint ansiblelint ## run all lint checks |
| 19 | |
| 20 | # all YAML files |
| 21 | YAML_FILES ?= $(shell find . -type f \( -name '*.yaml' -o -name '*.yml' \) -print ) |
| 22 | |
| 23 | yamllint: ## lint check with yamllint |
| 24 | yamllint --version |
| 25 | yamllint \ |
| 26 | -d "{extends: default, rules: {line-length: {max: 99}}}" \ |
| 27 | -s $(YAML_FILES) |
| 28 | |
| 29 | ansiblelint: ## lint check with ansible-lint |
| 30 | ansible-lint --version |
| 31 | ansible-lint -v . |
| 32 | ansible-lint -v molecule/*/* |
| 33 | |
| 34 | license: ## Check license with the reuse tool |
| 35 | reuse --version |
| 36 | reuse --root . lint |
| 37 | |
| 38 | help: ## Print help for each target |
| 39 | @echo users test targets |
| 40 | @echo |
| 41 | @grep '^[[:alnum:]_-]*:.* ##' $(MAKEFILE_LIST) \ |
| 42 | | sort | awk 'BEGIN {FS=":.* ## "}; {printf "%-25s %s\n", $$1, $$2};' |