kubernetes-sigs / kind

Kubernetes IN Docker - local clusters for testing Kubernetes
https://kind.sigs.k8s.io/
Apache License 2.0
13.01k stars 1.51k forks source link

error obtaining VCS status: exit status 128 #3623

Closed 0xMALVEE closed 1 month ago

0xMALVEE commented 1 month ago

What happened:

root@DESKTOP-E1SNL1U:/home/alvee/go/src/k8s.io/kubernetes# kind build node-image
Starting to build Kubernetes
+++ [0521 14:41:03] Verifying Prerequisites....
+++ [0521 14:41:04] Building Docker image kube-build:build-9d1f0b1f1d-5-v1.31.0-go1.22.3-bullseye.0
+++ [0521 14:41:06] Syncing sources to container
+++ [0521 14:41:08] Running build command...
+++ [0521 14:41:11] Building go targets for linux/amd64
    k8s.io/kubernetes/cmd/kube-apiserver (static)
    k8s.io/kubernetes/cmd/kube-controller-manager (static)
    k8s.io/kubernetes/cmd/kube-proxy (static)
    k8s.io/kubernetes/cmd/kube-scheduler (static)
    k8s.io/kubernetes/cmd/kubeadm (static)
    k8s.io/kubernetes/cmd/kubectl (static)
    k8s.io/kubernetes/cmd/kubelet (non-static)
error obtaining VCS status: exit status 128
        Use -buildvcs=false to disable VCS stamping.
error obtaining VCS status: exit status 128
        Use -buildvcs=false to disable VCS stamping.
error obtaining VCS status: exit status 128
        Use -buildvcs=false to disable VCS stamping.
error obtaining VCS status: exit status 128
        Use -buildvcs=false to disable VCS stamping.
error obtaining VCS status: exit status 128
        Use -buildvcs=false to disable VCS stamping.
error obtaining VCS status: exit status 128
        Use -buildvcs=false to disable VCS stamping.
!!! [0521 14:41:12] Call tree:
!!! [0521 14:41:12]  1: /go/src/k8s.io/kubernetes/hack/lib/golang.sh:811 kube::golang::build_some_binaries(...)
!!! [0521 14:41:12]  2: /go/src/k8s.io/kubernetes/hack/lib/golang.sh:970 kube::golang::build_binaries_for_platform(...)
!!! [0521 14:41:12]  3: hack/make-rules/build.sh:28 kube::golang::build_binaries(...)
!!! [0521 14:41:12] Call tree:
!!! [0521 14:41:12]  1: hack/make-rules/build.sh:28 kube::golang::build_binaries(...)
make: *** [Makefile:95: all] Error 1
!!! [0521 14:41:12] Call tree:
!!! [0521 14:41:12]  1: build/../build/common.sh:490 kube::build::run_build_command_ex(...)
!!! [0521 14:41:12]  2: build/release-images.sh:40 kube::build::run_build_command(...)
make: *** [Makefile:454: quick-release-images] Error 1
Failed to build Kubernetes: failed to build images: command "make quick-release-images 'KUBE_EXTRA_WHAT=cmd/kubeadm cmd/kubectl cmd/kubelet' KUBE_VERBOSE=0 KUBE_BUILD_HYPERKUBE=n KUBE_BUILD_CONFORMANCE=n KUBE_BUILD_PLATFORMS=linux/amd64" failed with error: exit status 2
ERROR: error building node image: failed to build kubernetes: failed to build images: command "make quick-release-images 'KUBE_EXTRA_WHAT=cmd/kubeadm cmd/kubectl cmd/kubelet' KUBE_VERBOSE=0 KUBE_BUILD_HYPERKUBE=n KUBE_BUILD_CONFORMANCE=n KUBE_BUILD_PLATFORMS=linux/amd64" failed with error: exit status 2
Command Output: +++ [0521 14:41:03] Verifying Prerequisites....
+++ [0521 14:41:04] Building Docker image kube-build:build-9d1f0b1f1d-5-v1.31.0-go1.22.3-bullseye.0
+++ [0521 14:41:06] Syncing sources to container
+++ [0521 14:41:08] Running build command...
+++ [0521 14:41:11] Building go targets for linux/amd64
    k8s.io/kubernetes/cmd/kube-apiserver (static)
    k8s.io/kubernetes/cmd/kube-controller-manager (static)
    k8s.io/kubernetes/cmd/kube-proxy (static)
    k8s.io/kubernetes/cmd/kube-scheduler (static)
    k8s.io/kubernetes/cmd/kubeadm (static)
    k8s.io/kubernetes/cmd/kubectl (static)
    k8s.io/kubernetes/cmd/kubelet (non-static)
error obtaining VCS status: exit status 128
        Use -buildvcs=false to disable VCS stamping.
error obtaining VCS status: exit status 128
        Use -buildvcs=false to disable VCS stamping.
error obtaining VCS status: exit status 128
        Use -buildvcs=false to disable VCS stamping.
error obtaining VCS status: exit status 128
        Use -buildvcs=false to disable VCS stamping.
error obtaining VCS status: exit status 128
        Use -buildvcs=false to disable VCS stamping.
error obtaining VCS status: exit status 128
        Use -buildvcs=false to disable VCS stamping.
!!! [0521 14:41:12] Call tree:
!!! [0521 14:41:12]  1: /go/src/k8s.io/kubernetes/hack/lib/golang.sh:811 kube::golang::build_some_binaries(...)
!!! [0521 14:41:12]  2: /go/src/k8s.io/kubernetes/hack/lib/golang.sh:970 kube::golang::build_binaries_for_platform(...)
!!! [0521 14:41:12]  3: hack/make-rules/build.sh:28 kube::golang::build_binaries(...)
!!! [0521 14:41:12] Call tree:
!!! [0521 14:41:12]  1: hack/make-rules/build.sh:28 kube::golang::build_binaries(...)
make: *** [Makefile:95: all] Error 1
!!! [0521 14:41:12] Call tree:
!!! [0521 14:41:12]  1: build/../build/common.sh:490 kube::build::run_build_command_ex(...)
!!! [0521 14:41:12]  2: build/release-images.sh:40 kube::build::run_build_command(...)
make: *** [Makefile:454: quick-release-images] Error 1

What you expected to happen:

Should build successfully

How to reproduce it (as minimally and precisely as possible):

kind build node-image

Anything else we need to know?:

Environment:

Server: Containers: 2 Running: 1 Paused: 0 Stopped: 1 Images: 4 Server Version: 26.1.3 Storage Driver: overlay2 Backing Filesystem: extfs Supports d_type: true Using metacopy: false Native Overlay Diff: true userxattr: false Logging Driver: json-file Cgroup Driver: cgroupfs Cgroup Version: 1 Plugins: Volume: local Network: bridge host ipvlan macvlan null overlay Log: awslogs fluentd gcplogs gelf journald json-file local splunk syslog Swarm: inactive Runtimes: io.containerd.runc.v2 runc Default Runtime: runc Init Binary: docker-init containerd version: e377cd56a71523140ca6ae87e30244719194a521 runc version: v1.1.12-0-g51d5e94 init version: de40ad0 Security Options: seccomp Profile: builtin Kernel Version: 5.15.146.1-microsoft-standard-WSL2 Operating System: Ubuntu 22.04.3 LTS OSType: linux Architecture: x86_64 CPUs: 16 Total Memory: 15.5GiB Name: DESKTOP-E1SNL1U ID: c4864fcc-0f2d-4be6-b62d-ebea9d3c6f08 Docker Root Dir: /var/lib/docker Debug Mode: false Experimental: false Insecure Registries: 127.0.0.0/8 Live Restore Enabled: false

WARNING: No blkio throttle.read_bps_device support WARNING: No blkio throttle.write_bps_device support WARNING: No blkio throttle.read_iops_device support WARNING: No blkio throttle.write_iops_device support

