-
Notifications
You must be signed in to change notification settings - Fork 77
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
Enhancement: Generate cookie cutter templates and apply linting on them #123
Conversation
set -euo pipefail | ||
|
||
rm -rf test/roles/* || true | ||
mkdir -p test/roles |
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.
Every time we run tox -e lint
, it will generate some temporary files locally, can we add test/roles
in .gitignore
?
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.
pre-commit will ignore stuff inside .gitignore
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 may be missing something but why not creating a temporary directory with mktemp ? issue with non linux os like macosx ?
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.
What benefitsmktemp
can bring?
IMHO, mktemp
is better for unique
file name. In this PR, we just want to create a directory and generate some files in them.
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 find it cleaner. It won't do any change in the working directory and it should avoid having to deal with configurations files of tools like git or pre-commit to ignore it.
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.
There's some errors in the generated molecule template that I have no way around. which requires me to add the files to .ansible-lint-ignore
.
I prefer to use mktemp
but .ansible-lint-ignore
doesn't take wildcard paths sadly
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.
hm. maybe it would be easier to fix all errors before merging this PR, maybe this would make the .ansible-lint-ignore file useless ?
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.
Some errors are unfixable. And the fixable ones are too much to be included in this PR. there's no going around .ansible-lint-ignore
file
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.
It's fun to fix the real lint issue in another issue.
Ignoring them to make the PR smaller is acceptable.
I will fix the remaining errors later and have a final commit for this PR @zhan9san |
There are much many lint issues now. It's tedious to add them one by one in We can add In this PR, it is fine to enabl ansible-lint in CI only. Try to make the PR as smaller. |
Can you please clean this PR a little bit ? Moreover, I see changes which should probably need their own PR:
I'm going to add also some quick comments to some of the changes done. There will possibly more later, one this PR is clean. |
@apatard I have cleaned up the code and only left changes relevant to making the ci functional. Any syntax fixes for ansbile I will do in other PRs. About VM size I plan to open another PR for it but no this one. |
tools/generate-templates.sh
Outdated
rm -rf test/roles/* || true | ||
mkdir -p test/roles | ||
|
||
while IFS='' read -r line; do DRIVER_NAMES+=("$line"); done < <(python "tools/toml_to_json.py" "pyproject.toml" | jq -rc '.project."entry-points"."molecule.driver" | keys[]') |
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.
why not making the python script outputting the list of drivers ?
This would avoid using jq and if we need later a way to get the list of drivers, the python script would be very handy.
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.
@apatard Yeah at first i wanted to do it without a script with some shell command but couldn't find any reliable python-cli toml parser.
I have updated it to output the plugins, it makes more sense this way
87e2e40
to
8218e0b
Compare
for more information, see https://pre-commit.ci
I guess this PR is near to be ready to be merged. I hope that once merged, we'll manage to reduce the ignore list. |
@zhan9san while we're waiting for github actions to be working again, do you have remaining comments ? |
LGTM. Is Github Action down? |
Github actions seem to be back. Can any of the maintainers re run the checks ? |
Things are not perfect but the CI is green, so I guess it's time to merge. The side-effects (if any) can be fixed later. It's better than not having -lint on the cookie cutter stuff. Thanks |
closes #122