-
Notifications
You must be signed in to change notification settings - Fork 6.1k
Switch to go mod #2327
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
Switch to go mod #2327
Conversation
This PR needs a bit more work. First, I'll wait for #2326 to land, as it includes a change whereby code generation performed by Second, I'll need to remove mention of Gopkg.*, ./vendor, and |
#2326 is in. Looking forward to merge this PR as well! |
Spend 4 hours trying to move circle ci and code generation to go modules using your PR 😞. I'm still hoping to get it done. Will send PR to your branch when it is ready. |
Oh wow, thanks. Work is intense right now, but I hope to circle back to this PR soon. |
Shall I close this in favour of #2429 ? I started rebasing this PR this morning and saw that you're quite a bit further along, already. |
I think keep this open. Turns out it pretty hard to move to GO111MODULE and it would be good to keep all the experiments for reference at least. |
@gpaul what's the chances you can sync with master on this and see if it still builds and passes tests? |
Yeah sure, let me try that. It might be a day or two though |
dep ensure -update k8s.io/apimachinary
dep ensure -update k8s.io/api
dep ensure -update k8s.io/kubernetes
dep ensure -update k8s.io/code-generator
dep ensure -update k8s.io/client-go
go mod init github.com/argoproj/argo-cd
go build -v ./...
cb1bf84
to
45d8b33
Compare
I've rebased this branch on |
To fix CI, in |
Codecov Report
@@ Coverage Diff @@
## master #2327 +/- ##
==========================================
- Coverage 38.09% 38.03% -0.06%
==========================================
Files 114 114
Lines 15835 15835
==========================================
- Hits 6032 6023 -9
- Misses 9020 9033 +13
+ Partials 783 779 -4
Continue to review full report at Codecov.
|
…obuf/protoc-gen-gogo
k8s.io/klog v0.3.3 | ||
k8s.io/kube-aggregator v0.0.0-20190711105720-e80910364765 | ||
k8s.io/kube-openapi v0.0.0-20190502190224-411b2483e503 | ||
k8s.io/kubernetes v1.15.0-alpha.0.0.20190914015840-8fca2ec50a61 |
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 saw that 1.15.7 (which is latest for 1.15) now has support for modules, so we can get rid of the pseudo versions
@@ -11,16 +11,16 @@ commands: | |||
git config --global user.name "Your Name" | |||
echo "export PATH=/home/circleci/.go_workspace/src/github.com/argoproj/argo-cd/hack:\$PATH" | tee -a $BASH_ENV | |||
echo "export GIT_ASKPASS=git-ask-pass.sh" | tee -a $BASH_ENV | |||
dep_ensure: | |||
mod_vendor: |
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 am not sure it is a good idea to use mod vendor in ci, it makes it different than the actual release. And it is ignored unless we pass it in go build
and go test
with -mod=vendor
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.
Personally I prefer checking in ./vendor to my repos, but the status quo in argo-cd is to download dependencies in CI (it used to use dep ensure
, so I switched to using go mod -vendor
.)
However, IIRC this doesn't quite work, as mod vendor doesn't download the entire dependency, only the transitively depended upon go code in the dependencies. This means that *.proto files, for example, aren't included in the download.
This means go mod -vendor
and dep ensure
behave differently. The vend
tool (https://github.com/nomad-software/vend) should be able to help.
This might help: golang/go#26366 (comment) |
@gpaul I managed to move argo-rollouts to go modules in argoproj/argo-rollouts#331 so I was thinking to give argo-cd a try also. |
Please do! Shall I go ahead and close this PR? |
I have submitted a working migration in #3639 :) |
Cool! Closing. |
This PR switches argo-cd from using
dep
to usinggo modules
.The following steps were performed, with each step forming a separate commit containing a description and the CLI command that was executed. These steps were performed using go1.13.
Steps:
dep
to bring k8s.io dependencies up to date with their existing release branches.1.1 Update k8s.io/apimachinery to HEAD of the
release-1.14
branch.1.2 Update k8s.io/api to HEAD of the
release-1.14
branch.1.3 Update k8s.io/kubernetes to HEAD of the
release-1.14
branch.1.4 Update k8s.io/client-go to HEAD of the
release-11.0
branch.dep
togo mod
usinggo mod init github.com/argoproj/argo-cd
go.lock
file by runninggo build ./...