diff --git a/gcb/release/cloudbuild.yaml b/gcb/release/cloudbuild.yaml index 10e0f3a0e84..67b4ce1c381 100644 --- a/gcb/release/cloudbuild.yaml +++ b/gcb/release/cloudbuild.yaml @@ -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}" diff --git a/gcb/stage/cloudbuild.yaml b/gcb/stage/cloudbuild.yaml index 97bcdaa955c..2f06a25a3d5 100644 --- a/gcb/stage/cloudbuild.yaml +++ b/gcb/stage/cloudbuild.yaml @@ -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}" @@ -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}" diff --git a/images/build/cross/Dockerfile b/images/build/cross/Dockerfile index 2ed71364393..5f0c8565270 100644 --- a/images/build/cross/Dockerfile +++ b/images/build/cross/Dockerfile @@ -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 @@ -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}" \ @@ -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 [] diff --git a/images/build/cross/Makefile b/images/build/cross/Makefile index a02ea319c5b..e8e282e5efc 100644 --- a/images/build/cross/Makefile +++ b/images/build/cross/Makefile @@ -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: @@ -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: diff --git a/images/build/cross/cloudbuild.yaml b/images/build/cross/cloudbuild.yaml index 957ce7f66c4..2132f2f54ef 100644 --- a/images/build/cross/cloudbuild.yaml +++ b/images/build/cross/cloudbuild.yaml @@ -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: @@ -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' diff --git a/images/build/cross/variants.yaml b/images/build/cross/variants.yaml index fbcfbba5eed..25c0afcf40b 100644 --- a/images/build/cross/variants.yaml +++ b/images/build/cross/variants.yaml @@ -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' diff --git a/images/k8s-cloud-builder/Dockerfile b/images/k8s-cloud-builder/Dockerfile index 4ac1179f9da..fa435d2d5dc 100644 --- a/images/k8s-cloud-builder/Dockerfile +++ b/images/k8s-cloud-builder/Dockerfile @@ -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 \ @@ -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}" @@ -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} \ @@ -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 diff --git a/images/k8s-cloud-builder/cloudbuild.yaml b/images/k8s-cloud-builder/cloudbuild.yaml index 42a324e6590..b8629e9c331 100644 --- a/images/k8s-cloud-builder/cloudbuild.yaml +++ b/images/k8s-cloud-builder/cloudbuild.yaml @@ -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}' diff --git a/images/k8s-cloud-builder/variants.yaml b/images/k8s-cloud-builder/variants.yaml new file mode 100644 index 00000000000..33bca97b31e --- /dev/null +++ b/images/k8s-cloud-builder/variants.yaml @@ -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'