kubevirt: make builder-build failed with go: command not found

What happened: When I try to bump golang version refer to this doc: https://github.com/kubevirt/kubevirt/blob/main/docs/update-go-version.md I change GIMME_GO_VERSION in hack/builder/Dockerfile and exec make builder-build. It return

=> ERROR [ 8/17] RUN set -x &&     mkdir -p /go &&     source /etc/profile.d/gimme.sh &&     go install -v golang.org/x/tools/cmd/goimports@d5fe738 &&     go install -v mvdan.cc/sh/v3/cmd/shfmt@v3.1.  0.4s
------
 > [ 8/17] RUN set -x &&     mkdir -p /go &&     source /etc/profile.d/gimme.sh &&     go install -v golang.org/x/tools/cmd/goimports@d5fe738 &&     go install -v mvdan.cc/sh/v3/cmd/shfmt@v3.1.1 &&     go install -v k8s.io/code-generator/cmd/deepcopy-gen@v0.20.2 &&     go install -v k8s.io/code-generator/cmd/defaulter-gen@v0.20.2  &&     go install -v k8s.io/kube-openapi/cmd/openapi-gen@30be4d1 &&     go install -v github.com/golang/protobuf/protoc-gen-go@1643683 &&     go install -v k8s.io/code-generator/cmd/client-gen@v0.20.2 &&     go install -v github.com/securego/gosec/v2/cmd/gosec@0ce48a5 &&     go install -v sigs.k8s.io/controller-tools/cmd/controller-gen@v0.4.0 &&     go clean -cache -modcache:
#0 0.312 + mkdir -p /go
#0 0.315 + source /etc/profile.d/gimme.sh
#0 0.315 + go install -v golang.org/x/tools/cmd/goimports@d5fe738
#0 0.316 /bin/sh: line 1: go: command not found

What you expected to happen: make builder-build run without err

How to reproduce it (as minimally and precisely as possible): Steps to reproduce the behavior.

Additional context: Add any other context about the problem here. image

Environment:

  • KubeVirt version (use virtctl version): 0.59
  • Kubernetes version (use kubectl version): N/A
  • VM or VMI specifications: N/A
  • Cloud provider or hardware configuration: N/A
  • OS (e.g. from /etc/os-release): N/A
  • Kernel (e.g. uname -a): N/A
  • Install tools: N/A
  • Others: N/A

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 18 (10 by maintainers)

Most upvoted comments

@brianmcarey Hi, what should I do when I generate the builder image? I follow the https://github.com/kubevirt/kubevirt/blob/main/docs/update-go-version.md. I use go rules for bazel in #8622

http_archive(
   name = "io_bazel_rules_go",
    sha256 = "099a9fb96a376ccbbb7d291ed4ecbdfd42f6bc822ab77ae6f1b5cb9e914e94fa",
    urls = [
        "https://mirror.bazel.build/github.com/bazelbuild/rules_go/releases/download/v0.35.0/rules_go-v0.35.0.zip",
        "https://github.com/bazelbuild/rules_go/releases/download/v0.35.0/rules_go-v0.35.0.zip",
        "https://storage.googleapis.com/builddeps/099a9fb96a376ccbbb7d291ed4ecbdfd42f6bc822ab77ae6f1b5cb9e914e94fa",
    ],
)

After above, I try to make deps-update but get err.

You will probably need to backport changes from the following PRs to get this working: https://github.com/kubevirt/kubevirt/pull/10879 https://github.com/kubevirt/kubevirt/pull/10914