Skip to content

Commit

Permalink
CI: enable ansible-lint run
Browse files Browse the repository at this point in the history
  • Loading branch information
mnecas committed Jun 22, 2022
1 parent 07dc9fc commit 9965a8f
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 24 deletions.
5 changes: 5 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ jobs:
- name: Install required packages
run: |
dnf install -y \
ansible-core \
createrepo_c \
dnf-utils \
git \
Expand All @@ -75,10 +76,14 @@ jobs:
python3-pyflakes \
python3-pyOpenSSL \
python3-dnf-plugin-versionlock \
python38-pip \
rpm-build \
sed \
tar
- name: Install required PyPI packages
run: pip3.8 install ansible-lint

- name: Checkout sources
uses: actions/checkout@v2

Expand Down
25 changes: 5 additions & 20 deletions build/ansible-check.sh
Original file line number Diff line number Diff line change
@@ -1,27 +1,12 @@
#!/bin/sh -x

# Search for playbooks within specified directories (one level only)
PLABOOKS_DIR="packaging/ansible-runner-service-project/project"

# Directory with roles
ROLES_DIR="packaging/ansible-runner-service-project/project/roles"

SRCDIR="$(dirname "$0")/.."

ANSIBLE_LINT=/usr/bin/ansible-lint
ANSIBLE_LINT_CONF="$(dirname "$0")/ansible-lint.conf"

if ! which "${ANSIBLE_LINT}" > /dev/null 2>&1; then
echo "WARNING: tool '${ANSIBLE_LINT}' is missing" >&2
# Check if the ansible-lint binary exists
if ! command -v ansible-lint > /dev/null 2>&1; then
echo "WARNING: tool 'ansible-lint' is missing" >&2
exit 0
fi

cd "${SRCDIR}"

# Find playbooks
PARAMS=$(find ${PLABOOKS_DIR} -type f -name '*.yml' -maxdepth 1)

# Find roles
PARAMS="$PARAMS $(find ${ROLES_DIR} -type d -maxdepth 1)"

${ANSIBLE_LINT} -c ${ANSIBLE_LINT_CONF} ${PARAMS}
# Run ansible-lint
ansible-lint -c ${ANSIBLE_LINT_CONF} packaging/ansible-runner-service-project/project/roles/*
7 changes: 3 additions & 4 deletions build/ansible-lint.conf
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
skip_list:
# [E701]: "meta/main.yml should contain relevant info"
# Roles in ovirt-engine are not intended to be used/imported by Ansible Galaxy
- '701'

- var-spacing
- meta-no-info
- role-name

0 comments on commit 9965a8f

Please sign in to comment.