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

Add .yamllint config file to use yamllint to enhance linting for yaml files #1521

Closed

Conversation

yuanning6
Copy link

… files

What this PR does / why we need it:

This PR adds a .yamllint config file which has rules to config yamllint to enhance linting for yaml files. The lint will be helpful to avoid issues like 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

Special notes for your reviewer:

This is a quick implementation just to give an overview and directions, I will continuously make improvements and changes as needed.

To install and use yamllint: Quickstart
To see the behavior: Run yamllint . in the project root directory to lint all yaml files.

/area provider/ibmcloud

  1. Please confirm that if this PR changes any image versions, then that's the sole change this PR makes.
    This PR doesn't change any image versions.

Release note:


@k8s-ci-robot k8s-ci-robot added the area/provider/ibmcloud Issues or PRs related to ibmcloud provider label Nov 29, 2023
Copy link

linux-foundation-easycla bot commented Nov 29, 2023

CLA Signed

The committers listed above are authorized under a signed CLA.

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: yuanning6
Once this PR has been reviewed and has the lgtm label, please assign jichenjc 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

Copy link

netlify bot commented Nov 29, 2023

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

Name Link
🔨 Latest commit 0c4bfa7
🔍 Latest deploy log https://app.netlify.com/sites/kubernetes-sigs-cluster-api-ibmcloud/deploys/65a857fe8333c30008bede5a
😎 Deploy Preview https://deploy-preview-1521--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.

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

Welcome @yuanning6!

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 Nov 29, 2023
@k8s-ci-robot
Copy link
Contributor

Hi @yuanning6. 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/test-infra repository.

@k8s-ci-robot k8s-ci-robot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Nov 29, 2023
@mkumatag
Copy link
Member

/cc @Prajyot-Parab

@Prajyot-Parab
Copy link
Contributor

/easycla

@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. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. cncf-cla: no Indicates the PR's author has not signed the CNCF CLA. labels Nov 30, 2023
@Prajyot-Parab
Copy link
Contributor

@yuanning6 Few Pointers -

  1. Include a Makefile target to install yamllint
  2. Skip autogenerated config dir from liniting (config dir)
  3. lets fix all the linting issues seen

@yuanning6
Copy link
Author

@yuanning6 Few Pointers -

  1. Include a Makefile target to install yamllint
  2. Skip autogenerated config dir from liniting (config dir)
  3. lets fix all the linting issues seen

@Prajyot-Parab Thank you for taking the review! I'll work on them after the busy finals :')

@k8s-ci-robot k8s-ci-robot added do-not-merge/invalid-commit-message Indicates that a PR should not merge because it has an invalid commit message. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Dec 19, 2023
@yuanning6
Copy link
Author

yuanning6 commented Dec 19, 2023

@Prajyot-Parab
Hi! I made some changes based on your pointers: d1ab3ea

I removed one rule which was to check the Document Start Marker from yaml files. Now it gives warning: "missing document start "---"", it used to give another warning when the Document Start Marker is not asked: "found forbidden document start "---"". Not sure whether this rule should be included or not, it gives a warning no matter what. To output only error level problems we can use --no-warnings flag.

Regarding the Makefile part, I'm not sure if I completely understood your requirements. Please let me know if there's anything I need to change!

There's also a conflict: https://github.com/kubernetes-sigs/cluster-api-provider-ibmcloud/pull/1521/conflicts. Do I have the permission to resolve it?

@k8s-ci-robot k8s-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Dec 19, 2023
@k8s-ci-robot
Copy link
Contributor

k8s-ci-robot commented Jan 14, 2024

@yuanning6: 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-ccm-image db52cde link true /test pull-cluster-api-provider-ccm-image

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/test-infra repository. I understand the commands that are listed here.

@yuanning6
Copy link
Author

Hi @Prajyot-Parab , hope you had a great holiday!

I updated my branch to make it keep up with the main branch, but there's still the conflict. And After updating, it shows I want to merge 40 commits into main, I'm not sure whether something went wrong or not... t-t

Could you please give me some guidance? Thank you!!

@Prajyot-Parab
Copy link
Contributor

Hi @Prajyot-Parab , hope you had a great holiday!

I updated my branch to make it keep up with the main branch, but there's still the conflict. And After updating, it shows I want to merge 40 commits into main, I'm not sure whether something went wrong or not... t-t

Could you please give me some guidance? Thank you!!

Step 1 - You should be on your commit
Step 2 - Fetch latest upstream code git fetch upstream
Step 3 - Rebase your branch with upstream/main git rebase upstream/main
Step 4 (Only incase of conflicts) - Fix conflicts if any, git add fixed files, git rebase --continue
Step 5 - Push code to your brach on forked repo git push origin main --force

@k8s-ci-robot k8s-ci-robot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed do-not-merge/invalid-commit-message Indicates that a PR should not merge because it has an invalid commit message. needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. labels Jan 17, 2024
@yuanning6
Copy link
Author

Hi @Prajyot-Parab , I followed your instruction, it worked! Thank you so much! I would be very grateful if you could take a look at the code at your convenience. :))

@@ -150,6 +150,11 @@ vet:
help: # Display this help
@awk 'BEGIN {FS = ":.*##"; printf "\nUsage:\n make \033[36m<target>\033[0m\n\nTargets:\n"} /^[0-9A-Za-z_-]+:.*?##/ { printf " \033[36m%-45s\033[0m %s\n", $$1, $$2 } /^\$$\([0-9A-Za-z_-]+\):.*?##/ { gsub("_","-", $$1); printf " \033[36m%-45s\033[0m %s\n", tolower(substr($$1, 3, length($$1)-7)), $$2 } /^##@/ { printf "\n\033[1m%s\033[0m\n", substr($$0, 5) } ' $(MAKEFILE_LIST)

# Install yamllint if not present
Copy link
Contributor

@Prajyot-Parab Prajyot-Parab Jan 30, 2024

Choose a reason for hiding this comment

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

  1. Move this target under lint/verify section
  2. This will just install the lint (you can refer normal lint target in Makefile to see how the tooling is installed and follow same approach)
  3. You need to introduce a target to run the yamlint against the project (present one just installs it)

@k8s-ci-robot
Copy link
Contributor

PR needs rebase.

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/test-infra repository.

@k8s-ci-robot k8s-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Mar 24, 2024
@Prajyot-Parab
Copy link
Contributor

@yuanning6 any update on this one.

@yuanning6
Copy link
Author

@Prajyot-Parab Sorry I'm a bit busy these days, will look into it next week!

@yuanning6
Copy link
Author

Hi @Prajyot-Parab !

I made another PR: #1727 (because I messed up with commits in the previous one...). This one has the targets to run yamllint outputting warnings level problems or not outputting.

Please let me know if any improvements are needed!

@Prajyot-Parab
Copy link
Contributor

/close in favor of #1727

@Prajyot-Parab
Copy link
Contributor

/close

@k8s-ci-robot
Copy link
Contributor

@Prajyot-Parab: Closed this PR.

In response to this:

/close

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/provider/ibmcloud Issues or PRs related to ibmcloud provider 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. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Enhance linting to cover yaml files
4 participants