From 192b7bab0bea4a921b5939419daadcde24113f2e Mon Sep 17 00:00:00 2001 From: Nadav Tasher Date: Wed, 9 Oct 2024 22:52:06 +0300 Subject: [PATCH] Change independent bundle Makefile --- bundles/independent/Makefile | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/bundles/independent/Makefile b/bundles/independent/Makefile index b1ba5d6..bdbf534 100644 --- a/bundles/independent/Makefile +++ b/bundles/independent/Makefile @@ -10,16 +10,21 @@ IMAGE_SOURCES := $(shell find $(IMAGE_PATH) -type f) # Create the image tag from the commit date IMAGE_TAG := $(shell git show --quiet --date=format:%Y.%m.%d --format=%cd) -# Check if the repository has unstaged changes +all: image + ifneq ($(shell git status --porcelain),) - IMAGE_TAG := $(IMAGE_TAG)-dirty -endif +# The repository is dirty, deny pushes and mark image as dirty. +IMAGE_TAG := $(IMAGE_TAG)-dirty -all: image +push: + @echo "There are unstaged changes in the repository, refusing push" + @false +else +# The repository is clean, allow pushing images after building them. push: image - git diff --quiet && \ - docker push $(IMAGE_NAME):$(IMAGE_TAG) + @docker push $(IMAGE_NAME):$(IMAGE_TAG) +endif image: $(IMAGE_SOURCES) - docker build $(IMAGE_PATH) -t $(IMAGE_NAME):$(IMAGE_TAG)$(IMAGE_STATUS) \ No newline at end of file + @docker build $(IMAGE_PATH) -t $(IMAGE_NAME):$(IMAGE_TAG) \ No newline at end of file