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

Introduce linting for actions workflow files #15955

Closed
Tracked by #15951
jmhbnz opened this issue May 25, 2023 · 3 comments
Closed
Tracked by #15951

Introduce linting for actions workflow files #15955

jmhbnz opened this issue May 25, 2023 · 3 comments

Comments

@jmhbnz
Copy link
Member

jmhbnz commented May 25, 2023

What would you like to be added?

This is a sub issue under #15951.

Our etcd github actions workflows currently fail a number of very basic yamllint tests, examples that are worth fixing are below:

./.github/workflows/contrib.yaml
  1:1       warning  missing document start "---"  (document-start)
  11:5      error    wrong indentation: expected 6 but found 4  
./.github/workflows/scorecards.yml
  1:1       warning  missing document start "---"  (document-start)
  8:16      error    too many spaces inside brackets  (brackets)
  8:23      error    too many spaces inside brackets  (brackets)
  49:1      error    trailing spaces  (trailing-spaces)

We should ignore the follow warnings:

Warning Reason
Line too long Usually problematic to try and address.
truthy value should be one of [false, true] Yamllint doesn’t understand the concept of on: for github actions files.
too few spaces before comment This generally refers to the comments added automatically by dependabot for ci actions versions so we should leave these.

While the existing errors should be fixed we should also consider introducing a minimal yamllint configuration and potentially make target to ensure new errors don't creep in over time and we maintain best practices.

Why is this needed?

Enforce best practices for yaml files.

@tao12345666333
Copy link
Contributor

Please assign to me, thanks

@jmhbnz
Copy link
Member Author

jmhbnz commented May 26, 2023

All yours @tao12345666333, thanks for offering to help!

A couple quick notes on your approach for this:

  • Consider doing an initial pull request or multiple smaller pull requests just to fix existing lint issues, then doing a follow-up pull request for the implementation of automated lint checks as part of the static analysis github actions workflow.
  • When introducing the automated checking please do so via new Makefile make verify ... and make fix ... targets.

Feel free to reply here or message me on the Kubernetes slack if any questions pop up 🙂

@jmhbnz
Copy link
Member Author

jmhbnz commented Jun 6, 2023

Closing as both sub tasks have been completed, thanks @tao12345666333 🚀

@jmhbnz jmhbnz closed this as completed Jun 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

2 participants