Skip to content

Commit 975fd9f

Browse files
authored
Merge pull request #2224 from justaugustus/ci-builder-no-bazel
k8s-ci-builder: Sync with cleanups in krte
2 parents b7ff3c5 + 0714f83 commit 975fd9f

File tree

8 files changed

+15
-225
lines changed

8 files changed

+15
-225
lines changed

images/releng/k8s-ci-builder/Dockerfile

Lines changed: 7 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414

1515
ARG GO_VERSION
1616
ARG OS_CODENAME
17-
ARG OLD_BAZEL_VERSION
1817

1918
# The Golang version for the builder image should always be explicitly set to
2019
# the Golang version of the kubernetes/kubernetes active development branch
@@ -29,41 +28,31 @@ RUN ./compile-release-tools
2928
### Production image
3029

3130
# Includes tools used for building Kubernetes in CI
32-
#
33-
# NOTE: we attempt to avoid unnecessary tools and image layers while
34-
# supporting kubernetes builds, kind installation, etc.
35-
36-
FROM launcher.gcr.io/google/bazel:${OLD_BAZEL_VERSION} as old-bazel
3731
FROM debian:${OS_CODENAME}
3832

3933
# arg that specifies the image name (for debugging)
4034
ARG IMAGE_ARG
41-
# arg that specifies the bazel version to install
42-
ARG BAZEL_VERSION
35+
36+
# arg that specifies the go version to install
4337
ARG GO_VERSION
4438

4539
# add envs:
4640
# - so we can debug with the image name:tag
47-
# - with the bazel version
4841
# - adding gsutil etc. to path (where we will install them)
4942
# - disabling prompts when installing gsutil etc.
5043
# - hinting that we are in a docker container
5144
ENV IMAGE=${IMAGE_ARG} \
52-
BAZEL_VERSION=${BAZEL_VERSION} \
5345
GOPATH=/home/prow/go \
5446
PATH=/home/prow/go/bin:/usr/local/go/bin:/google-cloud-sdk/bin:${PATH} \
5547
CLOUDSDK_CORE_DISABLE_PROMPTS=1 \
5648
CONTAINER=docker
5749

5850
# copy in image utility scripts
59-
COPY ["images/releng/k8s-ci-builder/wrapper.sh", \
60-
"images/releng/k8s-ci-builder/create_bazel_cache_rcs.sh", \
61-
"images/releng/k8s-ci-builder/install-bazel.sh", \
62-
"/usr/local/bin/"]
51+
COPY images/releng/k8s-ci-builder/wrapper.sh /usr/local/bin/
6352

