#!/usr/bin/env sh

set -ex
export "CGO_ENABLED"="1"
export "COMMIT"="ad7c7374b74c04d07ea041d367ecb1a526bdf758"
export "FORCE_HOST_GO"="true"
export "GOPROXY"="direct"
export "KUBE_GIT_TREE_STATE"="clean"
export "TARGET_ARCH"="amd64"
export "TARGET_OS"="linux"
export "VERSION"="v1.34.9"

(
export GOMODCACHE="$(pwd)/gomods"
cd kubernetes
SANITIZED_VERSION=$(printf '%s' "$VERSION" | sed 's/~/-/g')
git tag "${SANITIZED_VERSION}"
KUBE_BUILD_PLATFORMS=${TARGET_OS}/${TARGET_ARCH} KUBE_VERBOSE=3 WHAT=cmd/kubeadm KUBE_CGO_OVERRIDES=kubeadm DBG=1 make
if [ "$TARGET_OS" = "windows" ]; then
  mkdir -p _output/bin/
  cp -f _output/local/bin/${TARGET_OS}/${TARGET_ARCH}/kubeadm* _output/bin/
fi

)
