blob: 696dee672b1c1d26880faa5922822861bbfe6316 [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 \
12 "openbmc/ubuntu-unit-test*" \
13 --format "{{.Repository}}:{{.Tag}}" |
14 grep -v "$(date '+%Y-W%V')" | xargs -r docker image rm || true