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

ci: Use supported ansible-lint action; run ansible-lint against the collection #177

Merged
merged 1 commit into from
Jan 6, 2024

Conversation

richm
Copy link
Contributor

@richm richm commented Jan 4, 2024

The old ansible-community ansible-lint is deprecated. There is a
new ansible-lint github action. The new ansible-lint has several checks
related to ansible-test and the ignore files. Many of our ignore settings
are not allowed any more and are required to be fixed or addressed in the
Ansible preferred way.

The python imports have to be wrapped in a try/except ImportError, and
where possible, an error must be returned from the module explaining
what was not able to be imported.

The module documentation must comply with the Ansible standards.

Because the module code uses mypy, we have to tell ansible-test
to ignore some code with compile-2.7!skip and import-x.y!skip,
which ansible-lint does not like, so we have to add

skip_list:
  - sanity[cannot-ignore]

to make ansible-lint happy.

The latest Ansible repo gating tests run ansible-lint against
the collection format instead of against individual roles.
We have to convert the role to collection format before running
ansible-test.

Role developers can run this locally using
tox -e collection,ansible-lint-collection
See linux-system-roles/tox-lsr#125

Add --- doc start to .markdownlint.yaml

Signed-off-by: Rich Megginson [email protected]

@richm richm requested a review from tomjelinek as a code owner January 4, 2024 16:59
Copy link

codecov bot commented Jan 4, 2024

Codecov Report

Attention: 17 lines in your changes are missing coverage. Please review.

Comparison is base (d930513) 80.45% compared to head (f10bba4) 76.53%.

Files Patch % Lines
library/pcs_api_v2.py 38.46% 8 Missing ⚠️
library/pcs_qdevice_certs.py 38.46% 8 Missing ⚠️
module_utils/ha_cluster_lsr/pcs_api_v2_utils.py 96.29% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #177      +/-   ##
==========================================
- Coverage   80.45%   76.53%   -3.92%     
==========================================
  Files           3        3              
  Lines         133      179      +46     
  Branches        0       12      +12     
==========================================
+ Hits          107      137      +30     
- Misses         26       42      +16     
Flag Coverage Δ
sanity 50.54% <70.37%> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

pass

else:
HAS_PCS = True

Check notice

Code scanning / CodeQL

Unused global variable Note

The global variable 'HAS_PCS' is not used.

else:
HAS_PCS = True
PCS_IMPORT_ERROR = None

Check notice

Code scanning / CodeQL

Unused global variable Note

The global variable 'PCS_IMPORT_ERROR' is not used.
try:
from pcs.common.async_tasks.dto import CommandDto, CommandOptionsDto
except ImportError:
HAS_PCS = False

Check notice

Code scanning / CodeQL

Unused global variable Note

The global variable 'HAS_PCS' is not used.
from pcs.common.async_tasks.dto import CommandDto, CommandOptionsDto
except ImportError:
HAS_PCS = False
PCS_IMPORT_ERROR = traceback.format_exc()

Check notice

Code scanning / CodeQL

Unused global variable Note

The global variable 'PCS_IMPORT_ERROR' is not used.
pass

else:
HAS_PCS = True

Check notice

Code scanning / CodeQL

Unused global variable Note

The global variable 'HAS_PCS' is not used.

else:
HAS_PCS = True
PCS_IMPORT_ERROR = None

Check notice

Code scanning / CodeQL

Unused global variable Note

The global variable 'PCS_IMPORT_ERROR' is not used.
try:
from pcs.common.async_tasks.dto import CommandDto, CommandOptionsDto
except ImportError:
HAS_PCS = False

Check notice

Code scanning / CodeQL

Unused global variable Note

The global variable 'HAS_PCS' is not used.
from pcs.common.async_tasks.dto import CommandDto, CommandOptionsDto
except ImportError:
HAS_PCS = False
PCS_IMPORT_ERROR = traceback.format_exc()

Check notice

Code scanning / CodeQL

Unused global variable Note

The global variable 'PCS_IMPORT_ERROR' is not used.
@richm richm force-pushed the ansible-lint-test-2.16 branch from a123f9a to 9fb67d9 Compare January 4, 2024 17:43
@richm
Copy link
Contributor Author

richm commented Jan 4, 2024

[citest]

…ollection

The old ansible-community ansible-lint is deprecated.  There is a
new ansible-lint github action.  The new ansible-lint has several checks
related to ansible-test and the ignore files.  Many of our ignore settings
are not allowed any more and are required to be fixed or addressed in the
Ansible preferred way.

The python imports have to be wrapped in a try/except ImportError, and
where possible, an error must be returned from the module explaining
what was not able to be imported.

The module documentation must comply with the Ansible standards.

Because the module code uses mypy, we have to tell ansible-test
to ignore some code with `compile-2.7!skip` and `import-x.y!skip`,
which ansible-lint does not like, so we have to add
```
skip_list:
  - sanity[cannot-ignore]
```
to make ansible-lint happy.

The latest Ansible repo gating tests run ansible-lint against
the collection format instead of against individual roles.
We have to convert the role to collection format before running
ansible-test.

Role developers can run this locally using
`tox -e collection,ansible-lint-collection`
See linux-system-roles/tox-lsr#125

Add `---` doc start to .markdownlint.yaml

Get rid of tests_include_vars_from_parent.yml - does not work anymore

Signed-off-by: Rich Megginson <[email protected]>
@richm richm force-pushed the ansible-lint-test-2.16 branch from 9fb67d9 to f10bba4 Compare January 4, 2024 21:20
@richm
Copy link
Contributor Author

richm commented Jan 4, 2024

[citest]

@richm richm merged commit f9cce07 into linux-system-roles:main Jan 6, 2024
31 of 33 checks passed
@richm richm deleted the ansible-lint-test-2.16 branch January 6, 2024 00:51
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.

1 participant