-
Notifications
You must be signed in to change notification settings - Fork 527
Add support for running Kubernetes builds via Google Cloud Build #900
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| 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' | ||
| 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: '' | ||
| 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' |
| 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 | ||
|
|
||
|
|
@@ -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 \ | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. A nit, but could this be gotten via apt-get also? There was a problem hiding this comment. Choose a reason for hiding this commentThe 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/* \ | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 |
||
| && 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 [] | ||
There was a problem hiding this comment.
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?There was a problem hiding this comment.
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.
diris set relative to/workspace.ref: https://cloud.google.com/cloud-build/docs/build-config