grafeas / kritis

Deploy-time Policy Enforcer for Kubernetes applications
https://github.com/grafeas/kritis/blob/master/docs/binary-authorization.md
Apache License 2.0
699 stars 135 forks source link

Add go mod vendor in test.sh to fix module version mismatch #600

Closed ooq closed 3 years ago

ooq commented 3 years ago

Our travis test fails because of go.mod and vendor/modules.txt mismatch. The mismatch is introduced by go get -u gotest.tools/gotestsum during the testing setup. This command updates go.mod but not vendor/modules.txt.

Fix is to add go mod vendor after downloading gotestsum.

Alternative considered: configure go get to not update go.mod, but looks it's not possible (#27643).

ghost commented 3 years ago

@ooq I think this is because of the change to the hack/dependencies.sh script, the Kubernetes one does a lot more slicing and dicing of go.mod so that PRs don't get blocked like this. Might I suggest we remove go mod tidy?

ooq commented 3 years ago

@cjones-shopify Do you mean to remove it from hack/dependencies.sh? Yesterday I looked, it seemed to be caused by go get -u gotest.tools/gotestsum in ./hack/test.sh updating go.mod for gotestsum's dependencies. Maybe do another go mod vendor after installing gotestsum would fix this?

ooq commented 3 years ago

@cjones-shopify looks like go mod vendor does make it happy. Would there be concerns with this approach?

One issue I do see is it might mess up my local vendor/modules.txt which I have to manually stash.

ooq commented 3 years ago

Merging now to unblock PRs needing this test to pass. If there is a better fix, let's do so in a follow-up.