mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-27 05:27:21 +00:00
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 <saugustus@vmware.com>
This commit is contained in:
parent
bb0d9c9f23
commit
e64169d6b5
@ -13,7 +13,7 @@
|
||||
# limitations under the License.
|
||||
|
||||
# This file creates a standard build environment for building Kubernetes
|
||||
FROM k8s.gcr.io/kube-cross:KUBE_BUILD_IMAGE_CROSS_TAG
|
||||
FROM us.gcr.io/k8s-artifacts-prod/build-image/kube-cross:KUBE_BUILD_IMAGE_CROSS_TAG
|
||||
|
||||
# Mark this as a kube-build container
|
||||
RUN touch /kube-build-image
|
||||
|
@ -14,15 +14,22 @@
|
||||
|
||||
.PHONY: build push
|
||||
|
||||
REGISTRY?=staging-k8s.gcr.io
|
||||
IMAGE=$(REGISTRY)/kube-cross
|
||||
TAG=$(shell cat VERSION)
|
||||
STAGING_REGISTRY?=gcr.io/k8s-staging-build-image
|
||||
PROD_REGISTRY?=us.gcr.io/k8s-artifacts-prod/build-image
|
||||
IMAGE=kube-cross
|
||||
|
||||
TAG?=kubernetes-$(shell git describe --tags --match='v*' --abbrev=14)
|
||||
KUBE_CROSS_VERSION=$(shell cat VERSION)
|
||||
|
||||
all: push
|
||||
all: build push
|
||||
|
||||
build:
|
||||
docker build --pull -t $(IMAGE):$(TAG) .
|
||||
docker build \
|
||||
-t $(STAGING_REGISTRY)/$(IMAGE):$(TAG) \
|
||||
-t $(STAGING_REGISTRY)/$(IMAGE):$(KUBE_CROSS_VERSION) \
|
||||
-t $(PROD_REGISTRY)/$(IMAGE):$(KUBE_CROSS_VERSION) \
|
||||
.
|
||||
|
||||
push: build
|
||||
docker push $(IMAGE):$(TAG)
|
||||
push:
|
||||
docker push $(STAGING_REGISTRY)/$(IMAGE):$(TAG)
|
||||
docker push $(STAGING_REGISTRY)/$(IMAGE):$(KUBE_CROSS_VERSION)
|
||||
|
13
build/build-image/cross/cloudbuild.yaml
Normal file
13
build/build-image/cross/cloudbuild.yaml
Normal file
@ -0,0 +1,13 @@
|
||||
# See https://cloud.google.com/cloud-build/docs/build-config
|
||||
timeout: 1200s
|
||||
options:
|
||||
substitution_option: ALLOW_LOOSE
|
||||
steps:
|
||||
- name: 'gcr.io/k8s-testimages/gcb-docker-gcloud:v20191019-6567e5c'
|
||||
entrypoint: make
|
||||
env:
|
||||
- DOCKER_CLI_EXPERIMENTAL=enabled
|
||||
args:
|
||||
- all
|
||||
images:
|
||||
- 'gcr.io/$PROJECT_ID/kube-cross:kubernetes-${_GIT_TAG}'
|
@ -27,7 +27,7 @@ ARCH ?= amd64
|
||||
ALL_ARCH = amd64 arm arm64 ppc64le s390x
|
||||
|
||||
CFLAGS = -Os -Wall -Werror -static -DVERSION=v$(TAG)-$(REV)
|
||||
KUBE_CROSS_IMAGE ?= k8s.gcr.io/kube-cross
|
||||
KUBE_CROSS_IMAGE ?= us.gcr.io/k8s-artifacts-prod/build-image/kube-cross
|
||||
KUBE_CROSS_VERSION ?= $(shell cat ../build-image/cross/VERSION)
|
||||
|
||||
BIN = pause
|
||||
|
@ -12,7 +12,7 @@
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
FROM k8s.gcr.io/kube-cross:v1.13.6-1 as build_k8s_1_17_sample_apiserver
|
||||
FROM us.gcr.io/k8s-artifacts-prod/build-image/kube-cross:v1.13.6-1 as build_k8s_1_17_sample_apiserver
|
||||
|
||||
ENV GOPATH /go
|
||||
RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin
|
||||
|
Loading…
Reference in New Issue
Block a user