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

Added yamllint, fixed current linting errors, added github action #1727 #2013

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

priyanshikhetwani
Copy link

@priyanshikhetwani priyanshikhetwani commented Oct 17, 2024

What this PR does / why we need it: Enhance linting to cover yaml files (to avoid issues as - 7cd7fcc)

Which issue(s) this PR fixes (optional, in fixes #<issue number>(, fixes #<issue_number>, ...) format, will close the issue(s) when PR gets merged):
Fixes #1497

Test Workflow:
Screenshot 2024-10-18 at 12 44 26 PM

@k8s-ci-robot k8s-ci-robot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Oct 17, 2024
Copy link

linux-foundation-easycla bot commented Oct 17, 2024

CLA Not Signed

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: priyanshikhetwani
Once this PR has been reviewed and has the lgtm label, please assign prajyot-parab for approval. For more information see the Kubernetes Code Review Process.

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the cncf-cla: no Indicates the PR's author has not signed the CNCF CLA. label Oct 17, 2024
@k8s-ci-robot
Copy link
Contributor

Welcome @priyanshikhetwani!

It looks like this is your first PR to kubernetes-sigs/cluster-api-provider-ibmcloud 🎉. Please refer to our pull request process documentation to help your PR have a smooth ride to approval.

You will be prompted by a bot to use commands during the review process. Do not be afraid to follow the prompts! It is okay to experiment. Here is the bot commands documentation.

You can also check if kubernetes-sigs/cluster-api-provider-ibmcloud has its own contribution guidelines.

You may want to refer to our testing guide if you run into trouble with your tests not passing.

If you are having difficulty getting your pull request seen, please follow the recommended escalation practices. Also, for tips and tricks in the contribution process you may want to read the Kubernetes contributor cheat sheet. We want to make sure your contribution gets all the attention it needs!

Thank you, and welcome to Kubernetes. 😃

@k8s-ci-robot k8s-ci-robot added the needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label Oct 17, 2024
@k8s-ci-robot
Copy link
Contributor

Hi @priyanshikhetwani. Thanks for your PR.

I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@k8s-ci-robot k8s-ci-robot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Oct 17, 2024
Copy link

netlify bot commented Oct 17, 2024

Deploy Preview for kubernetes-sigs-cluster-api-ibmcloud ready!

Name Link
🔨 Latest commit 14959ec
🔍 Latest deploy log https://app.netlify.com/sites/kubernetes-sigs-cluster-api-ibmcloud/deploys/67351f8c050ee60008157eef
😎 Deploy Preview https://deploy-preview-2013--kubernetes-sigs-cluster-api-ibmcloud.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@priyanshikhetwani priyanshikhetwani changed the title WIP: Enhance yamllint Added yamllint, fixed current linting errors, added github action #1727 Oct 18, 2024
@k8s-ci-robot k8s-ci-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Oct 18, 2024
Copy link
Contributor

@Amulyam24 Amulyam24 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the PR @priyanshikhetwani!

Did you happen to verify the workflow against your fork? It'll be helpful if you could share a sample run here.

@priyanshikhetwani
Copy link
Author

Thank you for the PR @priyanshikhetwani!

Did you happen to verify the workflow against your fork? It'll be helpful if you could share a sample run here.

Added the same

@Prajyot-Parab
Copy link
Contributor

@priyanshikhetwani please squash the commits.

@Prajyot-Parab
Copy link
Contributor

/ok-to-test

@k8s-ci-robot k8s-ci-robot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Oct 18, 2024
@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. and removed cncf-cla: no Indicates the PR's author has not signed the CNCF CLA. labels Oct 18, 2024
@priyanshikhetwani
Copy link
Author

@priyanshikhetwani please squash the commits.

Done

Copy link
Contributor

@Amulyam24 Amulyam24 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@priyanshikhetwani, when I run this locally, see quite a lot of errors regarding trailing spaces, can you please cross check?

./templates/cluster-template-powervs-clusterclass/cluster-with-kcp.yaml
  56:21     error    too many spaces after colon  (colons)
  61:21     error    too many spaces after colon  (colons)
  169:1     error    trailing spaces  (trailing-spaces)
  183:1     error    trailing spaces  (trailing-spaces)
  185:1     error    trailing spaces  (trailing-spaces)
  188:1     error    trailing spaces  (trailing-spaces)
  194:1     error    trailing spaces  (trailing-spaces)
  196:1     error    trailing spaces  (trailing-spaces)
  201:1     error    trailing spaces  (trailing-spaces)
  206:1     error    trailing spaces  (trailing-spaces)

./templates/bases/powervs/kcp.yaml
  125:1     error    trailing spaces  (trailing-spaces)
  139:1     error    trailing spaces  (trailing-spaces)
  141:1     error    trailing spaces  (trailing-spaces)
  144:1     error    trailing spaces  (trailing-spaces)
  150:1     error    trailing spaces  (trailing-spaces)
  152:1     error    trailing spaces  (trailing-spaces)
  157:1     error    trailing spaces  (trailing-spaces)
  162:1     error    trailing spaces  (trailing-spaces)

./templates/bases/vpc/kcp.yaml
  29:26     error    trailing spaces  (trailing-spaces)
  36:26     error    trailing spaces  (trailing-spaces)

./templates/cluster-template-vpc-clusterclass/cluster-with-kcp.yaml
  107:30    error    trailing spaces  (trailing-spaces)
  114:30    error    trailing spaces  (trailing-spaces)

Comment on lines 12 to 18
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: '1.22'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makefile Outdated
@@ -546,6 +546,24 @@ else
echo "Versions are different across Makefiles. Please ensure to keep them uniform."
endif


.PHONY: install-yamllint
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor

@Amulyam24 Amulyam24 Oct 25, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point @Prajyot-Parab, wasilibs/go-yamllint looks like it is recently developed, not sure how well it will be maintained going further. Do we want to explore with another reliable source?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Amulyam24 IMO yes we should try out something more stable/matured source.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@priyanshikhetwani, initially adrienverge/yamllint was being considered, were there any challenges with it which made you switch to go-yamllint ?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Amulyam24 @Prajyot-Parab I primarily switched because adrienverge/yamllint requires Python and pip.
I am exploring other better/mature options as well.

run: make install-yamllint

- name: Run yamllint
run: make lint-yaml
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
run: make lint-yaml
run: make lint-yaml

@k8s-ci-robot k8s-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Oct 27, 2024
@mkumatag mkumatag added this to the v0.9.0 milestone Oct 29, 2024
@Amulyam24
Copy link
Contributor

I am exploring other better/mature options as well.

@priyanshikhetwani, any update?

@priyanshikhetwani
Copy link
Author

Trying yamlfmt, it's a Go-based tool, well maintained.

It automatically formats YAML files but doesn't provide detailed error messages. If we want more verbose feedback, we might need an additional tool.

Next Steps:

  • Decide whether to keep auto-formatting enabled.
  • Consider adding a custom linter if needed.
Screenshot 2024-11-11 at 10 23 44 AM

@k8s-ci-robot k8s-ci-robot added cncf-cla: no Indicates the PR's author has not signed the CNCF CLA. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. and removed cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Nov 13, 2024
@k8s-ci-robot
Copy link
Contributor

k8s-ci-robot commented Nov 13, 2024

@priyanshikhetwani: The following test failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
pull-cluster-api-provider-ibmcloud-verify 14959ec link true /test pull-cluster-api-provider-ibmcloud-verify

Full PR test history. Your PR dashboard. Please help us cut down on flakes by linking to an open issue when you hit one in your PR.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here.

@Karthik-K-N
Copy link
Contributor

Hi, Thanks for the work on this, I believe still some work is left here, So lets not hurry as it involves configuration yaml files. We have decided to take this for next release.

@mkumatag mkumatag modified the milestones: v0.9.0, Next Nov 14, 2024
@Karthik-K-N
Copy link
Contributor

@priyanshikhetwani what else should we need on this PR

@priyanshikhetwani
Copy link
Author

Hi @Karthik-K-N , ideally, we wanted a go based yaml linting tool that was well maintained.
the tool that we are currently using yamlfmt is not very verbose with lint errors, it shows comparison of current and expected format.
Now we can either go with python based linter and can enable auto formatting with yamlfmt or have a custom linter with yamlfmt.
Currently, we have go based yamllint tool for linting messages (this is not very accurate so using yamlfmt as well)
yamlfmt for comparison and auto formatting

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cncf-cla: no Indicates the PR's author has not signed the CNCF CLA. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Enhance linting to cover yaml files
7 participants