12 Commits

Author SHA1 Message Date
Ian Wienand
5a2c7bff96 linters: update to ansible-lint 6
This updates to ansible-lint 6.  Some prior changes have updated for
the bulk of the rules, a couple of noqa points are added here.  Some
updates to the skipped rules are added.  This should have no
operational change, the only updates are cosmetic.

Change-Id: I165677bbb904f92292df00f7b9b27f8f3573aeb0
2022-07-27 17:13:39 +10:00
Sorin Sbarnea
57415688ce Remove ansible-lint path exclusions
Fixes several rules with test-playbooks and remove path exclusions.

Since we introduced the progressive mode, exclusions are no longer
needed and not haivng them will assure newly added code follows
the same guidelines.

Change-Id: I0a72d34aff8cf23172e26c7f44e0f61571ec74b6
2021-04-27 08:22:32 +00:00
Sorin Sbarnea
0eaa5cf59a Upgrade ansible-lint to 5.0
- bumps ansible-lint to 5.0
- updates our custom rules to make them compatible with 5.0
- replace custom module mocking with native ansible-lint ones
- remove custom call of ansible-playbook --syntax-check as now this
  is done by ansible-lint
- assured molecule vars are hosted under a vars/ folder in order to
  avoid confusing linter detection.
- replaced custom rule for loop var names in role as now this this an
  optional core feature of the linter (see config)
- replaced custom rule no-same-owner with opt-in one (see config)

Change-Id: I233fae8c9036d295968a97ee80e07fde8846c633
2021-03-17 15:44:43 +00:00
Sorin Sbarnea
3febd1423a Enable progressive mode with ansible-lint
Makes use of newer feature which produces failures only when current
commit is adding new violations, exiting ones being considered
as already known.

To prove it works, it also removes the E208 from warn, making it
an error. Still, the final linting result is a success because
these violations were already present before current commit.

Change-Id: Ia858f2a3e71d9634e9d90e890d82714105e8f8c9
2020-11-07 03:20:19 +01:00
Tobias Henkel
753f6157f4
Merge upload logs modules into common role
As a first step towards minimizing code duplication between the
various upload-logs roles move the uplaod modules into a common role
upload-logs-base. For easier review common code will be consolidated
in a followup change.

The google and s3 variant missed the unicode fix that swift log upload
received. Add this to make to make the test cases work with the same
fixtures.

Change-Id: I2d4474ae1023c3f3e03faaa5b888e705ee2ed0bc
2020-09-25 13:21:12 +02:00
Sorin Sbarnea
73c4e795f3 Add mode to packer
Address E208 rule violation

Change-Id: I9ab220b0b8cf52ec42d2b4f5097b8bdc9b8f6fc8
Upstream: https://ansible-lint.readthedocs.io/en/latest/default_rules.html#file-permissions-not-mentioned
2020-09-17 16:21:12 +00:00
Andreas Jaeger
495c5ed62e Disable E208 for now
ansible-lint throws an undocumented error "E208 File permissions not
mentioned" that looks too aggressive, for example it complains IMHO
wrongly about:

roles/add-build-sshkey/tasks/remote-linux.yaml:1: [E208] File permissions not mentioned
roles/add-build-sshkey/tasks/remote-linux.yaml:14: [E208] File permissions not mentioned
roles/add-build-sshkey/tasks/remote-linux.yaml:20: [E208] File permissions not mentioned
roles/add-build-sshkey/tasks/remote-linux.yaml:27: [E208] File permissions not mentioned

Disable it for now until ansible-lint is fixed - and the real problems
in zuul-jobs are fixed.

https://github.com/ansible/ansible-lint/pull/949 fixes the false
positives. Once that is merged and a new release is out, we should
revert and fix the real problems.

Change-Id: I3e3978bbc9458ad79623d22969344fb46f5fee43
2020-08-14 09:56:25 +02:00
James E. Blair
8501cc23fc Ignore ansible lint E106
E106 rejects roles with '-' in their names, which is important
for collections, but these aren't collections.

https://docs.ansible.com/ansible/devel/dev_guide/developing_collections.html#roles-directory

Change-Id: I48f837e8d5bd7d0d9d708d728d93627deb4093cc
2020-06-30 16:18:59 -07:00
Sorin Sbarnea
5e9f91764e Bump ansible-lint to 4.3.0
- Bumps linter and make use of its auto-detection
- Temporary skips linting test-playbooks/ to match previous behavior
- Documents skips in a way that makes it easy to maintain the rules
- Keeps linter config in standard location, so it can be loaded
  regardless how is called.

Change-Id: Ic379c91fa9385473f6ec2af91e61953dc10c1f54
2020-05-28 16:48:14 +01:00
Albin Vass
d0e2016592 Add loop var policy to ansible-lint
This adds a custom ansible-lint rule at .rules/ZuulJobsNamespaceLoopVar.py
that enforces the loop var policy described at:
https://zuul-ci.org/docs/zuul-jobs/policy.html#ansible-loops-in-roles

It also updates existing roles to follow the policy.

Change-Id: I92b2ff56a1c2702542fc07b316f1809087a4c92f
2020-04-29 17:20:59 +02:00
Andreas Jaeger
b45e8ceb3c Update ansible-lint exception
ANSIBLE0012 is the old name, 301 is the new name for the lint rule.
Change conifguration to use new name.

Change-Id: I8e3148a54ec811308865882d79edc255d61cfff0
2020-03-18 22:17:14 +01:00
Monty Taylor
c800638473 Use a zuul_* and add an .ansible-lint file
ansible-lint now supports settings in a file, including exclude_paths.
This lets us simplfy the ansible-lint command. Also, stop installing
zuul and just use a fake zuul_return and zuul_console
to fake out ansible-lint.

Change-Id: I1482a9ab915cec2d45695b60cdbeb93d58cb392c
2020-03-13 20:26:06 +01:00