AlmaLinux / cloud-images

Packer templates and other tools for building AlmaLinux images for various cloud platforms.
MIT License
161 stars 48 forks source link

Code quality improvements #133

Closed bbaassssiiee closed 1 year ago

bbaassssiiee commented 1 year ago

Fixes #131 - ansible-lint issues, and other code quality issues. Adds pre-commit hooks to guard the Yaml and Ansible code.

How to test?

run ansible-lint in the ansible directory.

bbaassssiiee commented 1 year ago

Any chance getting this merged?

bbaassssiiee commented 1 year ago

Neglected too long by maintainer.

LKHN commented 1 year ago

Hi @bbaassssiiee ,

It's not neglected.

This PR includes many changes which I cannot merge it without any review and testing.

For example:

There are some changes beyond the Ansible code base.

In this change^1 you added --- to make Ansible and YAML linters happy but it breaks Cloud config data format specification which demands #cloud-config on the first line of Cloud-ini User Data.

The error output:

2023-05-30 09:51:40,537 - __init__.py[WARNING]: Unhandled non-multipart (text/x-not-multipart) userdata: 'b'---'...'

I don't have any exact ETA but I was planning to go back to it when I'm done with more prioritized changes and most them directly affects the images.

Many thanks for all your contributions and efforts. I hope you would find this reply understandable and helpful. :)

bbaassssiiee commented 1 year ago

Maybe better to create more granular/smaller PRs?

LKHN commented 1 year ago

Yes, that's sound like a plan!

Since we got Ansible Core from AppStream on AlmaLinux OS >= 8.6. Hopefully, we can update the current 2.9 Ansible code base starting with using fully qualified collection names (FQCN).

What I can suggest to these granular PRs idea would nice to have a GH Issue with a checklist for each Ansible role and start work on them one by one. In this issue we can make some design decisions like which Ansible Lint profile should we used or which exceptions should be add if necessary.

So, All these changes and decisions can be end up with a styling guide of this project and https://github.com/AlmaLinux/ansible-almalinux.ci

Let me know how it sounds for you too and if you have anything to add or modify.