-
Notifications
You must be signed in to change notification settings - Fork 4k
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 golangci-lint to github workflow #7556
Conversation
8ba1231
to
0bc129d
Compare
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: omerap12 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 |
0bc129d
to
d612981
Compare
cd2534d
to
9ec4890
Compare
0c4b7b2
to
781210b
Compare
Signed-off-by: Omer Aplatony <[email protected]>
781210b
to
e492f4d
Compare
I've added this action: golangci-lint-action v6. However, I’m not happy with the duplicated code—perhaps someone can suggest a better approach. One possibility is to create a separate GitHub workflow file to run the linter in parallel using a matrix configuration. lint:
runs-on: ubuntu-latest
strategy:
matrix:
dir: [vertical-pod-autoscaler, cluster-autoscaler, addon-resizer, balancer, multidimensional-pod-autoscaler]
steps:
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: '1.22.2'
- uses: actions/checkout@v2
with:
path: ${{ env.GOPATH }}/src/k8s.io/autoscaler
- name: golangci-lint
uses: golangci/golangci-lint-action@v6
with:
working-directory: ${{ env.GOPATH }}/src/k8s.io/autoscaler/${{ matrix.dir }}
version: v1.60 Alternatively, we could skip GitHub Actions entirely and integrate this manually into the existing script: verify-golint.sh. Any thoughts or suggestions? |
FWIW I think the way you have it here is OK. Moving these up into GitHub Actions seems like the right path forward to me, the UX is also slightly better that way with a nice breakdown in each PR for each action. So overall direction here LGTM. |
I'm also fine with the duplication, it isn't that big of a deal |
Could you enable checks? I want to see what the annotations look like: https://github.com/golangci/golangci-lint-action?tab=readme-ov-file#annotations |
4cf5017
to
ecece5f
Compare
func parseVpaObservedContainers(pod *apiv1.Pod) (bool, sets.String) { | ||
observedContainers, hasObservedContainers := pod.GetAnnotations()[annotations.VpaObservedContainersLabel] | ||
vpaContainerSet := sets.New[string]() | ||
vpaContainerSet := sets.NewString() | ||
if hasObservedContainers { | ||
if containers, err := annotations.ParseVpaObservedContainersValue(observedContainers); err != nil { | ||
klog.ErrorS(err, "VPA annotation failed to parse", "pod", klog.KObj(pod), "annotation", observedContainers) |
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 have changed this just for testing purposes . Ill will revert this before merge
done |
I tested out annotations in https://github.com/kubernetes/autoscaler/pull/7558/files, I like them |
Signed-off-by: Omer Aplatony <[email protected]>
ecece5f
to
86da7a5
Compare
Hmmm... balancer is failing. |
@adrianmoisey , added. |
GitHub Actions PRs can be hard to merge, so I tried to do everything in one PR. I don’t mind splitting it into a couple of PRs if that works better. @raywainman, what do you think? |
For approval sake, it may make sense to make a PR per project, and once they are merged, add the GitHub Action |
So I'm closing this PR for now |
What type of PR is this?
/kind cleanup
What this PR does / why we need it:
Adds golangci-lint to verify code quality along with golint (ref: #7542 (comment))
Which issue(s) this PR fixes:
Fixes #
Special notes for your reviewer:
Does this PR introduce a user-facing change?
Additional documentation e.g., KEPs (Kubernetes Enhancement Proposals), usage docs, etc.: