Skip to content

Commit

Permalink
Merge pull request kubernetes#1906 from tosi3k/golang-new-release
Browse files Browse the repository at this point in the history
Adjust Golang scripts to the new k8s.io/release commit
  • Loading branch information
k8s-ci-robot authored Oct 18, 2021
2 parents e1d5f0e + c68198d commit 6f93c89
Showing 1 changed file with 12 additions and 11 deletions.
23 changes: 12 additions & 11 deletions golang/build-kubernetes.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,6 @@ set -euxo pipefail
# Initialize necessary environment variables and git identity.
function init {
export GOROOT=$ROOT_DIR/golang
cd $GOROOT
export TAG=$(date +v%Y%m%d)-$(git rev-parse --short HEAD)
cd ..
git config --global user.email "[email protected]"
git config --global user.name "k8s scalability"
}
Expand All @@ -35,9 +32,9 @@ function build_kube_cross {

cd $ROOT_DIR/k8s.io/release/images/build/cross

# Modify Dockerfile to use previously built custom version.
# Modify Dockerfile to use previously built custom version of Go.
# The following assumes that $GOROOT was moved to Dockerfile directory.
sed -i 's#FROM golang.*$#FROM buildpack-deps:stretch-scm\
sed -i 's#FROM .*$#FROM buildpack-deps:stretch-scm\
\
COPY golang /usr/local/go\
RUN chmod -R a+rx /usr/local/go\
Expand All @@ -48,25 +45,29 @@ ENV GOPATH /go\
ENV PATH $GOPATH\/bin:/usr/local/go/bin:$PATH\
\
RUN mkdir -p "$GOPATH/src" "$GOPATH/bin" \&\& chmod -R 777 "$GOPATH"\
WORKDIR $GOPATH#' Dockerfile
WORKDIR $GOPATH#' default/Dockerfile

# Set VERSION contents to the tag of kube-cross Docker image.
sed -i 's#.*#'"$TAG"'#' VERSION
make container REGISTRY=gcr.io/k8s-testimages PLATFORMS=linux/amd64 GO_MAJOR_VERSION=-master OS_CODENAME=debian

REGISTRY=gcr.io/k8s-testimages
STAGING_REGISTRY=$REGISTRY PROD_REGISTRY=$REGISTRY TAG=$TAG make build
# The make command above changes the docker buildx builder from default
# to a custom one that uses "docker-container" driver (instead of "docker").
# This driver forces pulling images instead of looking for them in the
# local cache as a primary attempt. As we do not want to use any additional
# container registry, we set the builder back to default.
docker buildx use default
}

function build_kubernetes {
cd $ROOT_DIR/k8s.io/kubernetes/build/build-image

# Change the base image of kube-build to our own kube-cross image.
sed -i 's#FROM .*#FROM gcr.io/k8s-testimages/kube-cross-amd64:'"$TAG"'#' Dockerfile
sed -i 's#FROM .*#FROM gcr.io/k8s-testimages/kube-cross-amd64:latest-go-master-debian-default#' Dockerfile

cd $ROOT_DIR/k8s.io/kubernetes
# Commit changes - needed to not create a "dirty" build, so we can push the
# build to <bucket>/ci directory and update latest.txt file.
git commit -am "Upgrade cross Dockerfile to use kube-cross with newest golang"

# Build Kubernetes using our kube-cross image.
make quick-release
}
Expand Down

0 comments on commit 6f93c89

Please sign in to comment.