Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
59 changes: 59 additions & 0 deletions gcb/build.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
# See https://cloud.google.com/cloud-build/docs/build-config
timeout: 7200s
steps:
- name: 'gcr.io/cloud-builders/git'
dir: 'go/src/k8s.io'
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't this be /workspace/go/src/k8s.io ?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@listx -- either would work, I think.

dir is set relative to /workspace.
ref: https://cloud.google.com/cloud-build/docs/build-config

args:
- clone
- --branch=${_KUBERNETES_BRANCH}
- ${_KUBERNETES_REPO}

- name: 'gcr.io/cloud-builders/git'
dir: 'go/src/k8s.io'
args:
- clone
- --branch=${_RELEASE_TOOL_BRANCH}
- ${_RELEASE_TOOL_REPO}

- name: 'gcr.io/$PROJECT_ID/k8s-cloud-builder'
dir: 'go/src/k8s.io/kubernetes'
args:
- make
- clean

- name: 'gcr.io/$PROJECT_ID/k8s-cloud-builder'
dir: 'go/src/k8s.io/kubernetes'
args:
- make
- "${_RELEASE_TYPE}"

- name: 'gcr.io/$PROJECT_ID/k8s-cloud-builder'
dir: 'go/src/k8s.io/kubernetes'
args:
- ../release/push-build.sh
- --verbose
- "${_CI}"
- "${_NOMOCK}"
- "${_BUCKET}"
- "${_REGISTRY}"
- "${_ALLOW_DUP}"
- "${_EXTRA_PUBLISH_FILE}"
- "${_HYPERKUBE}"

options:
machineType: 'N1_HIGHCPU_32'
substitution_option: 'ALLOW_LOOSE'

substitutions:
_KUBERNETES_REPO: 'https://github.com/kubernetes/kubernetes.git'
_KUBERNETES_BRANCH: 'master'
_RELEASE_TOOL_REPO: 'https://github.com/kubernetes/release.git'
_RELEASE_TOOL_BRANCH: 'master'
_RELEASE_TYPE: 'release-in-a-container'
_CI: ''
_NOMOCK: ''
_BUCKET: '--bucket=kubernetes-release-dev'
_REGISTRY: '--registry=gcr.io/kubernetes-ci-images'
_ALLOW_DUP: ''
_EXTRA_PUBLISH_FILE: ''
_HYPERKUBE: ''
23 changes: 23 additions & 0 deletions gcb/variants.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
variants:
build-ci:
CI: '--ci'
NOMOCK: '--nomock'
BUCKET: '--bucket=k8s-staging-release-test'
REGISTRY: '--docker-registry=gcr.io/k8s-staging-release-test'
ALLOW_DUP: '--allow-dup'
EXTRA_PUBLISH_FILE: '--extra-publish-file=k8s-master'
HYPERKUBE: '--hyperkube'
build-ci-fast:
CI: '--ci'
NOMOCK: '--nomock'
BUCKET: '--bucket=k8s-staging-release-test'
REGISTRY: '--docker-registry=gcr.io/k8s-staging-release-test'
ALLOW_DUP: '--allow-dup'
build-ci-old:
CI: '--ci'
NOMOCK: '--nomock'
BUCKET: '--bucket=kubernetes-release-dev'
REGISTRY: '--docker-registry=gcr.io/kubernetes-ci-images'
ALLOW_DUP: '--allow-dup'
EXTRA_PUBLISH_FILE: '--extra-publish-file=k8s-master'
HYPERKUBE: '--hyperkube'
63 changes: 44 additions & 19 deletions images/k8s-cloud-builder/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
# To rebuild and publish this container run:
# gcloud builds submit --config update_build_container.yaml .

FROM ubuntu:18.04
FROM k8s.gcr.io/kube-cross:v1.12.12-1

ARG DEBIAN_FRONTEND=noninteractive

Expand Down Expand Up @@ -44,32 +41,60 @@ RUN apt-get -q update \
# Install gcloud
# common::set_cloud_binaries() looks for it in this path
RUN mkdir /opt/google
RUN curl -sSL https://sdk.cloud.google.com > /tmp/install.sh && \
bash /tmp/install.sh --install-dir=/opt/google --disable-prompts
RUN apt-get -y update \
&& apt-get -y install \
gcc \
python2.7 \
python-dev \
python-setuptools \
wget \
ca-certificates \
# These are necessary for add-apt-respository
software-properties-common \
# Install Git >2.0.1
&& apt-get -y update \
&& apt-get -y install git \
# Setup Google Cloud SDK (latest)
&& curl -sSL https://sdk.cloud.google.com > /tmp/install.sh \
&& bash /tmp/install.sh --install-dir=/opt/google --disable-prompts \
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A nit, but could this be gotten via apt-get also?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@tpepper -- yep, it can. This Dockerfile is Frankenstein work from a few strewn across other repos (that are known to work). I'm going to squash the layers (as you can see some repetition of commands as well) in a follow-up PR.

# install crcmod: https://cloud.google.com/storage/docs/gsutil/addlhelp/CRC32CandInstallingcrcmod
&& pip install -U crcmod \
# Clean up
&& apt-get -y remove \
gcc \
python-dev \
python-setuptools \
wget \
&& rm -rf /var/lib/apt/lists/* \
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My thinking on getting the Google Cloud SDK via apt was around being able to inventory the container contents, which is useful if nothing else for runtime debug, but likely other reasons too. Being able to docker run and dpkg -L or apt list --installed and see which gcc, which python-dev, which Google Cloud SDK are in a given binary instance of the container described by this Dockerfile is really important versus "it's whatever was available on the internet at build time".

&& rm -rf ~/.config/gcloud

ENV PATH=/opt/google/google-cloud-sdk/bin:$PATH

# Install docker stuff
#---------------------
# Based on instructions from:
# https://docs.docker.com/engine/installation/linux/docker-ce/ubuntu/#uninstall-old-versions
# https://docs.docker.com/install/linux/docker-ce/debian/
RUN apt-get -y update \
&& apt-get install -y \
linux-image-extra-virtual \
&& apt-get -y install \
apt-transport-https \
ca-certificates \
curl \
make \
software-properties-common \
&& curl -fsSL https://download.docker.com/linux/ubuntu/gpg | apt-key add - \
&& 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/ubuntu \
$(lsb_release -cs) \
stable edge" \
&& apt-get -y update

ARG DOCKER_VERSION=18.06.0~ce~3-0~ubuntu
RUN apt-get install -y \
docker-ce=${DOCKER_VERSION} \
unzip
"deb [arch=amd64] https://download.docker.com/linux/debian \
$(lsb_release -cs) \
stable" \
&& apt-get -y update \
&& apt-get -y install \
docker-ce \
docker-ce-cli \
containerd.io \
unzip

# Cleanup a bit
RUN rm -rf /var/lib/apt/lists/*

ENTRYPOINT []