Skip to content

Commit e64169d

Browse files
committed
build: Enable kube-cross push/pull from K8s Infra GCR
- Search/replace Google Infra kube-cross locations for K8s Infra - Update kube-cross make targets - Don't attempt to pre-pull image (docker build --pull) This prevents CI failures when the image under test doesn't exist yet in the registry. - 'make all' now builds and pushes the kube-cross image - Allow 'TAG' to be specified via env var - Use 'KUBE_CROSS_VERSION' to represent the kube-cross version - Tag kube-cross images with both a kubernetes version ('git describe') and a kube-cross version - Add a GCB (Google Cloud Build) config file (cloudbuild.yaml) Signed-off-by: Stephen Augustus <[email protected]>
1 parent bb0d9c9 commit e64169d

File tree

5 files changed

+30
-10
lines changed

5 files changed

+30
-10
lines changed

build/build-image/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
# limitations under the License.
1414

1515
# This file creates a standard build environment for building Kubernetes
16-
FROM k8s.gcr.io/kube-cross:KUBE_BUILD_IMAGE_CROSS_TAG
16+
FROM us.gcr.io/k8s-artifacts-prod/build-image/kube-cross:KUBE_BUILD_IMAGE_CROSS_TAG
1717

1818
# Mark this as a kube-build container
1919
RUN touch /kube-build-image

build/build-image/cross/Makefile

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,22 @@
1414

1515
.PHONY: build push
1616

17-
REGISTRY?=staging-k8s.gcr.io
18-
IMAGE=$(REGISTRY)/kube-cross
19-
TAG=$(shell cat VERSION)
17+
STAGING_REGISTRY?=gcr.io/k8s-staging-build-image
18+
PROD_REGISTRY?=us.gcr.io/k8s-artifacts-prod/build-image
19+
IMAGE=kube-cross
2020

21+
TAG?=kubernetes-$(shell git describe --tags --match='v*' --abbrev=14)
22+
KUBE_CROSS_VERSION=$(shell cat VERSION)
2123

22-
all: push
24+
all: build push
2325

2426
build:
25-
docker build --pull -t $(IMAGE):$(TAG) .
27+
docker build \
28+
-t $(STAGING_REGISTRY)/$(IMAGE):$(TAG) \
29+
-t $(STAGING_REGISTRY)/$(IMAGE):$(KUBE_CROSS_VERSION) \
30+
-t $(PROD_REGISTRY)/$(IMAGE):$(KUBE_CROSS_VERSION) \
31+
.
2632

27-
push: build
28-
docker push $(IMAGE):$(TAG)
33+
push:
34+
docker push $(STAGING_REGISTRY)/$(IMAGE):$(TAG)
35+
docker push $(STAGING_REGISTRY)/$(IMAGE):$(KUBE_CROSS_VERSION)
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
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/k8s-testimages/gcb-docker-gcloud:v20191019-6567e5c'
7+
entrypoint: make
8+
env:
9+
- DOCKER_CLI_EXPERIMENTAL=enabled
10+
args:
11+
- all
12+
images:
13+
- 'gcr.io/$PROJECT_ID/kube-cross:kubernetes-${_GIT_TAG}'

build/pause/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ ARCH ?= amd64
2727
ALL_ARCH = amd64 arm arm64 ppc64le s390x
2828

2929
CFLAGS = -Os -Wall -Werror -static -DVERSION=v$(TAG)-$(REV)
30-
KUBE_CROSS_IMAGE ?= k8s.gcr.io/kube-cross
30+
KUBE_CROSS_IMAGE ?= us.gcr.io/k8s-artifacts-prod/build-image/kube-cross
3131
KUBE_CROSS_VERSION ?= $(shell cat ../build-image/cross/VERSION)
3232

3333
BIN = pause

test/images/sample-apiserver/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15-
FROM k8s.gcr.io/kube-cross:v1.13.6-1 as build_k8s_1_17_sample_apiserver
15+
FROM us.gcr.io/k8s-artifacts-prod/build-image/kube-cross:v1.13.6-1 as build_k8s_1_17_sample_apiserver
1616

1717
ENV GOPATH /go
1818
RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin

0 commit comments

Comments
 (0)