Skip to content

Commit

Permalink
Merge pull request #1279 from justaugustus/images-asdfghjkl
Browse files Browse the repository at this point in the history
Revert k8s-cloud-builder changes in kube-cross and enable variant building
  • Loading branch information
k8s-ci-robot authored May 12, 2020
2 parents 61c2711 + 4878b82 commit dc0dc7d
Show file tree
Hide file tree
Showing 9 changed files with 65 additions and 140 deletions.
2 changes: 1 addition & 1 deletion gcb/release/cloudbuild.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ steps:
args:
- "./compile-release-tools"

- name: us.gcr.io/k8s-artifacts-prod/build-image/kube-cross:${_KUBE_CROSS_VERSION}
- name: gcr.io/k8s-staging-releng/k8s-cloud-builder:${_KUBE_CROSS_VERSION}
dir: "go/src/k8s.io/release"
env:
- "TOOL_ORG=${_TOOL_ORG}"
Expand Down
4 changes: 2 additions & 2 deletions gcb/stage/cloudbuild.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ steps:
args:
- "./compile-release-tools"

- name: us.gcr.io/k8s-artifacts-prod/build-image/kube-cross:${_KUBE_CROSS_VERSION}
- name: gcr.io/k8s-staging-releng/k8s-cloud-builder:${_KUBE_CROSS_VERSION}
dir: "go/src/k8s.io/release"
env:
- "TOOL_ORG=${_TOOL_ORG}"
Expand Down Expand Up @@ -79,7 +79,7 @@ steps:
- "--basedir=/workspace"
- "--tmpdir=/workspace/tmp"

