-
Notifications
You must be signed in to change notification settings - Fork 89
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
[WIP] Ansible-lint: Add example config for github action #612
base: main
Are you sure you want to change the base?
[WIP] Ansible-lint: Add example config for github action #612
Conversation
Signed-off-by: Markus Teufelberger <[email protected]>
Yay, already their documented example is broken: "Error: Unable to resolve action |
There's also https://github.com/ansible/ansible-lint-action, maybe that's what they meant to use instead? Let's try... |
Signed-off-by: Markus Teufelberger <[email protected]>
Ah well... "CRITICAL Linter finished without analyzing any file, check configuration and arguments given." Seems like it still has its issues when running against a checked out collection even in a very default layout. Unfortunately the GH-Action seems quite limited when it comes to access to parameter, so setting it to "verbose" to find out what's going on sounds like quite the journey. |
I'm actually not sure what it should even lint. We don't provide playbooks or roles outside of tests, so no files to lint seems reasonable. I would expect it to lint |
The linter mainly lints the YAML integration tests in tests/integration/targets/. It will produce a HUGE number of errors/warnings/... My suggestion would be to simply ignore all errors for now. (But for that it first has to actually run...) |
Signed-off-by: Markus Teufelberger <[email protected]>
Wow, it is almost impressive how much it complains! |
I guess I can add ignores for everything and then start fixing stuff one-by-one either automatically (via |
Signed-off-by: Markus Teufelberger <[email protected]>
.ansible-lint
Outdated
@@ -0,0 +1,31 @@ | |||
--- | |||
skip_list: | |||
# TODO: Fix and enable one-by-one over time |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But only the ones that make sense. sanity[cannot-ignore]
looks pretty much wrong, for example.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I hope that the eventual goal is to have both the collection(s) and ansible-lint rules in a state that no rule skips or any changes to default configs are necessary. For sanity[cannot-ignore]
for example I am hardlocked on ansible/ansible#79700 making it into ansible-core and every version of ansible-core falling out of support until I can disable this in my collection. Similar with the shebangs in this repo here apparently?
There are some easy wins with fixing the long tail of errors (end of line whitespace and such) and automatic rewrites could be used or introduced for some things too. There are however also some issues with that (e.g. ansible/ansible-lint#3226 will hit every collection created from the default template).
Co-authored-by: Felix Fontein <[email protected]>
Signed-off-by: Markus Teufelberger <[email protected]>
Signed-off-by: Markus Teufelberger <[email protected]>
Signed-off-by: Markus Teufelberger <[email protected]>
I ran against 6.17.0 locally and it complains even more. Added a few quick fixes ( |
For example
--write mode, but there's also no way that I'm adding hundreds of FQCNs by hand or semi-automated to every task when there's already a perfectly good transform available for that. Unfortunately there is no way currently to only do transforms as ansible-lint kinda depends on being able to completely rewrite everything first.
I guess we can add it as-is and fix a few low hanging fruits over time while keeping the big whoppers around until transforms are available or there is a way that formatting doesn't get completely smashed while keeping liniting available (and non-Ansible files are no longer re-formatted by ansible-lint). I don't really want to start adding tons of config other than rule ignores to the |
Signed-off-by: Markus Teufelberger <[email protected]>
902d59f
to
4f25aca
Compare
Signed-off-by: Markus Teufelberger <[email protected]>
Signed-off-by: Markus Teufelberger <[email protected]>
Signed-off-by: Markus Teufelberger <[email protected]>
Signed-off-by: Markus Teufelberger <[email protected]>
Signed-off-by: Markus Teufelberger <[email protected]>
Signed-off-by: Markus Teufelberger <[email protected]>
Looks like they want to use the action from https://github.com/ansible/ansible-lint/blob/main/action.yml actually, not the one from that other repository. I'll update this PR next week thusly. The other common change in other collections seems to be to use an |
Fine with me, as long as |
Signed-off-by: Markus Teufelberger <[email protected]>
I'm not sure if it is better to kinda document all 533 rule violations and eventually fix them while not allowing new ones because there's not much to take inspiration from (aka. copy paste) when writing new tests for example. I don't see how current violations are much better or worthy of keeping around though on the other hand it just makes more work for the future to eventually fix all this rule by rule. In any case it is easy enough (and just tedious) to fix stuff, it would just be nice if we could actually use |
This comment was marked as off-topic.
This comment was marked as off-topic.
Also considering that .ansible-lint-ignore is 41 KiB, I think the previous version of the PR was nicer - mainly for the reasons you mentioned :-) |
name: Ansible Lint | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Run ansible-lint |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A checkout step needs to be added before here. There was a breaking change in the action that started requiring that.
@MarkusTeufelberger do you want to further update this? Or should we restart this with a fresh PR? (Or abandon it for now?) |
I think I'll rebase and check with the current version. |
SUMMARY
resolves #611
ISSUE TYPE
COMPONENT NAME
Tests
ADDITIONAL INFORMATION
Let's see how this works out.