Commit baed07bc authored by Elisabetta Giani's avatar Elisabetta Giani
Browse files

CT-147: use CI_COMMIT_REF_NAME variable to get the branch name when the pipeline is running.

parent 552a5bae
Loading
Loading
Loading
Loading
Loading
+9 −5
Original line number Diff line number Diff line
@@ -13,6 +13,11 @@
#   See the License for the specific language governing permissions and
#   limitations under the License.
#
ifneq ($(CI_JOB_ID),)
BRANCH_NAME := $(CI_BUILD_REF_NAME)
else 
BRANCH_NAME=$(shell git rev-parse --abbrev-ref HEAD)
endif
ifeq ($(strip $(PROJECT)),)
  NAME=$(shell basename $(CURDIR))
else
@@ -80,14 +85,13 @@ release: check-status check-release build push
push: pre-push do-push post-push  ## push the image to the Docker registry

do-push:
	@BRANCH_NAME=`git rev-parse --abbrev-ref HEAD`; \
	echo "Git branch: $$BRANCH_NAME"; \
	if [ $$BRANCH_NAME == "master" ]; then \
	@echo "Git branch: $(BRANCH_NAME)"; \
	if [ $(BRANCH_NAME) == "master" ]; then \
	echo "Image tag: $(IMAGE):$(VERSION) $(IMAGE):$(BASE_RELEASE)" ;\
	docker push $(IMAGE):$(BASE_RELEASE); \
	docker tag $(IMAGE):$(VERSION) $(IMAGE):$(BASE_RELEASE)-dev ;\
	else \
	echo "Image tag: $(IMAGE):$(VERSION) $(IMAGE):$(BASE_RELEASE)-dev" ;\
	docker tag $(IMAGE):$(VERSION) $(IMAGE):$(BASE_RELEASE)-dev ;\
	docker push $(IMAGE):$(BASE_RELEASE); \
	fi
#	docker push $(IMAGE):latest