Skip to content

Commit

Permalink
Add a Submariner image pruning command
Browse files Browse the repository at this point in the history
This defines

    make prune-images

which prunes all Submariner-provided images, ensuring that the next
deployment will pull or build all the images it needs.

Signed-off-by: Stephen Kitt <[email protected]>
  • Loading branch information
skitt committed Jan 5, 2021
1 parent bc5f97e commit dc1cf00
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 0 deletions.
14 changes: 14 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,20 @@ images: package/.image.shipyard-dapper-base
.DEFAULT_GOAL := lint
# Shipyard-specific ends

# This removes all Submariner-provided images and all untagged images
# Use this to ensure you use current images
prune-images:
docker images | grep -E '(admiral|lighthouse|nettest|shipyard|submariner|<none>)' | while read image tag hash _; do \
if [ "$$tag" != "<none>" ]; then \
docker rmi $$image:$$tag; \
else \
docker rmi $$hash; \
fi \
done

NON_DAPPER_GOALS += prune-images
.PHONY: prune-images

include Makefile.dapper

endif
13 changes: 13 additions & 0 deletions Makefile.inc
Original file line number Diff line number Diff line change
Expand Up @@ -90,3 +90,16 @@ endif

CODEOWNERS: CODEOWNERS.in
$(SCRIPTS_DIR)/gen-codeowners

# This removes all Submariner-provided images and all untagged images
# Use this to ensure you use current images
# Copied from Makefile to provide this everywhere (until we can share
# non-Dapper goals across projects)
prune-images:
docker images | grep -E '(admiral|lighthouse|nettest|shipyard|submariner|<none>)' | while read image tag hash _; do \
if [ "$$tag" != "<none>" ]; then \
docker rmi $$image:$$tag; \
else \
docker rmi $$hash; \
fi \
done

0 comments on commit dc1cf00

Please sign in to comment.