- name: us.gcr.io/k8s-artifacts-prod/build-image/kube-cross:${_KUBE_CROSS_VERSION}
- name: gcr.io/k8s-staging-releng/k8s-cloud-builder:${_KUBE_CROSS_VERSION}
dir: "go/src/k8s.io/release"
env:
- "TOOL_ORG=${_TOOL_ORG}"
Expand Down
76 changes: 3 additions & 73 deletions images/build/cross/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -48,28 +48,10 @@ RUN for platform in ${KUBE_CROSSPLATFORMS}; do GOOS=${platform%/*} GOARCH=${plat
RUN apt-get -q update \
&& apt-get install -qqy \
apt-utils \
apt-transport-https \
bsdmainutils \
ca-certificates \
curl \
file \
gettext-base \
git \
gnupg2 \
grep \
jq \
libassuan-dev \
libbtrfs-dev \
libdevmapper-dev \
libgpgme-dev \
lsb-release \
make \
net-tools \
pandoc \
patch \
rsync \
software-properties-common \
tzdata \
unzip

# Use dynamic cgo linking for architectures other than amd64 for the server platforms
Expand All @@ -80,7 +62,7 @@ RUN echo "deb http://archive.ubuntu.com/ubuntu xenial main universe" > /etc/apt/
&& apt-get install -y build-essential \
&& for platform in ${KUBE_DYNAMIC_CROSSPLATFORMS}; do apt-get install -y crossbuild-essential-${platform}; done

ARG PROTOBUF_VERSION=3.0.2
ARG PROTOBUF_VERSION
ENV ZIPNAME="protoc-${PROTOBUF_VERSION}-linux-x86_64.zip"
RUN mkdir /tmp/protoc && cd /tmp/protoc \
&& wget "https://github.com/protocolbuffers/protobuf/releases/download/v${PROTOBUF_VERSION}/${ZIPNAME}" \
Expand All @@ -103,69 +85,17 @@ RUN go get golang.org/x/tools/cmd/cover \
&& go clean -cache

# Download and symlink etcd. We need this for our integration tests.
ARG ETCD_VERSION=v3.2.24
ARG ETCD_VERSION
RUN mkdir -p /usr/local/src/etcd \
&& cd /usr/local/src/etcd \
&& curl -fsSL https://github.com/coreos/etcd/releases/download/${ETCD_VERSION}/etcd-${ETCD_VERSION}-linux-amd64.tar.gz | tar -xz \
&& ln -s ../src/etcd/etcd-${ETCD_VERSION}-linux-amd64/etcd /usr/local/bin/

# We want to get rid of python2, we want only python3
#
# Right now, the image chain looks like this:
# k8s-cloud-builder <- k8s.gcr.io/kube-cross:v1.13.4-1 <- golang:1.13.4 <- buildpack-deps:buster-scm <- debian:buster
# python2 comes in with buildpack-deps:buster-scm, because that image installs
# mercurial which in turn has a hard dependency on python2
RUN apt-get -qqy purge ".*python2.*" \
&& apt-get -qqy install \
python3-minimal \
python3-pip \
&& update-alternatives --install /usr/bin/python python /usr/bin/python3 90 \
&& update-alternatives --install /usr/bin/pip pip /usr/bin/pip3 90

# Install Pip packages
RUN pip3 install --no-cache-dir \
# for gcloud https://cloud.google.com/storage/docs/gsutil/addlhelp/CRC32CandInstallingcrcmod
crcmod \
yq

# common::set_cloud_binaries() looks for it in this path
ARG GOOGLE_DIR='/opt/google'

# Install gcloud
RUN bash -c \
'bash <(curl -sSL https://sdk.cloud.google.com) \
--install-dir="${GOOGLE_DIR}" \
--disable-prompts \
>/dev/null'

ENV PATH="${GOOGLE_DIR}/google-cloud-sdk/bin:${PATH}"

# Install docker cli
# https://docs.docker.com/install/linux/docker-ce/debian/
RUN curl -fsSL https://download.docker.com/linux/debian/gpg | apt-key add - \
&& apt-key fingerprint 0EBFCD88 \
&& add-apt-repository \
"deb [arch=amd64] https://download.docker.com/linux/debian \
$(lsb_release -cs) \
stable" \
&& apt-get -y update \
&& apt-get -qqy install \
docker-ce-cli

ARG SKOPEO_VERSION=v0.1.41
RUN git clone https://github.com/containers/skopeo $GOPATH/src/github.com/containers/skopeo
RUN cd $GOPATH/src/github.com/containers/skopeo \
&& git checkout ${SKOPEO_VERSION} \
&& make binary-local \
&& cp skopeo /usr/local/bin \
&& rm -rf $GOPATH/src/github.com/containers/skopeo

# Cleanup a bit
RUN apt-get -qqy remove \
wget \
&& apt-get clean \
&& rm -rf -- \
/var/lib/apt/lists/* \
~/.config/gcloud
/var/lib/apt/lists/*

ENTRYPOINT []
6 changes: 2 additions & 4 deletions images/build/cross/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,12 @@ IMAGE=kube-cross

TAG?=$(shell git describe --tags --always --dirty)
CONFIG?=go1.14
KUBE_CROSS_VERSION?=v1.14.2-3
KUBE_CROSS_VERSION?=v1.14.2-4

# Build args
GO_VERSION?=1.14.2
PROTOBUF_VERSION?=3.11.4
PROTOBUF_VERSION?=3.0.2
ETCD_VERSION?=v3.4.7
SKOPEO_VERSION?=v0.2.0

# TODO: Support multi-arch kube-cross images
# ref:
Expand All @@ -45,7 +44,6 @@ build:
--build-arg=GO_VERSION=$(GO_VERSION) \
--build-arg=PROTOBUF_VERSION=$(PROTOBUF_VERSION) \
--build-arg=ETCD_VERSION=$(ETCD_VERSION) \
--build-arg=SKOPEO_VERSION=$(SKOPEO_VERSION) \
.

push:
Expand Down
2 changes: 0 additions & 2 deletions images/build/cross/cloudbuild.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ steps:
- KUBE_CROSS_VERSION=$_KUBE_CROSS_VERSION
- PROTOBUF_VERSION=$_PROTOBUF_VERSION
- ETCD_VERSION=$_ETCD_VERSION
- SKOPEO_VERSION=$_SKOPEO_VERSION
args:
- all
substitutions:
Expand All @@ -27,7 +26,6 @@ substitutions:
_KUBE_CROSS_VERSION: 'v0.0.0-0'
_PROTOBUF_VERSION: '0.0.0'
_ETCD_VERSION: 'v0.0.0'
_SKOPEO_VERSION: 'v0.0.0'
images:
- 'gcr.io/$PROJECT_ID/kube-cross-amd64:$_KUBE_CROSS_VERSION'
- 'gcr.io/$PROJECT_ID/kube-cross-amd64:$_GIT_TAG-$_CONFIG'
19 changes: 4 additions & 15 deletions images/build/cross/variants.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,12 @@ variants:
go1.14:
CONFIG: 'go1.14'
GO_VERSION: '1.14.2'
KUBE_CROSS_VERSION: 'v1.14.2-3'
PROTOBUF_VERSION: '3.11.4'
KUBE_CROSS_VERSION: 'v1.14.2-4'
PROTOBUF_VERSION: '3.0.2'
ETCD_VERSION: 'v3.4.7'
SKOPEO_VERSION: 'v0.2.0'
go1.13:
CONFIG: 'go1.13'
GO_VERSION: '1.13.9'
KUBE_CROSS_VERSION: 'v1.13.9-4'
PROTOBUF_VERSION: '3.11.4'
ETCD_VERSION: 'v3.4.7'
SKOPEO_VERSION: 'v0.2.0'
# DO NOT UPDATE CONFIGS BELOW THIS COMMENT
# The following Go versions are out of support
go1.12:
CONFIG: 'go1.12'
GO_VERSION: '1.12.17'
KUBE_CROSS_VERSION: 'v1.12.17-2'
KUBE_CROSS_VERSION: 'v1.13.9-5'
PROTOBUF_VERSION: '3.0.2'
ETCD_VERSION: 'v3.2.24'
SKOPEO_VERSION: 'v0.1.41'
ETCD_VERSION: 'v3.4.7'
70 changes: 32 additions & 38 deletions images/k8s-cloud-builder/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,31 +12,19 @@
# See the License for the specific language governing permissions and
# limitations under the License.

ARG KUBE_CROSS_VERSION
FROM us.gcr.io/k8s-artifacts-prod/build-image/kube-cross:${KUBE_CROSS_VERSION}

##------------------------------------------------------------
# global ARGs & ENVs

ARG DEBIAN_FRONTEND=noninteractive

##------------------------------------------------------------
FROM us.gcr.io/k8s-artifacts-prod/build-image/kube-cross:v1.12.17-1

RUN apt-get -q update

# We want to get rid of python2, we want only python3
#
# Right now, the image chain looks like this:
# k8s-cloud-builder <- k8s.gcr.io/kube-cross:v1.13.4-1 <- golang:1.13.4 <- buildpack-deps:buster-scm <- debian:buster
# python2 comes in with buildpack-deps:buster-scm, because that image installs
# mercurial which in turn has a hard dependency on python2
RUN apt-get -qqy purge ".*python2.*" \
&& apt-get -qqy install \
python3-minimal \
python3-pip \
&& update-alternatives --install /usr/bin/python python /usr/bin/python3 90 \
&& update-alternatives --install /usr/bin/pip pip /usr/bin/pip3 90

# Install packages
RUN apt-get install -qqy \
RUN apt-get -q update \
&& apt-get install -qqy \
apt-transport-https \
bsdmainutils \
ca-certificates \
Expand All @@ -59,29 +47,34 @@ RUN apt-get install -qqy \
tzdata \
unzip

# We want to get rid of python2, we want only python3
#
# Right now, the image chain looks like this:
# k8s-cloud-builder <- k8s.gcr.io/kube-cross:v1.13.4-1 <- golang:1.13.4 <- buildpack-deps:buster-scm <- debian:buster
# python2 comes in with buildpack-deps:buster-scm, because that image installs
# mercurial which in turn has a hard dependency on python2
RUN apt-get -qqy purge ".*python2.*" \
&& apt-get -qqy install \
python3-minimal \
python3-pip \
&& update-alternatives --install /usr/bin/python python /usr/bin/python3 90 \
&& update-alternatives --install /usr/bin/pip pip /usr/bin/pip3 90

# Install Pip packages
RUN pip3 install --no-cache-dir \
# for gcloud https://cloud.google.com/storage/docs/gsutil/addlhelp/CRC32CandInstallingcrcmod
crcmod \
# For now we do not re-install mercurial, we think we might not need it after all.
#
# # We for now need to install mercurial via pip as opposed to via
# # apt/dpkg to not pull in python2. As soon as debian has a mercurial package
# # that has no hard dependency on python2, we can switch back to using the
# # distributor's package again.
# mercurial \
yq
# for gcloud https://cloud.google.com/storage/docs/gsutil/addlhelp/CRC32CandInstallingcrcmod
crcmod \
yq

# common::set_cloud_binaries() looks for it in this path
ARG GOOGLE_DIR='/opt/google'

# Install gcloud
RUN bash -c ' \
bash <(curl -sSL https://sdk.cloud.google.com) \
--install-dir="${GOOGLE_DIR}" \
--disable-prompts \
>/dev/null \
'
RUN bash -c \
'bash <(curl -sSL https://sdk.cloud.google.com) \
--install-dir="${GOOGLE_DIR}" \
--disable-prompts \
>/dev/null'

ENV PATH="${GOOGLE_DIR}/google-cloud-sdk/bin:${PATH}"

Expand All @@ -90,14 +83,14 @@ ENV PATH="${GOOGLE_DIR}/google-cloud-sdk/bin:${PATH}"
RUN curl -fsSL https://download.docker.com/linux/debian/gpg | apt-key add - \
&& apt-key fingerprint 0EBFCD88 \
&& add-apt-repository \
"deb [arch=amd64] https://download.docker.com/linux/debian \
$(lsb_release -cs) \
stable" \
"deb [arch=amd64] https://download.docker.com/linux/debian \
$(lsb_release -cs) \
stable" \
&& apt-get -y update \
&& apt-get -qqy install \
docker-ce-cli

ARG SKOPEO_VERSION=v0.1.41
ARG SKOPEO_VERSION
RUN git clone https://github.com/containers/skopeo $GOPATH/src/github.com/containers/skopeo
RUN cd $GOPATH/src/github.com/containers/skopeo \
&& git checkout ${SKOPEO_VERSION} \
Expand All @@ -107,7 +100,8 @@ RUN cd $GOPATH/src/github.com/containers/skopeo \

# Cleanup a bit
RUN apt-get -qqy remove \
wget \
wget \
&& apt-get clean \
&& rm -rf -- \
/var/lib/apt/lists/* \
~/.config/gcloud
Expand Down
17 changes: 12 additions & 5 deletions images/k8s-cloud-builder/cloudbuild.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,27 @@ steps:
id: build
args:
- build
- --tag=gcr.io/$PROJECT_ID/k8s-cloud-builder:${_GIT_TAG}
- --tag=gcr.io/$PROJECT_ID/k8s-cloud-builder:latest
- --tag=gcr.io/$PROJECT_ID/k8s-cloud-builder:${_GIT_TAG}-${_CONFIG}
- --tag=gcr.io/$PROJECT_ID/k8s-cloud-builder:latest-${_CONFIG}
- --tag=gcr.io/$PROJECT_ID/k8s-cloud-builder:${_KUBE_CROSS_VERSION}
- --build-arg=KUBE_CROSS_VERSION=${_KUBE_CROSS_VERSION}
- --build-arg=SKOPEO_VERSION=${_SKOPEO_VERSION}
- .
- name: gcr.io/gcp-runtimes/container-structure-test
id: test
args:
- test
- --image=gcr.io/$PROJECT_ID/k8s-cloud-builder:latest
- --image=gcr.io/$PROJECT_ID/k8s-cloud-builder:${_GIT_TAG}-${_CONFIG}
- --config=test.yaml
substitutions:
# _GIT_TAG will be filled with a git-based tag for the image, of the form vYYYYMMDD-hash, and
# can be used as a substitution
_GIT_TAG: '12345'
_PULL_BASE_REF: 'dev'
_CONFIG: 'cross0.0'
_KUBE_CROSS_VERSION: 'v0.0.0-0'
_SKOPEO_VERSION: 'v0.0.0'
images:
- 'gcr.io/$PROJECT_ID/k8s-cloud-builder:${_GIT_TAG}'
- 'gcr.io/$PROJECT_ID/k8s-cloud-builder:latest'
- 'gcr.io/$PROJECT_ID/k8s-cloud-builder:${_GIT_TAG}-${_CONFIG}'
- 'gcr.io/$PROJECT_ID/k8s-cloud-builder:latest-${_CONFIG}'
- 'gcr.io/$PROJECT_ID/k8s-cloud-builder:${_KUBE_CROSS_VERSION}'
9 changes: 9 additions & 0 deletions images/k8s-cloud-builder/variants.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
variants:
cross1.14:
CONFIG: 'cross1.14'
KUBE_CROSS_VERSION: 'v1.14.2-1'
SKOPEO_VERSION: 'v0.2.0'
cross1.13:
CONFIG: 'cross1.13'
KUBE_CROSS_VERSION: 'v1.13.9-2'
SKOPEO_VERSION: 'v0.2.0'

0 comments on commit dc0dc7d

Please sign in to comment.