Skip to content

Commit 6ab9fa1

Browse files
authored
Merge pull request #3387 from dims/avoid-building-kube-cross
Avoid building kube-cross (inject `.go-version` instead)
2 parents 5fd6571 + 01929f6 commit 6ab9fa1

File tree

1 file changed

+4
-39
lines changed

1 file changed

+4
-39
lines changed

golang/build-kubernetes.sh

Lines changed: 4 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -21,52 +21,17 @@ function init {
2121
export GOROOT=$ROOT_DIR/golang
2222
}
2323

24-
function build_kube_cross {
25-
cd $ROOT_DIR/k8s.io/release
26-
# Note that you can't really move the tool itself around since it has
27-
# references to binaries that live relative to its GOROOT.
28-
# This is solved by copying the whole GOROOT directory below.
29-
cp -r $GOROOT $ROOT_DIR/k8s.io/release/images/build/cross
30-
31-
cd $ROOT_DIR/k8s.io/release/images/build/cross
32-
33-
# Modify Dockerfile to use previously built custom version of Go.
34-
# The following assumes that $GOROOT was moved to Dockerfile directory.
35-
sed -i 's#FROM .*$#FROM buildpack-deps:bullseye-scm\
36-
\
37-
COPY golang /usr/local/go\
38-
RUN chmod -R a+rx /usr/local/go\
39-
\
40-
RUN export PATH="/usr/local/go/bin:$PATH"; go version\
41-
\
42-
ENV GOPATH /go\
43-
ENV PATH $GOPATH\/bin:/usr/local/go/bin:$PATH\
44-
\
45-
RUN mkdir -p "$GOPATH/src" "$GOPATH/bin" \&\& chmod -R 777 "$GOPATH"\
46-
WORKDIR $GOPATH#' default/Dockerfile
47-
48-
make container REGISTRY=gcr.io/k8s-testimages PLATFORMS=linux/amd64 GO_MAJOR_VERSION=-master OS_CODENAME=debian
49-
50-
# The make command above changes the docker buildx builder from default
51-
# to a custom one that uses "docker-container" driver (instead of "docker").
52-
# This driver forces pulling images instead of looking for them in the
53-
# local cache as a primary attempt. As we do not want to use any additional
54-
# container registry, we set the builder back to default.
55-
docker buildx use default
56-
}
57-
5824
function build_kubernetes {
5925
cd $ROOT_DIR/k8s.io/kubernetes
6026

27+
# Ensure we build against latest golang version.
28+
echo -n "devel" > .go-version
29+
6130
# Build Kubernetes using our kube-cross image.
6231
# Also pass GOTOOLCHAIN=local to make sure kube-build
6332
# uses the golang version built locally in build-go.sh.
64-
make quick-release \
65-
GOTOOLCHAIN=local \
66-
KUBE_CROSS_IMAGE=gcr.io/k8s-testimages/kube-cross-amd64 \
67-
KUBE_CROSS_VERSION=latest-go-master-debian-default
33+
make quick-release
6834
}
6935

7036
init
71-
build_kube_cross
7237
build_kubernetes

0 commit comments

Comments
 (0)