blob: 6c8cd5a2420804f1626302f667b190cb52d7685e [file] [log] [blame]
Patrick Williamsb8fecba2021-02-11 14:33:23 -06001#!/bin/bash -e
2
3# Removes docker images created by 'build-unit-test-docker' which are older
4# than the current week.
5# - Images start with 'openbmc/ubuntu-unit-test'.
6# - Image tags contain YYYY-Www where:
7# * YYYY is the 4 digit year. (date format %Y)
8# * W is the literal 'W'
9# * ww is the two digit ISO week. (date format %V)
10
11docker image ls \
Patrick Williams476a7e92022-12-06 09:52:53 -060012 "openbmc/ubuntu-unit-test*" \
13 --format "{{.Repository}}:{{.Tag}}" |
14grep -v "$(date '+%Y-W%V')" | xargs -r docker image rm || true