-
Notifications
You must be signed in to change notification settings - Fork 180
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
catch go mod download overwriting changes to vendor #3008
base: main
Are you sure you want to change the base?
Conversation
3a8de5d
to
a6a15bc
Compare
harbor vendors its go mods and there used to be a patch that changed files in the vendor directory. setting this flag was necessary to avoid losing the change since go mod download happened after patching. see aws/eks-distro#3008 for more info. I will send another PR adding a similar check to this repo to catch this kind of in the future automatically.
* harbor no longer needs to skip go mod download harbor vendors its go mods and there used to be a patch that changed files in the vendor directory. setting this flag was necessary to avoid losing the change since go mod download happened after patching. see aws/eks-distro#3008 for more info. I will send another PR adding a similar check to this repo to catch this kind of in the future automatically. * Update CHECKSUMS
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: 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 |
0e277c4
to
a11dc8c
Compare
/retest |
/retest aws-cloud-controller-manager-1-26-presubmit |
@rcrozean: The
Use
In response to this:
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. |
/test aws-cloud-controller-manager-1-26-presubmit |
a11dc8c
to
2bbebd2
Compare
Issue #, if available:
Description of changes:
From pretty much the beginning of eks-d and then eks-a after it, we have run
go mod download
before building. Some upstream projects, such as k/k, actually check in their vendor folder so in those cases we do not technically need to rungo mod vendor
(and in the case of k/k we actually do not, never have) but we do anyway to be consistent and avoid having to have made a case by case decision. This was also important for reproducible builds, there is some oddities with go dependencies that have been download vs checked in and pulled. I have previous PRs which talk about this. Always runninggo mod vendor
ensured all projects would build regardless of if the vendor dir was checked in or not.About a year ago, the
harbor
build in eks-a was updated with a patch that actually did patch something in the vendor directory. At that time we addedGO_MODS_VENDORED
in aws/eks-anywhere-build-tooling#2078 to allow projects to skip runninggo mod vendor
.Recently a patch was added to CCM for versions 1.28+ which 1) adds the vendor directory and 2) patches something in that directory. As is, this patch is not actually taking affect because it gets overwritten when the
go mod vendor
call is ran. The fix, which @markapruett is taking, is to port over the skipping mechanism from eks-a to eks-d and setting GO_MODS_VENDORED to true for the ccm build.While discussing with Mark this nuance, I was thinking of ways we could catch this and avoid the silent "failure". This is my attempt, if the vendor dir exists before running
go mod vendor
then use git to determine if anything changed in that folder due togo mod vendor
, if so, then error.With this change it will require that any time we patch a go.mod/sum file for a project with vendored deps, we need to make sure the patch includes the vendor folder updates, otherwise git will see a difference and trigger this error. The fix should be pretty easy/obvious in this case.
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.