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

use official Ansible container for ansible-lint #100

Merged
merged 2 commits into from
Jan 13, 2023

Conversation

richm
Copy link
Contributor

@richm richm commented Dec 14, 2022

Basically, run ansible-lint locally the same way that the ansible-lint
github action runs. This helps when you get errors in the github CI,
you can reproduce and fix locally.

https://github.com/ansible/ansible-lint-action/blob/main/action.yml#L24

Get rid of the lsr_ansible-lint configuration. If you want to configure
ansible-lint, you specify .ansible-lint in the role repo root directory.
This also helps simplify and make the local action work just like the
github action.

By default, it will use podman to run the container. You can set
LSR_CONTAINER_RUNTIME to use a different runtime.

You can pass extra command line arguments to ansible-lint like this:
tox -e ansible-lint -- -vvv --exclude=my/dir/ ...

@richm richm requested review from nhosoi and spetrosi December 14, 2022 17:57
Basically, run ansible-lint locally the same way that the ansible-lint
github action runs.  This helps when you get errors in the github CI,
you can reproduce and fix locally.

https://github.com/ansible/ansible-lint-action/blob/main/action.yml#L24

Get rid of the lsr_ansible-lint configuration.  If you want to configure
ansible-lint, you specify .ansible-lint in the role repo root directory.
This also helps simplify and make the local action work just like the
github action.

By default, it will use podman to run the container.  You can set
`LSR_CONTAINER_RUNTIME` to use a different runtime.

You can pass extra command line arguments to ansible-lint like this:
`tox -e ansible-lint -- -vvv --exclude=my/dir/ ...`
@richm richm force-pushed the ansible-lint-test-containers branch from c1ee994 to 39ade97 Compare December 21, 2022 19:42
@richm
Copy link
Contributor Author

richm commented Jan 12, 2023

@nhosoi @spetrosi this is ready for review

--exclude=.yamllint.yml \
-c {[lsr_ansible-lint]configfile} \
{env:RUN_ANSIBLE_LINT_EXTRA_ARGS:} {posargs}
{env:LSR_CONTAINER_RUNTIME:podman} run --rm --privileged \
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We may want to add the description to README.md. But it's a very minor issue...

By default, it will use podman to run the container. You can set LSR_CONTAINER_RUNTIME to use a different runtime

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated
also deprecated several old env. vars.

Copy link
Contributor

@nhosoi nhosoi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Excellent!

lgtm

@richm richm merged commit 0fef502 into linux-system-roles:main Jan 13, 2023
@richm richm deleted the ansible-lint-test-containers branch January 13, 2023 00:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants