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

fix static check failures #81940

Merged
merged 1 commit into from
Oct 10, 2019
Merged

fix static check failures #81940

merged 1 commit into from
Oct 10, 2019

Conversation

carlory
Copy link
Member

@carlory carlory commented Aug 26, 2019

What type of PR is this?

/kind cleanup

What this PR does / why we need it:

Errors from staticcheck:

plugin/pkg/admission/imagepolicy/admission.go:87:2: field retryBackoff is unused (U1000)
plugin/pkg/admission/imagepolicy/admission_test.go:1060:4: this value of err is never used (SA4006)
plugin/pkg/admission/imagepolicy/certs_test.go:22:5: var caKey is unused (U1000)
plugin/pkg/admission/imagepolicy/certs_test.go:70:5: var badCAKey is unused (U1000)

plugin/pkg/admission/podnodeselector/admission.go:235:2: this value of labelsMap is never used (SA4006)

hack/make-rules/helpers/go2make/testdata/dir-with-gofiles/bar.go:19:6: func bar is unused (U1000)
hack/make-rules/helpers/go2make/testdata/dir-with-gofiles/foo.go:19:6: func foo is unused (U1000)

pkg/apis/scheduling/v1alpha1/defaults.go:27:6: func addDefaultingFuncs is unused (U1000)

pkg/apis/scheduling/v1beta1/defaults.go:27:6: func addDefaultingFuncs is unused (U1000)

Which issue(s) this PR fixes:

Ref: #81657

Special notes for your reviewer:

Does this PR introduce a user-facing change?:

NONE

Additional documentation e.g., KEPs (Kubernetes Enhancement Proposals), usage docs, etc.:

NONE

@k8s-ci-robot k8s-ci-robot added release-note-none Denotes a PR that doesn't merit a release note. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. needs-kind Indicates a PR lacks a `kind/foo` label and requires one. needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. needs-priority Indicates a PR lacks a `priority/foo` label and requires one. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Aug 26, 2019
@k8s-ci-robot
Copy link
Contributor

Hi @carlory. Thanks for your PR.

I'm waiting for a kubernetes 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 kind/api-change Categorizes issue or PR as related to adding, removing, or otherwise changing an API and removed needs-kind Indicates a PR lacks a `kind/foo` label and requires one. labels Aug 26, 2019
@carlory
Copy link
Member Author

carlory commented Aug 26, 2019

/assign @liggitt

@fejta-bot
Copy link

This PR may require API review.

If so, when the changes are ready, complete the pre-review checklist and request an API review.

Status of requested reviews is tracked in the API Review project.

@k8s-ci-robot k8s-ci-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Sep 4, 2019
@carlory
Copy link
Member Author

carlory commented Sep 4, 2019

@liggitt

It's ready for review. Can you give me an ok-to-test label on this pr?

-----END RSA PRIVATE KEY-----`)

var clientCert = []byte(`-----BEGIN CERTIFICATE-----
MIIC+jCCAeKgAwIBAgIJAMvo2rkGpEURMA0GCSqGSIb3DQEBCwUAMCExHzAdBgNV
Copy link
Member

Choose a reason for hiding this comment

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

Why is this showing a diff?

Copy link
Member Author

Choose a reason for hiding this comment

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

@mikedanese

the certs_test.go file is generated by the gencerts.sh script.

// This file was generated using openssl by the gencerts.sh script
// and holds raw certificates for the imagepolicy webhook tests.

I changed the script and regenerated the certs_test.go file, so the file contents is changed.

//lint:file-ignore U1000 Ignore all unused code, it's generated

Copy link
Member

Choose a reason for hiding this comment

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

I'd recommend reverting the diffs in this file other than the lint comment

Copy link
Member Author

Choose a reason for hiding this comment

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

@liggitt

thanks for your review. it's reverted now.

@carlory
Copy link
Member Author

carlory commented Sep 26, 2019

@mikedanese

It's ready for re-review.

@k8s-ci-robot k8s-ci-robot added size/S Denotes a PR that changes 10-29 lines, ignoring generated files. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Sep 26, 2019
@liggitt
Copy link
Member

liggitt commented Sep 26, 2019

/lgtm
/approve

@k8s-ci-robot k8s-ci-robot added lgtm "Looks good to me", indicates that a PR is ready to be merged. approved Indicates a PR has been approved by an approver from all required OWNERS files. labels Sep 26, 2019
Copy link
Contributor

@alejandrox1 alejandrox1 left a comment

Choose a reason for hiding this comment

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

/ok-to-test
/priority important-longterm
/sig scheduling