- OS (e.g. from `/etc/os-release`):
```sh
PRETTY_NAME="Ubuntu 22.04.3 LTS"
NAME="Ubuntu"
VERSION_ID="22.04"
VERSION="22.04.3 LTS (Jammy Jellyfish)"
VERSION_CODENAME=jammy
ID=ubuntu
ID_LIKE=debian
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
UBUNTU_CODENAME=jammy
roman-kiselenko commented 1 month ago

That looks like a problem with the git configuration. Are your github SSH keys configured properly? Is there some additional configuration tweaks your ~/.gitconfig contains?

0xMALVEE commented 1 month ago

That looks like a problem with the git configuration. Are your github SSH keys configured properly? Is there some additional configuration tweaks your ~/.gitconfig contains?

hey @roman-kiselenko , thanks for looking into it. Yes my github ssh keys are ok nothing additionally tweeks. Maybe it has something to do with golang?

0xMALVEE commented 1 month ago

my ~/.gitconfig

[user]
        name = 0xMALVEE
        email = m.alvee8141@gmail.com
roman-kiselenko commented 1 month ago

@0xMALVEE could you post go env output?

0xMALVEE commented 1 month ago

@0xMALVEE could you post go env output?

GO111MODULE=''
GOARCH='amd64'
GOBIN=''
GOCACHE='/root/.cache/go-build'
GOENV='/root/.config/go/env'
GOEXE=''
GOEXPERIMENT=''
GOFLAGS=''
GOHOSTARCH='amd64'
GOHOSTOS='linux'
GOINSECURE=''
GOMODCACHE='/home/alvee/go/pkg/mod'
GONOPROXY=''
GONOSUMDB=''
GOOS='linux'
GOPATH='/home/alvee/go'
GOPRIVATE=''
GOPROXY='https://proxy.golang.org,direct'
GOROOT='/usr/local/go'
GOSUMDB='sum.golang.org'
GOTMPDIR=''
GOTOOLCHAIN='auto'
GOTOOLDIR='/usr/local/go/pkg/tool/linux_amd64'
GOVCS=''
GOVERSION='go1.22.3'
GCCGO='gccgo'
GOAMD64='v1'
AR='ar'
CC='gcc'
CXX='g++'
CGO_ENABLED='1'
GOMOD='/dev/null'
GOWORK=''
CGO_CFLAGS='-O2 -g'
CGO_CPPFLAGS=''
CGO_CXXFLAGS='-O2 -g'
CGO_FFLAGS='-O2 -g'
CGO_LDFLAGS='-O2 -g'
PKG_CONFIG='pkg-config'
GOGCCFLAGS='-fPIC -m64 -pthread -Wl,--no-gc-sections -fmessage-length=0 -ffile-prefix-map=/tmp/go-build3685774116=/tmp/go-build -gno-record-gcc-switches'
roman-kiselenko commented 1 month ago

Could you check what

cat .git/config

returns in $GOPATH/src/k8s.io/kubernetes?

0xMALVEE commented 1 month ago

Could you check what

cat .git/config

returns in $GOPATH/src/k8s.io/kubernetes?

[core]
        repositoryformatversion = 0
        filemode = true
        bare = false
        logallrefupdates = true
[remote "origin"]
        url = https://github.com/0xMALVEE/kubernetes.git
        fetch = +refs/heads/*:refs/remotes/origin/*
[branch "master"]
        remote = origin
        merge = refs/heads/master
[remote "upstream"]
        url = https://github.com/kubernetes/kubernetes.git
        fetch = +refs/heads/*:refs/remotes/upstream/*
        pushurl = no_push
roman-kiselenko commented 1 month ago

I think you need to add this:

[url "ssh://git@github.com/"]
    insteadOf = https://github.com/

To your ~/.gitconfig

Or change it in the repository with git remote set-url origin git@github.com:OWNER/REPOSITORY.git.

So it looks like url = git@github.com:0xMALVEE/kubernetes.git.

I bet go is confused with the https part in the repo URL.

stmcginnis commented 1 month ago

I'm not sure SSH vs HTTPS makes a difference here, but worth a shot.

It seems more like it is not able to get git information. It could be a shallow clone that is missing some detail. You could try git fetch upstream from within the $GOPATH/src/k8s.io/kubernetes directory to make sure it has all the information.

0xMALVEE commented 1 month ago

I think you need to add this:

[url "ssh://git@github.com/"]
    insteadOf = https://github.com/

To your ~/.gitconfig

Or change it in the repository with git remote set-url origin git@github.com:OWNER/REPOSITORY.git.

So it looks like url = git@github.com:0xMALVEE/kubernetes.git.

I bet go is confused with the https part in the repo URL.

tried didn't work same issue after changes following.

root@DESKTOP-E1SNL1U:/home/alvee/go/src/k8s.io/kubernetes# cat ~/.gitconfig
[user]
        name = 0xMALVEE
        email = m.alvee8141@gmail.com

[url "ssh://git@github.com/"]
    insteadOf = https://github.com/

also tried git remote set-url origin git@github.com:0xMALVEE/kubernetes.git

0xMALVEE commented 1 month ago

I'm not sure SSH vs HTTPS makes a difference here, but worth a shot.

It seems more like it is not able to get git information. It could be a shallow clone that is missing some detail. You could try git fetch upstream from within the $GOPATH/src/k8s.io/kubernetes directory to make sure it has all the information.

git fetch upstream no luck. still same

stmcginnis commented 1 month ago

Hmm, what do you get if you run:

git rev-parse --short HEAD
git describe --tags --abbrev=0

inside that directory?

0xMALVEE commented 1 month ago
git describe --tags --abbrev=0
root@DESKTOP-E1SNL1U:/home/alvee/go/src/k8s.io/kubernetes# git rev-parse --short HEAD
8c1983ffc0b
root@DESKTOP-E1SNL1U:/home/alvee/go/src/k8s.io/kubernetes# git describe --tags --abbrev=0
v1.31.0-alpha.0
root@DESKTOP-E1SNL1U:/home/alvee/go/src/k8s.io/kubernetes# 
roman-kiselenko commented 1 month ago

BTW, it's not a bug in kind; it's something with your machine, and I guess it's something with git+ssh+go, but I'm unsure what 🤔

Could you try to remove the Kubernetes source and clone it again?

$ rm -rf "$GOPATH"/src/k8s.io/kubernetes
$ mkdir -p "$GOPATH"/src/k8s.io/kubernetes
$ K8S_VERSION=v1.30.0
$ git clone --depth 1 --branch ${K8S_VERSION} https://github.com/kubernetes/kubernetes.git "$GOPATH"/src/k8s.io/kubernetes
0xMALVEE commented 1 month ago

BTW, it's not a bug in kind; it's something with your machine, and I guess it's something with git+ssh+go, but I'm unsure what 🤔

Could you try to remove the Kubernetes source and clone it again?

$ rm -rf "$GOPATH"/src/k8s.io/kubernetes
$ mkdir -p "$GOPATH"/src/k8s.io/kubernetes
$ K8S_VERSION=v1.30.0
$ git clone --depth 1 --branch ${K8S_VERSION} https://github.com/kubernetes/kubernetes.git "$GOPATH"/src/k8s.io/kubernetes

now it's stuck at this point. image

BenTheElder commented 1 month ago

Note: hack/make-rules/build.sh is from github.com/kubernetes/kubernetes, we're just invoking the Kubernetes build system twice:

1) ask it about the repo state to grab which version it will tag the build 2) build binaries

When Kubernetes is done building then we package it up into a kind node image.

The first failures were due to missing git clone data. The step here https://github.com/kubernetes-sigs/kind/issues/3623#issuecomment-2123006124, is Kubernetes preparing its build environment. It should be building a docker image.

It's possible something doesn't work right upstream in WSL.

0xMALVEE commented 1 month ago

I removed the folder again and cloned the master branch only this time and got this bellow saying version can't parse.

root@DESKTOP-E1SNL1U:/home/alvee/go/src/k8s.io/kubernetes# kind build node-image
Starting to build Kubernetes
Failed to build Kubernetes: failed to parse source version: could not parse "" as version
ERROR: error building node image: failed to build kubernetes: failed to parse source version: could not parse "" as version

Let me try to clone the entire k8s again and see if any changes.

0xMALVEE commented 1 month ago

I cloned the entire 1GB k8s again and set up upstream branches and stuff. Now it's going up to this point bellow and stuck in there.

root@DESKTOP-E1SNL1U:/home/alvee/go/src/k8s.io/kubernetes# kind build node-image
Starting to build Kubernetes
+++ [0521 23:06:21] Verifying Prerequisites....
+++ [0521 23:06:21] Building Docker image kube-build:build-3e87291206-5-v1.31.0-go1.22.3-bullseye.0
+++ [0521 23:06:23] Syncing sources to container
+++ [0521 23:06:25] Running build command...
+++ [0521 23:06:29] Building go targets for linux/amd64
    k8s.io/kubernetes/cmd/kube-apiserver (static)
    k8s.io/kubernetes/cmd/kube-controller-manager (static)
    k8s.io/kubernetes/cmd/kube-proxy (static)
    k8s.io/kubernetes/cmd/kube-scheduler (static)
    k8s.io/kubernetes/cmd/kubeadm (static)
    k8s.io/kubernetes/cmd/kubectl (static)
    k8s.io/kubernetes/cmd/kubelet (non-static)
+++ [0521 23:06:36] Syncing out of container
+++ [0521 23:06:37] Building images: linux-amd64
+++ [0521 23:06:38] Starting docker build for image: kube-apiserver-amd64
+++ [0521 23:06:38] Starting docker build for image: kube-controller-manager-amd64
+++ [0521 23:06:38] Starting docker build for image: kube-scheduler-amd64
+++ [0521 23:06:38] Starting docker build for image: kube-proxy-amd64
+++ [0521 23:06:38] Starting docker build for image: kubectl-amd64
+++ [0521 23:06:41] Deleting docker image registry.k8s.io/kube-scheduler-amd64:v1.31.0-alpha.0.843_c0f4879164f3d5
+++ [0521 23:06:42] Deleting docker image registry.k8s.io/kubectl-amd64:v1.31.0-alpha.0.843_c0f4879164f3d5
+++ [0521 23:06:42] Deleting docker image registry.k8s.io/kube-controller-manager-amd64:v1.31.0-alpha.0.843_c0f4879164f3d5
+++ [0521 23:06:42] Deleting docker image registry.k8s.io/kube-proxy-amd64:v1.31.0-alpha.0.843_c0f4879164f3d5
+++ [0521 23:06:42] Deleting docker image registry.k8s.io/kube-apiserver-amd64:v1.31.0-alpha.0.843_c0f4879164f3d5
+++ [0521 23:06:42] Docker builds done
Finished building Kubernetes
Building node image ...
Building in container: kind-build-1716311205-1112095812

docker info of container and images. image

0xMALVEE commented 1 month ago

hey everyone, it took an entire 22 minutes to build I guess it takes a longer time and I thought it was stuck. it's working now thank you guys for the support. It's working after I re-cloned k8s again. 🤣

image