Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CI: enable ansible-lint run #484

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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>=6.0.0,<7.0.0"

- 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/*
8 changes: 4 additions & 4 deletions build/ansible-lint.conf
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
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
- experimental