argo-rollouts icon indicating copy to clipboard operation
argo-rollouts copied to clipboard

Import `github.com/argoproj/argo-rollouts/pkg/kubectl-argo-rollouts/cmd/promote` fails

Open jbouchery opened this issue 2 years ago • 1 comments

Hi !

I'm actually trying to use argo rollouts blue-green and everything works perfectly :1st_place_medal:

In our use case, we actually have a little customized Go CLI et i would love to use the function PromoteRollout in pkg/kubectl-argo-rollouts/cmd/promote/promote.go

As i try to import the github.com/argoproj/argo-rollouts/pkg/kubectl-argo-rollouts/cmd/promote package, i get errors like :

error while importing github.com/argoproj/argo-rollouts/pkg/kubectl-argo-rollouts/cmd/promote: missing go.sum entry for module providing package k8s.io/kubernetes/pkg/apis/core/v1 (imported by github.com/argoproj/argo-rollouts/utils/replicaset); to add:
	go get github.com/argoproj/argo-rollouts/utils/[email protected]

When i try to use the go mod tidy command i get :

go: github.com/argoproj/[email protected] requires
        k8s.io/[email protected]: reading k8s.io/cluster-bootstrap/go.mod at revision v0.0.0: unknown revision v0.0.0

I found some workarounds but i dont know if it's right to use this (even if it seems to work) : https://lifesaver.codes/answer/unknown-revision-v0-0-0-errors-seemingly-due-to-require-k8s-io-foo-v0-0-0-79384

It would be awesome if someone could validate the above solution or point me to anoter one.

Regards

jbouchery avatar May 18 '22 09:05 jbouchery

I will take a look at how to improve this.

zachaller avatar May 23 '22 18:05 zachaller

Hi @zachaller

Any update on this issue?

Regards

jbouchery avatar Aug 04 '22 13:08 jbouchery

So this is actually do to how k8s manages their deps. Using the replace directive to replace all k8s deps with a version of k8s dependencies you want to use is correct.

An example: https://github.com/argoproj/argo-schema-generator/blob/main/go.mod#L139-L166

zachaller avatar Aug 15 '22 13:08 zachaller