Patrick Williams | b8fecba | 2021-02-11 14:33:23 -0600 | [diff] [blame] | 1 | #!/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 | |
| 11 | docker image ls \ |
| 12 | "openbmc/ubuntu-unit-test*" \ |
| 13 | --format "{{.Repository}}:{{.Tag}}" | |
| 14 | grep -v "$(date '+%Y-W%V')" | xargs -r docker image rm || true |