pkg/apis/scheduling/v1alpha1/register.go Show resolved Hide resolved
@k8s-ci-robot k8s-ci-robot added priority/important-longterm Important over the long term, but may not be staffed and/or may need multiple releases to complete. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. labels Sep 26, 2019
@k8s-ci-robot k8s-ci-robot added the sig/scheduling Categorizes an issue or PR as relevant to SIG Scheduling. label Sep 26, 2019
@k8s-ci-robot k8s-ci-robot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Sep 27, 2019
@carlory
Copy link
Member Author

carlory commented Sep 27, 2019

/test pull-kubernetes-bazel-test
/test pull-kubernetes-integration

@carlory
Copy link
Member Author

carlory commented Sep 27, 2019

/test pull-kubernetes-bazel-test

1 similar comment
@carlory
Copy link
Member Author

carlory commented Sep 27, 2019

/test pull-kubernetes-bazel-test

@liggitt
Copy link
Member

liggitt commented Sep 27, 2019

/retest
/lgtm
/approve

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Sep 27, 2019
@fejta-bot
Copy link

/retest
This bot automatically retries jobs that failed/flaked on approved PRs (send feedback to fejta).

Review the full test history for this PR.

Silence the bot with an /lgtm cancel or /hold comment for consistent failures.

3 similar comments
@fejta-bot
Copy link

/retest
This bot automatically retries jobs that failed/flaked on approved PRs (send feedback to fejta).

Review the full test history for this PR.

Silence the bot with an /lgtm cancel or /hold comment for consistent failures.

@fejta-bot
Copy link

/retest
This bot automatically retries jobs that failed/flaked on approved PRs (send feedback to fejta).

Review the full test history for this PR.

Silence the bot with an /lgtm cancel or /hold comment for consistent failures.

@fejta-bot
Copy link

/retest
This bot automatically retries jobs that failed/flaked on approved PRs (send feedback to fejta).

Review the full test history for this PR.

Silence the bot with an /lgtm cancel or /hold comment for consistent failures.

@carlory
Copy link
Member Author

carlory commented Sep 28, 2019

/hold

@k8s-ci-robot k8s-ci-robot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Sep 28, 2019
@@ -1057,7 +1057,10 @@ func TestReturnedAnnotationAdd(t *testing.T) {
annotations := make(map[string]string)
attr = &fakeAttributes{attr, annotations}

err = wh.Validate(context.TODO(), attr, nil)
if err := wh.Validate(context.TODO(), attr, nil); err != nil {
Copy link
Member

Choose a reason for hiding this comment

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

err is expected to be non-nil for test: "Adds annotations for bad request",... need to indicate that in the testcase

Copy link
Member Author

Choose a reason for hiding this comment

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

thanks for your guide. I will do it later.

@liggitt
Copy link
Member

liggitt commented Oct 7, 2019

/approve cancel

@k8s-ci-robot k8s-ci-robot removed approved Indicates a PR has been approved by an approver from all required OWNERS files. lgtm "Looks good to me", indicates that a PR is ready to be merged. labels Oct 7, 2019
@carlory
Copy link
Member Author

carlory commented Oct 10, 2019

/hold cancel

@k8s-ci-robot k8s-ci-robot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Oct 10, 2019
@carlory
Copy link
Member Author

carlory commented Oct 10, 2019

/retest

if err == nil {
t.Errorf("%s: expected error making admission request: %v", tt.test, err)
}
return
Copy link
Member

Choose a reason for hiding this comment

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

don't return here, it skips the annotations equality check which is the point of the test

Copy link
Member Author

Choose a reason for hiding this comment

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

fixed

}
return
}
if err != nil {
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
if err != nil {
} else if err != nil {

Copy link
Member Author

Choose a reason for hiding this comment

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

done

@liggitt
Copy link
Member

liggitt commented Oct 10, 2019

/lgtm
/approve

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Oct 10, 2019
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: carlory, liggitt

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

The pull request process is described 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 approved Indicates a PR has been approved by an approver from all required OWNERS files. label Oct 10, 2019
@k8s-ci-robot k8s-ci-robot merged commit 4f1c5b8 into kubernetes:master Oct 10, 2019
ohsewon pushed a commit to ohsewon/kubernetes that referenced this pull request Oct 16, 2019
@carlory carlory deleted the fix-appserver branch April 2, 2020 10:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/api-change Categorizes issue or PR as related to adding, removing, or otherwise changing an API lgtm "Looks good to me", indicates that a PR is ready to be merged. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. priority/important-longterm Important over the long term, but may not be staffed and/or may need multiple releases to complete. release-note-none Denotes a PR that doesn't merit a release note. sig/scheduling Categorizes an issue or PR as relevant to SIG Scheduling. 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.

None yet

6 participants