devfile / api

Kube-native API for cloud development workspaces specification
Apache License 2.0
235 stars 58 forks source link

Registry operator fails on unit tests #1519

Closed michael-valdron closed 1 month ago

michael-valdron commented 1 month ago

Which area this feature is related to?

/kind bug

Which area this bug is related to?

/area registry

What versions of software are you using?

Go project

Operating System and version: N/A

Go Pkg Version: 1.19

Bug Summary

Describe the bug:

The unit tests on failing for the registry operator when doing a fresh install of sigs.k8s.io/controller-runtime/tools/setup-envtest for setting up the testing environment. The failures only seem to happen if the latest version installed during fresh installs.

To Reproduce:

  1. Ensure sigs.k8s.io/controller-runtime/tools/setup-envtest is not installed, generally by removing the ignored bin directory from past runs
  2. Run make test

Expected behavior

Running should successfully run all unit test cases for registry operator.

Any logs, error output, screenshots etc? Provide the devfile that sees this bug, if applicable

mkdir -p /home/mvaldron/source/repos/michael-valdron/devfile-registry-operator/bin
test -s /home/mvaldron/source/repos/michael-valdron/devfile-registry-operator/bin/controller-gen && /home/mvaldron/source/repos/michael-valdron/devfile-registry-operator/bin/controller-gen --version | grep -q v0.9.2 || \
GOBIN=/home/mvaldron/source/repos/michael-valdron/devfile-registry-operator/bin GOFLAGS="" go install sigs.k8s.io/controller-tools/cmd/controller-gen@v0.9.2
/home/mvaldron/source/repos/michael-valdron/devfile-registry-operator/bin/controller-gen rbac:roleName=manager-role crd webhook paths="./..." output:crd:artifacts:config=config/crd/bases
/home/mvaldron/source/repos/michael-valdron/devfile-registry-operator/bin/controller-gen object:headerFile="hack/boilerplate.go.txt" paths="./..."
go fmt ./...
go vet ./...
test -s /home/mvaldron/source/repos/michael-valdron/devfile-registry-operator/bin/setup-envtest || GOBIN=/home/mvaldron/source/repos/michael-valdron/devfile-registry-operator/bin GOFLAGS="" go install sigs.k8s.io/controller-runtime/tools/setup-envtest@latest
go: downloading sigs.k8s.io/controller-runtime v0.17.3
go: downloading sigs.k8s.io/controller-runtime/tools/setup-envtest v0.0.0-20240411191551-a7508decdfef
go: sigs.k8s.io/controller-runtime/tools/setup-envtest@latest (in sigs.k8s.io/controller-runtime/tools/setup-envtest@v0.0.0-20240411191551-a7508decdfef): go.mod:3: invalid go version '1.22.0': must match format 1.23
make: *** [Makefile:262: /home/mvaldron/source/repos/michael-valdron/devfile-registry-operator/bin/setup-envtest] Error 1

Additional context

Any workaround?

None at the moment, aside from fix or updating Go version for the module, there is an open issue https://github.com/kubernetes-sigs/controller-runtime/issues/2744 to address this, if it is resolved it might be possible to restore the latest tag.

Suggestion on how to fix the bug

Replace latest with the latest capped version number which is compatible with Go 1.19: Makefile#L262

michael-valdron commented 1 month ago

Related issue: https://github.com/kubernetes-sigs/controller-runtime/issues/2744

michael-valdron commented 1 month ago

Last working revision of setup-envtest is v0.0.0-20240405143037-c25fe2f5ca0f, best to use this one.

michael-valdron commented 1 month ago

Bugfix PR ready for review: https://github.com/devfile/registry-operator/pull/87