From 6c689a84dd3479ebb630e7045f4e54a427a47cc7 Mon Sep 17 00:00:00 2001 From: Ian Campbell Date: Wed, 26 Jul 2017 10:42:39 +0100 Subject: [PATCH] pkg: Add forcepush target This is like the `push` target but omits the pulls and depends on forcetag instead. With the git commit now being embedded into the image this is now a necessary part of rebasing a PR for which images have already been pushed. Also adds PHONY targets for existing forcetag and push targets which were missing. NB $(error) appends a "." to omit the final one from the error message Signed-off-by: Ian Campbell --- pkg/package.mk | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/pkg/package.mk b/pkg/package.mk index 72592319b..7f0d7ba9d 100644 --- a/pkg/package.mk +++ b/pkg/package.mk @@ -1,4 +1,4 @@ -.PHONY: image tag show-tag +.PHONY: image tag forcetag show-tag check-dirty push forcepush default: push ORG?=linuxkit @@ -55,12 +55,21 @@ tag: $(BASE_DEPS) $(DEPS) forcetag: $(BASE_DEPS) $(DEPS) docker build $(LABELS) $(NET_OPT) -t $(TAG) $(SOURCE) -push: tag +check-dirty: ifneq ($(DIRTY),) - $(error Your repository is not clean. Will not push package image.) + $(error Your repository is not clean. Will not push package image) endif + +push: check-dirty tag docker pull $(TAG) || docker push $(TAG) ifneq ($(RELEASE),) docker tag $(TAG) $(ORG)/$(IMAGE):$(RELEASE) docker push $(ORG)/$(IMAGE):$(RELEASE) endif + +forcepush: check-dirty forcetag + docker push $(TAG) +ifneq ($(RELEASE),) + docker tag $(TAG) $(ORG)/$(IMAGE):$(RELEASE) + docker push $(ORG)/$(IMAGE):$(RELEASE) +endif