Skip to content

Commit fd6de15

Browse files
committed
Add k8s-ci-builder image to support Kubernetes builds in CI
Signed-off-by: Stephen Augustus <[email protected]>
1 parent 457999c commit fd6de15

File tree

3 files changed

+75
-0
lines changed

3 files changed

+75
-0
lines changed
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# Copyright 2019 The Kubernetes Authors.
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
ARG GO_VERSION
16+
ARG KUBE_CROSS_VERSION
17+
FROM golang:${GO_VERSION} as builder
18+
19+
WORKDIR /go/src/k8s.io/release
20+
21+
COPY ./ ./
22+
23+
RUN ./compile-release-tools
24+
25+
### Production image
26+
27+
FROM gcr.io/k8s-staging-releng/k8s-cloud-builder:${KUBE_CROSS_VERSION}
28+
29+
WORKDIR /
30+
COPY --from=builder /go/bin/* ./
31+
32+
ENTRYPOINT ["/krel"]
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# See https://cloud.google.com/cloud-build/docs/build-config
2+
timeout: 1200s
3+
options:
4+
substitution_option: ALLOW_LOOSE
5+
steps:
6+
- name: gcr.io/cloud-builders/docker
7+
id: build
8+
dir: images/releng/k8s-ci-builder
9+
args:
10+
- build
11+
- --tag=gcr.io/$PROJECT_ID/k8s-ci-builder:${_GIT_TAG}-${_CONFIG}
12+
- --tag=gcr.io/$PROJECT_ID/k8s-ci-builder:latest-${_CONFIG}
13+
- --tag=gcr.io/$PROJECT_ID/k8s-ci-builder:${_KUBE_CROSS_VERSION}
14+
- --build-arg=GO_VERSION=${_GO_VERSION}
15+
- --build-arg=KUBE_CROSS_VERSION=${_KUBE_CROSS_VERSION}
16+
- -f ./Dockerfile
17+
- ../../../.
18+
19+
substitutions:
20+
# _GIT_TAG will be filled with a git-based tag for the image, of the form vYYYYMMDD-hash, and
21+
# can be used as a substitution
22+
_GIT_TAG: '12345'
23+
_PULL_BASE_REF: 'dev'
24+
_CONFIG: 'cross0.0'
25+
_GO_VERSION: '0.0.0'
26+
_KUBE_CROSS_VERSION: 'v0.0.0-0'
27+
28+
images:
29+
- 'gcr.io/$PROJECT_ID/k8s-ci-builder:${_GIT_TAG}-${_CONFIG}'
30+
- 'gcr.io/$PROJECT_ID/k8s-ci-builder:latest-${_CONFIG}'
31+
- 'gcr.io/$PROJECT_ID/k8s-ci-builder:${_KUBE_CROSS_VERSION}'
32+
33+
tags:
34+
- 'k8s-ci-builder'
35+
- ${_GIT_TAG}
36+
- ${_PULL_BASE_REF}
37+
- ${_GO_VERSION}
38+
- ${_KUBE_CROSS_VERSION}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
variants:
2+
cross1.15:
3+
CONFIG: 'cross1.15'
4+
GO_VERSION: '1.15.3'
5+
KUBE_CROSS_VERSION: 'v1.15.3-1'

0 commit comments

Comments
 (0)