From e3df2a31c4bebec5be4f73a3db74270a94c69fc3 Mon Sep 17 00:00:00 2001 From: Stefan Bueringer Date: Sat, 7 Sep 2019 20:33:40 +0200 Subject: [PATCH] sync Makefile, add cloudbuild --- Makefile | 17 +++++++++++------ cloudbuild.yaml | 14 ++++++++++++++ config/default/manager_image_patch.yaml | 2 +- 3 files changed, 26 insertions(+), 7 deletions(-) create mode 100644 cloudbuild.yaml diff --git a/Makefile b/Makefile index ad6920432d..4bce06f1ef 100644 --- a/Makefile +++ b/Makefile @@ -225,7 +225,7 @@ docker-push-manifest: ## Push the fat manifest docker image. ## Minimum docker version 18.06.0 is required for creating and pushing manifest images. docker manifest create --amend $(CONTROLLER_IMG):$(TAG) $(shell echo $(ALL_ARCH) | sed -e "s~[^ ]*~$(CONTROLLER_IMG)\-&:$(TAG)~g") @for arch in $(ALL_ARCH); do docker manifest annotate --arch $${arch} ${CONTROLLER_IMG}:${TAG} ${CONTROLLER_IMG}-$${arch}:${TAG}; done - docker manifest push --purge ${CONTROLLER_IMG}:${TAG} + docker manifest push --purge $(CONTROLLER_IMG):$(TAG) MANIFEST_IMG=$(CONTROLLER_IMG) MANIFEST_TAG=$(TAG) $(MAKE) set-manifest-image .PHONY: set-manifest-image @@ -244,8 +244,10 @@ $(RELEASE_DIR): mkdir -p $(RELEASE_DIR)/ .PHONY: release -release: clean-release ## Builds and push container images using the latest git tag for the commit. +release: clean-release ## Builds and push container images using the latest git tag for the commit. @if [ -z "${RELEASE_TAG}" ]; then echo "RELEASE_TAG is not set"; exit 1; fi + @if ! [ -z "$$(git status --porcelain)" ]; then echo "Your local git repository contains uncommitted changes, use git clean before proceeding."; exit 1; fi + git checkout "${RELEASE_TAG}" # Push the release image to the staging bucket first. REGISTRY=$(STAGING_REGISTRY) TAG=$(RELEASE_TAG) \ $(MAKE) docker-build-all docker-push-all @@ -258,10 +260,13 @@ release: clean-release ## Builds and push container images using the latest git release-manifests: $(RELEASE_DIR) ## Builds the manifests to publish with a release kustomize build config/default > $(RELEASE_DIR)/infrastructure-components.yaml -.PHONY: release-staging-latest -release-staging-latest: ## Builds and push container images to the staging bucket using "latest" tag. - REGISTRY=$(STAGING_REGISTRY) TAG=latest \ - $(MAKE) docker-build-all docker-push-all +.PHONY: release-staging +release-staging: ## Builds and push container images to the staging bucket. + REGISTRY=$(STAGING_REGISTRY) $(MAKE) docker-build-all docker-push-all release-tag-latest + +.PHONY: release-tag-latest +release-tag-latest: ## Adds the latest tag to the last build tag. + gcloud container images add-tag $(CONTROLLER_IMG):$(TAG) $(CONTROLLER_IMG):latest ## -------------------------------------- ## Development diff --git a/cloudbuild.yaml b/cloudbuild.yaml new file mode 100644 index 0000000000..82a00e30ab --- /dev/null +++ b/cloudbuild.yaml @@ -0,0 +1,14 @@ +# See https://cloud.google.com/cloud-build/docs/build-config +timeout: 1200s +steps: + - name: 'gcr.io/k8s-testimages/gcb-docker-gcloud:v20190906-745fed4' + entrypoint: make + env: + - DOCKER_CLI_EXPERIMENTAL=enabled + - TAG=$_GIT_TAG + args: + - release-staging +substitutions: + # _GIT_TAG will be filled with a git-based tag for the image, of the form vYYYYMMDD-hash, and + # can be used as a substitution + _GIT_TAG: '12345' diff --git a/config/default/manager_image_patch.yaml b/config/default/manager_image_patch.yaml index b32fc9e3ec..af34776355 100644 --- a/config/default/manager_image_patch.yaml +++ b/config/default/manager_image_patch.yaml @@ -8,5 +8,5 @@ spec: spec: containers: # Change the value of image field below to your controller image URL - - image: gcr.io/k8s-staging-capi-openstack/capi-openstack-controller:latest + - image: gcr.io/k8s-staging-capi-openstack/capi-openstack-controller:dev name: manager