Skip to content

util.sh: regenerate go.sum to fix incorrect hash values #255

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

Merged
merged 1 commit into from
Apr 26, 2021

Conversation

nikhita
Copy link
Member

@nikhita nikhita commented Apr 26, 2021

gomod-zip copied go's zip creation code but they had diverged.
due to this, gomod-zip created different zip files in the cache
compared to what go mod download would create (fixed in #254)

From Go 1.15.11 and Go 1.16.3, go automatically derives the ziphash
from the zip file in the cache - golang/go#44812.
This meant that go added incorrect hash values to go.sum because these
were derived from the zip files produced by the diverged gomod-zip code.

So remove go.sum here and regenerate again using go mod download and go mod tidy
to include the right hash values.

Note - this line should be removed after one clean publishing-bot run to be able to catch checksum
errors from go mod download in the future.


Fixes broken publishing-bot. We get this error for component-base release-1.21 now:

    	+ GO111MODULE=on
    	+ GOPRIVATE=k8s.io/apimachinery,k8s.io/api,k8s.io/client-go
    	+ GOPROXY=https://proxy.golang.org
    	+ go mod download
    	verifying k8s.io/client-go@v0.0.0-20210329112528-6be0785e0e32: checksum mismatch
    		downloaded: h1:Qu7DBMSFCtY/i0Q5reJbTOgwbPZqOQSdLszDn05zbBA=
    		go.sum:     h1:rypE67YonSf09C58AflueN1+kwxCCxJb+f6hkxjSECI=

    	SECURITY ERROR
    	This download does NOT match an earlier download recorded in go.sum.
    	The bits may have been replaced on the origin server, or an attacker may
    	have intercepted the download attempt.

    	For more information, see 'go help module-auth'.

Note - go mod tidy on the published component-base repo's master also produces a checksum error today.

/hold
/cc @sttts @dims @liggitt

gomod-zip copied go's zip creation code but they had diverged.
due to this, gomod-zip created different zip files in the cache
compared to what go mod download would create.

From Go 1.15.11 and Go 1.16.3, go automatically derives the ziphash
from the zip file in the cache - golang/go#44812.
This meant that go added incorrect hash values to go.sum because these
were derived from the zip files produced by the diverged gomod-zip code.

So remove go.sum here and regenerate again using go mod download and go mod tidy.
@k8s-ci-robot k8s-ci-robot requested review from dims, liggitt and sttts April 26, 2021 09:07
@k8s-ci-robot k8s-ci-robot added do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/S Denotes a PR that changes 10-29 lines, ignoring generated files. approved Indicates a PR has been approved by an approver from all required OWNERS files. labels Apr 26, 2021
@dims
Copy link
Member

dims commented Apr 26, 2021

/approve
/lgtm

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

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: dims, nikhita

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

@palnabarun
Copy link
Member

/lgtm

@nikhita
Copy link
Member Author

nikhita commented Apr 26, 2021

Verified for component-base release-1.21 - a new commit is published which fixes the hash in go.sum - prowtest/component-base@014c101.

Also verified that go mod tidy is green after this new commit is published.

@nikhita
Copy link
Member Author

nikhita commented Apr 26, 2021

/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 Apr 26, 2021
@k8s-ci-robot k8s-ci-robot merged commit dca7859 into kubernetes:master Apr 26, 2021
@nikhita nikhita deleted the go-sum-cleanup branch April 26, 2021 15:55
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. lgtm "Looks good to me", indicates that a PR is ready to be merged. size/S Denotes a PR that changes 10-29 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants