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

Automatically lint new PRs #3

Merged
merged 24 commits into from
Aug 1, 2024
Merged

Automatically lint new PRs #3

merged 24 commits into from
Aug 1, 2024

Conversation

crichez
Copy link
Owner

@crichez crichez commented Aug 1, 2024

Objectives

This pull request introduces a new GitHub Actions workflow that runs ansible-lint on pull requests.

@crichez crichez added the enhancement New feature or request label Aug 1, 2024
@crichez crichez self-assigned this Aug 1, 2024
Christopher Palmer-Richez added 7 commits July 31, 2024 22:00
These recent commits are confusing I know, this is related to the
"official" ansible-lint github action not being able to find collections
that are supposed to be installed by default. I'm having a difficult
time understanding where the requirements file will be read, but that is
likely because I use a slightly unusual structure for role distribution?
This commit uses reference from https://docs.ansible.com/ansible/latest/galaxy/user_guide.html#installing-roles-and-collections-from-the-same-requirements-yml-file
Still don't get where I'm expected to put this.
@crichez
Copy link
Owner Author

crichez commented Aug 1, 2024

This is related to ansible/ansible-lint#2828 but I can't find a resolution anywhere. I get it, python venvs require careful config, but the project does not provide any guidance on doing it correctly and repeatedly tells us it "just works" like in https://ansible.readthedocs.io/projects/lint/usage/#dependencies-and-requirements.

Will likely try a more proper collection layout on a different branch and see if this improves.

Christopher Palmer-Richez added 16 commits July 31, 2024 23:22
This commit moves the requirements.yml file back to the root dir (yes, I
know I tried this already), and moves the test playbook to the playbooks
dir, which is a standard collection root dir. This is meant to see if
the playbook.yaml file is being linted without resolving dependencies,
whereas a role might not? Note that the docs at
https://ansible.readthedocs.io/projects/lint/usage/#dependencies-and-requirements
conflict with the docs referenced in previous commits. The ansible-lint
docs don't suggest that the requirements.yml file will be detected in
roles/<role>/meta/requirements.yml.
Also properly removes playbook.yaml from root as desired in previous
commits.
Not sure what is actually in the runner image.
This commit switches to ansible-test instead of ansible-lint due
to its availability in the main runner image without the use of the
ansible-lint action.
Runner does not have subdirs that are standard with a regular ansible
installation.
Looks like it does not support shell variable substitution. Use a hard
path for now, we will make this pretty later.
This is needed by ansible-test.
This commit reattempts to use ansible-lint from a shell, but installs it
first.
@crichez crichez merged commit ef43145 into main Aug 1, 2024
1 check failed
@crichez crichez deleted the repo/lint-workflow branch August 1, 2024 16:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant