Skip to content
This repository has been archived by the owner on Jul 30, 2021. It is now read-only.

馃弮 Add release targets #200

Merged
merged 1 commit into from
Aug 30, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 1 addition & 4 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,9 @@ jobs:

- name: Build and push container images
uses: actions/gcloud/cli@master
env:
REGISTRY: gcr.io/k8s-staging-capi-kubeadm
TAG: latest
with:
entrypoint: /bin/bash
args: |
-c "apt-get -y update && \
apt-get -y --no-install-recommends install build-essential && \
make docker-build-all docker-push-all"
make release-staging-latest"
38 changes: 32 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -120,9 +120,8 @@ $(GOLANGCI_LINT): $(TOOLS_DIR)/go.mod

.PHONY: docker-build
docker-build: ## Build the docker image for controller-manager
docker build --pull --build-arg GOPROXY=$(GOPROXY) --build-arg ARCH=$(ARCH) . -t $(CONTROLLER_IMG)-$(ARCH):$(TAG)
@echo "updating kustomize image patch file for manager resource"
sed -i'' -e 's@image: .*@image: '"${CONTROLLER_IMG}-$(ARCH):$(TAG)"'@' ./config/default/manager_image_patch.yaml
docker build --pull --build-arg ARCH=$(ARCH) . -t $(CONTROLLER_IMG)-$(ARCH):$(TAG)
MANIFEST_IMG=$(CONTROLLER_IMG)-$(ARCH) MANIFEST_TAG=$(TAG) $(MAKE) set-manifest-image

.PHONY: docker-push
docker-push: ## Push the docker image
Expand Down Expand Up @@ -150,6 +149,33 @@ 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}
@echo "updating kustomize image patch file for manager resource"
sed -i'' -e 's@image: .*@image: '"${CONTROLLER_IMG}:$(TAG)"'@' ./config/default/manager_image_patch.yaml
MANIFEST_IMG=$(CONTROLLER_IMG) MANIFEST_TAG=$(TAG) $(MAKE) set-manifest-image

.PHONY: set-manifest-image
set-manifest-image:
$(info Updating kustomize image patch file for manager resource)
sed -i'' -e 's@image: .*@image: '"${MANIFEST_IMG}:$(MANIFEST_TAG)"'@' ./config/default/manager_image_patch.yaml
vincepri marked this conversation as resolved.
Show resolved Hide resolved

## --------------------------------------
## Release
## --------------------------------------

RELEASE_TAG := $(shell git describe --abbrev=0 2>/dev/null)

.PHONY: release
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
# Push the release image to the staging bucket first.
REGISTRY=gcr.io/k8s-staging-capi-kubeadm TAG=$(RELEASE_TAG) \
$(MAKE) docker-build-all docker-push-all
# Set the manifest image to the production bucket.
REGISTRY=us.gcr.io/k8s-artifacts-prod/capi-kubeadm TAG=$(RELEASE_TAG) \
set-manifest-image
# Generate release artifacts.
mkdir -p out/
kustomize build config/default > out/bootstrap-components.yaml

.PHONY: release-staging-latest
release-staging-latest: ## Builds and push container images to the staging bucket using "latest" tag.
REGISTRY=gcr.io/k8s-staging-capi-kubeadm TAG=latest \
$(MAKE) docker-build-all docker-push-all