Updated lint commands for CI
This commit is contained in:
@@ -8,8 +8,9 @@ platform:
|
||||
|
||||
steps:
|
||||
- name: lint
|
||||
image: cytopia/ansible-lint
|
||||
image: bdebyl/yamllint
|
||||
command:
|
||||
- export YML_FILES="$(find ansible/ -name '*.yml' -not -name '*vault*')"
|
||||
- ansible-lint -x 701 "$YML_FILES"
|
||||
- . .lint-vars.sh
|
||||
- ansible-lint -x "$ANSIBLE_LINT_SKIP_LIST" "$YML_FILES"
|
||||
- yamllint "$YML_FILES"
|
||||
|
||||
6
.lint-vars.sh
Executable file
6
.lint-vars.sh
Executable file
@@ -0,0 +1,6 @@
|
||||
#/bin/sh
|
||||
|
||||
# Ansible Lint skip list (https://ansible-lint.readthedocs.io/en/latest/default_rules.html)
|
||||
# [701] - "No 'galaxy_info' found (in role)"
|
||||
export ANSIBLE_LINT_SKIP_LIST=701
|
||||
|
||||
11
Makefile
11
Makefile
@@ -43,10 +43,7 @@ ${VAULT_FILE}: ${VAULT_PASS_FILE}
|
||||
|
||||
# Linting
|
||||
YAML_FILES=$(shell find ansible/ -name '*.yml' -not -name '*vault*')
|
||||
|
||||
# Ansible Lint skip list (https://ansible-lint.readthedocs.io/en/latest/default_rules.html)
|
||||
# [701] - "No 'galaxy_info' found (in role)"
|
||||
ANSIBLE_LINT_SKIP_LIST=701
|
||||
SKIP_FILE=./.lint-vars.sh
|
||||
|
||||
# Targets
|
||||
deploy: ${ANSIBLE} ${VAULT_FILE}
|
||||
@@ -58,8 +55,8 @@ check: ${ANSIBLE} ${VAULT_FILE}
|
||||
vault: ${ANSIBLE_VAULT} ${VAULT_FILE}
|
||||
${ANSIBLE_VAULT} edit --vault-password-file ${VAULT_PASS_FILE} ${VAULT_FILE}
|
||||
|
||||
lint: ${LINT_YAML} ${LINT_ANSIBLE}
|
||||
lint: ${LINT_YAML} ${LINT_ANSIBLE} ${SKIP_FILE}
|
||||
@printf "Running yamllint...\n"
|
||||
-@${LINT_YAML} ${YAML_FILES}
|
||||
@printf "Running ansible-lint with SKIP_LIST: [%s]...\n" "${ANSIBLE_LINT_SKIP_LIST}"
|
||||
-@${LINT_ANSIBLE} -x ${ANSIBLE_LINT_SKIP_LIST} ${YAML_FILES}
|
||||
@. ${SKIP_FILE}; printf "Running ansible-lint with SKIP_LIST: [%s]...\n" "$$ANSIBLE_LINT_SKIP_LIST"
|
||||
-@. ${SKIP_FILE}; ${LINT_ANSIBLE} -x $$ANSIBLE_LINT_SKIP_LIST ${YAML_FILES}
|
||||
|
||||
Reference in New Issue
Block a user