6453
# Install tools needed to:
6554
# - install docker
66-
# - build kubernetes (dockerized, or with bazel)
55+
# - build kubernetes (dockerized)
6756
#
6857
# TODO: the `sed` is a bit of a hack, look into alternatives.
6958
# Why this exists: `docker service start` on debian runs a `cgroupfs_mount` method,
@@ -82,13 +71,8 @@ RUN echo "Installing Packages ..." \
8271
gnupg2 \
8372
jq \
8473
kmod \
85-
libassuan-dev \
86-
libbtrfs-dev \
87-
libdevmapper-dev \
88-
libgpgme-dev \
8974
lsb-release \
9075
mercurial \
91-
openssh-client \
9276
pkg-config \
9377
procps \
9478
python \
@@ -104,9 +88,7 @@ RUN echo "Installing Packages ..." \
10488
&& tar xzf "${GO_TARBALL}" -C /usr/local \
10589
&& rm "${GO_TARBALL}"\
10690
&& mkdir -p "${GOPATH}/bin" \
107-
&& echo "Installing Bazel ..." \
108-
&& install-bazel.sh \
109-
&& echo "Installing gcloud SDK, kubectl ..." \
91+
&& echo "Installing gcloud SDK, kubectl ..." \
11092
&& curl -fsSL https://dl.google.com/dl/cloudsdk/channels/rapid/google-cloud-sdk.tar.gz --output google-cloud-sdk.tar.gz \
11193
&& tar xzf google-cloud-sdk.tar.gz -C / \
11294
&& rm google-cloud-sdk.tar.gz \
@@ -116,8 +98,6 @@ RUN echo "Installing Packages ..." \
11698
--path-update=false \
11799
--usage-reporting=false \
118100
&& gcloud components install kubectl \
119-
&& gcloud components install alpha \
120-
&& gcloud components install beta \
121101
&& echo "Installing Docker ..." \
122102
&& curl -fsSL https://download.docker.com/linux/$(. /etc/os-release; echo "$ID")/gpg | apt-key add - \
123103
&& add-apt-repository \
@@ -128,12 +108,8 @@ RUN echo "Installing Packages ..." \
128108
&& rm -rf /var/lib/apt/lists/* \
129109
&& sed -i 's/cgroupfs_mount$/#cgroupfs_mount\n/' /etc/init.d/docker \
130110
&& echo "Ensuring Legacy Iptables ..." \
131-
&& update-alternatives --set iptables /usr/sbin/iptables-legacy \
132-
&& update-alternatives --set ip6tables /usr/sbin/ip6tables-legacy
133-
134-
ARG OLD_BAZEL_VERSION
135-
COPY --from=old-bazel \
136-
/usr/local/lib/bazel/bin/bazel-real /usr/local/lib/bazel/bin/bazel-${OLD_BAZEL_VERSION}
111+
&& update-alternatives --set iptables /usr/sbin/iptables-legacy \
112+
&& update-alternatives --set ip6tables /usr/sbin/ip6tables-legacy
137113

138114
# Copy in release tools from kubernetes/release
139115
WORKDIR /

images/releng/k8s-ci-builder/Makefile

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,10 @@ TAG ?= $(shell git describe --tags --always --dirty)
2626
# Build args
2727
GO_VERSION ?= 1.16.7
2828
OS_CODENAME ?= buster
29-
BAZEL_VERSION ?= 3.4.1
30-
OLD_BAZEL_VERSION ?= 2.2.0
3129
IMAGE_ARG ?= $(IMAGE):$(TAG)-$(CONFIG)
3230

3331
BUILD_ARGS = --build-arg=GO_VERSION=$(GO_VERSION) \
3432
--build-arg=OS_CODENAME=$(OS_CODENAME) \
35-
--build-arg=BAZEL_VERSION=$(BAZEL_VERSION) \
36-
--build-arg=OLD_BAZEL_VERSION=$(OLD_BAZEL_VERSION) \
3733
--build-arg=IMAGE_ARG=$(IMAGE_ARG)
3834

3935
# Ensure support for 'docker buildx' and 'docker manifest' commands

images/releng/k8s-ci-builder/ci-failures

Lines changed: 0 additions & 2 deletions
This file was deleted.

images/releng/k8s-ci-builder/cloudbuild.yaml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,6 @@ steps:
2424
- CONFIG=${_CONFIG}
2525
- GO_VERSION=${_GO_VERSION}
2626
- OS_CODENAME=${_OS_CODENAME}
27-
- BAZEL_VERSION=${_BAZEL_VERSION}
28-
- OLD_BAZEL_VERSION=${_OLD_BAZEL_VERSION}
2927
args:
3028
- '-c'
3129
- |
@@ -40,8 +38,6 @@ substitutions:
4038
_CONFIG: 'config'
4139
_GO_VERSION: '0.0.0'
4240
_OS_CODENAME: 'codename'
43-
_BAZEL_VERSION: '0.0.0'
44-
_OLD_BAZEL_VERSION: '0.0.0'
4541
_REGISTRY: 'fake.repository/registry-name'
4642

4743
tags:

images/releng/k8s-ci-builder/create_bazel_cache_rcs.sh

Lines changed: 0 additions & 125 deletions
This file was deleted.

images/releng/k8s-ci-builder/install-bazel.sh

Lines changed: 0 additions & 34 deletions
This file was deleted.

images/releng/k8s-ci-builder/variants.yaml

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,35 +3,23 @@ variants:
33
CONFIG: default
44
GO_VERSION: '1.16.7'
55
OS_CODENAME: 'buster'
6-
BAZEL_VERSION: '3.4.1'
7-
OLD_BAZEL_VERSION: '2.2.0'
86
'1.23':
97
CONFIG: '1.23'
108
GO_VERSION: '1.17'
119
OS_CODENAME: 'buster'
12-
BAZEL_VERSION: '3.4.1'
13-
OLD_BAZEL_VERSION: '2.2.0'
1410
'1.22':
1511
CONFIG: '1.22'
1612
GO_VERSION: '1.16.7'
1713
OS_CODENAME: 'buster'
18-
BAZEL_VERSION: '3.4.1'
19-
OLD_BAZEL_VERSION: '2.2.0'
2014
'1.21':
2115
CONFIG: '1.21'
2216
GO_VERSION: '1.16.7'
2317
OS_CODENAME: 'buster'
24-
BAZEL_VERSION: '3.4.1'
25-
OLD_BAZEL_VERSION: '2.2.0'
2618
'1.20':
2719
CONFIG: '1.20'
2820
GO_VERSION: '1.15.15'
2921
OS_CODENAME: 'buster'
30-
BAZEL_VERSION: '3.4.1'
31-
OLD_BAZEL_VERSION: '2.2.0'
3222
'1.19':
3323
CONFIG: '1.19'
3424
GO_VERSION: '1.15.15'
3525
OS_CODENAME: 'buster'
36-
BAZEL_VERSION: '2.2.0'
37-
OLD_BAZEL_VERSION: '0.23.2'

images/releng/k8s-ci-builder/wrapper.sh

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,7 @@
1919
#
2020
# Things wrapper.sh handles:
2121
# - starting / stopping docker-in-docker
22-
# -- configuring the docker daemon for IPv6
23-
# - confuring bazel caching
22+
# - configuring the docker daemon for IPv6
2423
# - activating GCP service account credentials
2524
# - ensuring GOPATH/bin is in PATH
2625
#
@@ -33,7 +32,7 @@ set -o nounset
3332

3433
>&2 echo "wrapper.sh] [INFO] Wrapping Test Command: \`$*\`"
3534
>&2 echo "wrapper.sh] [INFO] Running in: ${IMAGE}"
36-
>&2 echo "wrapper.sh] [INFO] See: https://github.com/kubernetes/test-infra/blob/master/images/krte/wrapper.sh"
35+
>&2 echo "wrapper.sh] [INFO] See: https://git.k8s.io/release/images/releng/k8s-ci-builder/wrapper.sh"
3736
printf '%0.s=' {1..80} >&2; echo >&2
3837
>&2 echo "wrapper.sh] [SETUP] Performing pre-test setup ..."
3938

@@ -48,6 +47,9 @@ cleanup(){
4847

4948
early_exit_handler() {
5049
>&2 echo "wrapper.sh] [EARLY EXIT] Interrupted, entering handler ..."
50+
if [ -n "${WRAPPED_COMMAND_PID:-}" ]; then
51+
kill -TERM "$WRAPPED_COMMAND_PID" || true
52+
fi
5153
if [ -n "${EXIT_VALUE:-}" ]; then
5254
>&2 echo "Original exit code was ${EXIT_VALUE}, not preserving due to interrupt signal"
5355
fi
@@ -58,15 +60,6 @@ early_exit_handler() {
5860

5961
trap early_exit_handler TERM INT
6062

61-
# Check if the job has opted-in to bazel remote caching and if so generate
62-
# .bazelrc entries pointing to the remote cache
63-
export BAZEL_REMOTE_CACHE_ENABLED=${BAZEL_REMOTE_CACHE_ENABLED:-false}
64-
if [[ "${BAZEL_REMOTE_CACHE_ENABLED}" == "true" ]]; then
65-
>&2 echo "wrapper.sh] [SETUP] Bazel remote cache is enabled, generating .bazelrcs ..."
66-
/usr/local/bin/create_bazel_cache_rcs.sh
67-
>&2 echo "wrapper.sh] [SETUP] Done setting up .bazelrcs"
68-
fi
69-
7063
# optionally enable ipv6 docker
7164
export DOCKER_IN_DOCKER_IPV6_ENABLED=${DOCKER_IN_DOCKER_IPV6_ENABLED:-false}
7265
if [[ "${DOCKER_IN_DOCKER_IPV6_ENABLED}" == "true" ]]; then
@@ -137,7 +130,9 @@ fi
137130
printf '%0.s=' {1..80}; echo
138131
>&2 echo "wrapper.sh] [TEST] Running Test Command: \`$*\` ..."
139132
set +o errexit
140-
"$@"
133+
"$@" &
134+
WRAPPED_COMMAND_PID=$!
135+
wait $WRAPPED_COMMAND_PID
141136
EXIT_VALUE=$?
142137
set -o errexit
143138
>&2 echo "wrapper.sh] [TEST] Test Command exit code: ${EXIT_VALUE}"

0 commit comments

Comments
 (0)