From ae82196402eafd3e5ab1d977a3dd4fcb75f83acb Mon Sep 17 00:00:00 2001 From: Simon Hirst Date: Wed, 13 Jul 2022 13:15:04 +0100 Subject: [PATCH] Push fake master builds to different namespace --- Makefile | 14 ++++++++++++++ source-branch.env | 7 +++++++ 2 files changed, 21 insertions(+) create mode 100644 source-branch.env diff --git a/Makefile b/Makefile index 3a17261..f174a6d 100644 --- a/Makefile +++ b/Makefile @@ -18,6 +18,7 @@ ############################################################################### include config.env +include source-branch.env # RELEASE shows what release of the container code has been built RELEASE ?= @@ -115,6 +116,13 @@ else ifeq "$(ARCH)" "s390x" MQ_ARCHIVE_ARCH=S390X endif +# If this is a fake master build, push images to alternative location (pipeline wont consider these images GA candidates) +ifeq "$(TRAVIS)" "true" +ifneq "$(MAIN_BRANCH)" "$(SOURCE_BRANCH)" + MQ_DELIVERY_REGISTRY_NAMESPACE="master-fake" +endif +endif + # LTS_TAG is the tag modifier for an LTS container build LTS_TAG= ifeq "$(LTS)" "true" @@ -462,6 +470,9 @@ pull-mq-archive-dev: .PHONY: push-advancedserver push-advancedserver: + @if [ $(MQ_DELIVERY_REGISTRY_NAMESPACE) = "master-fake" ]; then\ + echo "Detected fake master build. Note that the push destination is set to the fake master namespace: $(MQ_DELIVERY_REGISTRY_FULL_PATH)";\ + fi $(info $(SPACER)$(shell printf $(TITLE)"Push production image to $(MQ_DELIVERY_REGISTRY_FULL_PATH)"$(END))) $(COMMAND) login $(MQ_DELIVERY_REGISTRY_HOSTNAME) -u $(MQ_DELIVERY_REGISTRY_USER) -p $(MQ_DELIVERY_REGISTRY_CREDENTIAL) $(COMMAND) tag $(MQ_IMAGE_ADVANCEDSERVER)\:$(MQ_TAG) $(MQ_DELIVERY_REGISTRY_FULL_PATH)/$(MQ_IMAGE_FULL_RELEASE_NAME) @@ -469,6 +480,9 @@ push-advancedserver: .PHONY: push-devserver push-devserver: + @if [ $(MQ_DELIVERY_REGISTRY_NAMESPACE) = "master-fake" ]; then\ + echo "Detected fake master build. Note that the push destination is set to the fake master namespace: $(MQ_DELIVERY_REGISTRY_FULL_PATH)";\ + fi $(info $(SPACER)$(shell printf $(TITLE)"Push developer image to $(MQ_DELIVERY_REGISTRY_FULL_PATH)"$(END))) $(COMMAND) login $(MQ_DELIVERY_REGISTRY_HOSTNAME) -u $(MQ_DELIVERY_REGISTRY_USER) -p $(MQ_DELIVERY_REGISTRY_CREDENTIAL) $(COMMAND) tag $(MQ_IMAGE_DEVSERVER)\:$(MQ_TAG) $(MQ_DELIVERY_REGISTRY_FULL_PATH)/$(MQ_IMAGE_DEV_FULL_RELEASE_NAME) diff --git a/source-branch.env b/source-branch.env new file mode 100644 index 0000000..cb21635 --- /dev/null +++ b/source-branch.env @@ -0,0 +1,7 @@ +########################################################################################################################################################### + +# SOURCE_BRANCH is the repository branch name for this release stream. +# It should be updated when a new release fork is created but not for testing of personal builds or pre-fork updates. +SOURCE_BRANCH ?= 'private-master' + +###########################################################################################################################################################