Skip to content

Commit

Permalink
sync Makefile, add cloudbuild
Browse files Browse the repository at this point in the history
  • Loading branch information
sbueringer committed Sep 7, 2019
1 parent cd57857 commit e3df2a3
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 7 deletions.
17 changes: 11 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand 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
Expand Down
14 changes: 14 additions & 0 deletions cloudbuild.yaml
Original file line number Diff line number Diff line change
@@ -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'
2 changes: 1 addition & 1 deletion config/default/manager_image_patch.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit e3df2a3

Please sign in to comment.