Skip to content

Commit 0f2b10d

Browse files
Luis Sanchezryjones
authored andcommitted
[FAB-6021] do not delete release images
- `make docker-clean` will delete images tagged as: $(ARCH)-$(BASE_VERSION)-snapshot-* - release images are only deleted when IS_RELEASE = true (and then only for the current release) notes: - snapshots for other base versions are not deleted - latest tags must be managed 'manually' if you are keeping multiple base versions around. - `make docker-tag-latest` provided for convenience Change-Id: Idc65dcfc59da5f1d30ec09da225ed072a77fc8d0 Signed-off-by: Luis Sanchez <sanchezl@us.ibm.com>
1 parent fb60186 commit 0f2b10d

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

Makefile

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
# - enable_ci_only_tests - triggers unit-tests in downstream jobs. Applicable only for CI not to
4040
# use in the local machine.
4141
# - docker-thirdparty - pulls thirdparty images (kafka,zookeeper,couchdb)
42+
# - docker-tag-latest - re-tags the images made by 'make docker' with the :latest tag
4243
# - help-docs - generate the command reference docs
4344

4445
BASE_VERSION = 1.2.0
@@ -406,11 +407,17 @@ docker-list: $(patsubst %,%-docker-list, $(IMAGES))
406407

407408
%-docker-clean:
408409
$(eval TARGET = ${patsubst %-docker-clean,%,${@}})
409-
-docker images -q $(DOCKER_NS)/fabric-$(TARGET) | xargs -I '{}' docker rmi -f '{}'
410-
-@rm -rf $(BUILD_DIR)/image/$(TARGET)
410+
-docker images --quiet --filter=reference='$(DOCKER_NS)/fabric-$(TARGET):$(ARCH)-$(BASE_VERSION)$(if $(EXTRA_VERSION),-snapshot-*,)' | xargs docker rmi -f
411+
-@rm -rf $(BUILD_DIR)/image/$(TARGET) ||:
411412

412413
docker-clean: $(patsubst %,%-docker-clean, $(IMAGES))
413414

415+
docker-tag-latest: $(IMAGES:%=%-docker-tag-latest)
416+
417+
%-docker-tag-latest:
418+
$(eval TARGET = ${patsubst %-docker-tag-latest,%,${@}})
419+
docker tag $(DOCKER_NS)/fabric-$(TARGET):$(DOCKER_TAG) $(DOCKER_NS)/fabric-$(TARGET):latest
420+
414421
.PHONY: clean
415422
clean: docker-clean unit-test-clean release-clean
416423
-@rm -rf $(BUILD_DIR)

0 commit comments

Comments
 (0)