@@ -153,7 +153,7 @@ docker-push-%:
153
153
$(MAKE ) ARCH=$* docker-push
154
154
155
155
.PHONY : docker-push-manifest
156
- docker-push-manifest : # # Push the fat manifest docker image
156
+ docker-push-manifest : # # Push the fat manifest docker image.
157
157
# # Minimum docker version 18.06.0 is required for creating and pushing manifest images.
158
158
docker manifest create --amend $(CONTROLLER_IMG ) :$(TAG ) $(shell echo $(ALL_ARCH ) | sed -e "s~[^ ]* ~$(CONTROLLER_IMG ) \-&:$(TAG ) ~g")
159
159
@for arch in $(ALL_ARCH ) ; do docker manifest annotate --arch $$ {arch} ${CONTROLLER_IMG} :${TAG} ${CONTROLLER_IMG} -$$ {arch}:${TAG} ; done
@@ -170,21 +170,52 @@ set-manifest-image:
170
170
# # --------------------------------------
171
171
172
172
RELEASE_TAG := $(shell git describe --abbrev=0 2>/dev/null)
173
+ RELEASE_DIR := out
174
+
175
+ $(RELEASE_DIR ) :
176
+ mkdir -p $(RELEASE_DIR ) /
173
177
174
178
.PHONY : release
175
- release : # # Builds and push container images using the latest git tag for the commit
179
+ release : clean-release # # Builds and push container images using the latest git tag for the commit.
176
180
@if [ -z " ${RELEASE_TAG} " ]; then echo " RELEASE_TAG is not set" ; exit 1; fi
177
181
# Push the release image to the staging bucket first.
178
182
REGISTRY=$(STAGING_REGISTRY ) TAG=$(RELEASE_TAG ) \
179
183
$(MAKE ) docker-build-all docker-push-all
180
184
# Set the manifest image to the production bucket.
181
185
MANIFEST_IMG=$(PROD_REGISTRY ) /$(IMAGE_NAME ) MANIFEST_TAG=$(RELEASE_TAG ) \
182
186
$(MAKE ) set-manifest-image
183
- # Generate release artifacts.
184
- mkdir -p out/
185
- kustomize build config/default > out/bootstrap-components.yaml
187
+ $(MAKE ) release-manifests
188
+
189
+ .PHONY : release-manifests
190
+ release-manifests : $(RELEASE_DIR ) # # Builds the manifests to publish with a release
191
+ kustomize build config/default > $(RELEASE_DIR ) /infrastructure-components.yaml
192
+
193
+ .PHONY : release-binary
194
+ release-binary : $(RELEASE_DIR )
195
+ docker run \
196
+ --rm \
197
+ -e CGO_ENABLED=0 \
198
+ -e GOOS=$(GOOS ) \
199
+ -e GOARCH=$(GOARCH ) \
200
+ -v " $$ (pwd):/workspace" \
201
+ -w /workspace \
202
+ golang:1.12.9 \
203
+ go build -a -ldflags ' -extldflags "-static"' \
204
+ -o $(RELEASE_DIR ) /$(notdir $(RELEASE_BINARY ) ) -$(GOOS ) -$(GOARCH ) $(RELEASE_BINARY )
205
+
206
+ .PHONY : release-staging
207
+ release-staging : # # Builds and push container images to the staging bucket.
208
+ REGISTRY=$(STAGING_REGISTRY ) $(MAKE ) docker-build-all docker-push-all release-tag-latest
209
+
210
+
211
+ .PHONY : release-tag-latest
212
+ release-tag-latest : # # Adds the latest tag to the last build tag.
213
+ # # TODO(vincepri): Only do this when we're on master.
214
+ gcloud container images add-tag $(CONTROLLER_IMG ) :$(TAG ) $(CONTROLLER_IMG ) :latest
186
215
187
- .PHONY : release-staging-latest
188
- release-staging-latest : # # Builds and push container images to the staging bucket using "latest" tag
189
- REGISTRY=$(STAGING_REGISTRY ) TAG=latest \
190
- $(MAKE ) docker-build-all docker-push-all
216
+ # # --------------------------------------
217
+ # # Cleanup / Verification
218
+ # # --------------------------------------
219
+ .PHONY : clean-release
220
+ clean-release : # # Remove the release folder
221
+ rm -rf $(RELEASE_DIR )
0 commit comments