@@ -87,9 +87,10 @@ help: ## Display this help
8787 @echo " DEBUG -- debug flag, if any ($( DEBUG) )"
8888
8989# Image URL to use all building/pushing image targets
90+ REGISTRY ?= quay.io/metal3-io
9091IMG_NAME ?= baremetal-operator
9192IMG_TAG ?= latest
92- IMG ?= $(IMG_NAME ) : $( IMG_TAG )
93+ IMG ?= $(REGISTRY ) / $( IMG_NAME )
9394
9495# # --------------------------------------
9596# # Test Targets
@@ -225,10 +226,15 @@ manifests-generate: $(CONTROLLER_GEN)
225226manifests-kustomize : $(KUSTOMIZE )
226227 $< build config/default > config/render/capm3.yaml
227228
229+ .PHONY : set-manifest-pull-policy
230+ set-manifest-pull-policy :
231+ $(info Updating kustomize pull policy file for manager resource)
232+ sed -i' ' -e ' s@imagePullPolicy: .*@imagePullPolicy: ' " $( PULL_POLICY) " ' @' ./config/base/manager.yaml
233+
228234.PHONY : set-manifest-image-bmo
229235set-manifest-image-bmo : $(KUSTOMIZE ) manifests
230236 $(info Updating container image for BMO to use ${MANIFEST_IMG}:${MANIFEST_TAG})
231- cd config/base && $( abspath $( KUSTOMIZE ) ) edit set image quay.io/metal3-io/baremetal-operator= ${MANIFEST_IMG} :${ MANIFEST_TAG}
237+ sed -i ' ' -e ' s@ image: .*@image: \" ' " ${MANIFEST_IMG} :$( MANIFEST_TAG) " ' \"@ ' ./config/base/manager.yaml
232238
233239.PHONY : set-manifest-image-ironic
234240set-manifest-image-ironic : $(KUSTOMIZE ) manifests
@@ -261,21 +267,21 @@ generate: $(CONTROLLER_GEN) ## Generate code
261267
262268.PHONY : docker
263269docker : generate manifests # # Build the docker image
264- docker build . -t ${IMG} \
270+ docker build . -t ${IMG} : ${IMG_TAG} \
265271 --build-arg http_proxy=$(http_proxy ) \
266272 --build-arg https_proxy=$(https_proxy )
267273
268274.PHONY : docker-debug
269275docker-debug : generate manifests # # Build the docker image with debug info
270- docker build . -t ${IMG} \
276+ docker build . -t ${IMG} : ${IMG_TAG} \
271277 --build-arg http_proxy=$(http_proxy ) \
272278 --build-arg https_proxy=$(https_proxy ) \
273279 --build-arg LDFLAGS=" -extldflags=-static"
274280
275281# Push the docker image
276282.PHONY : docker-push
277283docker-push :
278- docker push ${IMG}
284+ docker push ${IMG} : ${IMG_TAG}
279285
280286# # --------------------------------------
281287# # CI Targets
@@ -367,6 +373,20 @@ $(RELEASE_NOTES_DIR):
367373release-notes : $(RELEASE_NOTES_DIR ) $(RELEASE_NOTES )
368374 cd hack/tools && $(GO ) run release/notes.go --releaseTag=$(RELEASE_TAG ) > $(realpath $(RELEASE_NOTES_DIR ) ) /$(RELEASE_TAG ) .md
369375
376+ .PHONY : release-manifests
377+ release-manifests : $(KUSTOMIZE ) $(RELEASE_DIR ) # # Builds the manifests to publish with a release
378+ $(KUSTOMIZE ) build config > $(RELEASE_DIR ) /baremetal-operator.yaml
379+
380+ .PHONY : release
381+ release :
382+ @if [ -z " ${RELEASE_TAG} " ]; then echo " RELEASE_TAG is not set" ; exit 1; fi
383+ @if ! [ -z " $$ (git status --porcelain)" ]; then echo " You have uncommitted changes" ; exit 1; fi
384+ git checkout " ${RELEASE_TAG} "
385+ MANIFEST_IMG=$(IMG ) MANIFEST_TAG=$(RELEASE_TAG ) $(MAKE ) set-manifest-image-bmo
386+ PULL_POLICY=IfNotPresent $(MAKE ) set-manifest-pull-policy
387+ $(MAKE ) release-manifests
388+ $(MAKE ) release-notes
389+
370390go-version : # # Print the go version we use to compile our binaries and images
371391 @echo $(GO_VERSION )
372392
0 commit comments