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

run ansible-lint through venv #49

Merged
merged 1 commit into from
Mar 1, 2025
Merged
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
20 changes: 12 additions & 8 deletions .github/workflows/ansible-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ on:
push:

env:
ansible_lint_version: v24.5.0
# ansible_lint_version: v24.5.0
python_version: 3.12 # must have an alma rpm available in format python<version>

jobs:
Expand All @@ -19,25 +19,29 @@ jobs:
- name: Install dnf dependencies
shell: bash
run: |
dnf -y install ansible-core epel-release git-core python3.12 python3.12-pip
dnf -y install ansible-core epel-release git-core python$python_version python$python_version-pip

- name: Install ansible and ansible-lint
- name: Create and enter venv
shell: bash
run: |
python$python_version -m venv /venv

- name: Install ansible-lint
shell: bash
# if we need to version lock example:
# pip3.12 install "ansible-lint[lock] @ git+https://github.com/ansible/ansible-lint@$ansible_lint_version"
run: |
pip$python_version install "ansible"
pip$python_version install "ansible-lint[lock]"
ansible-lint --version
/venv/bin/pip install "ansible-lint"
/venv/bin/ansible-lint --version

# for some reason ansible-lint in online mode does not grab all deps properly
# this does
- name: Install ansible-galaxy dependencies
shell: bash
run: |
ansible-galaxy install -r requirements.yml
/venv/bin/ansible-galaxy install -r requirements.yml

- name: Run ansible-lint
shell: bash
working-directory: ${{ github.workspace }}
run: ansible-lint --exclude ${HOME}/.ansible/roles/ --offline
run: /venv/bin/ansible-lint --exclude ${HOME}/.ansible/roles/ --exclude ${HOME}/.ansible/collections/ --offline
Loading