From 507dfdad6bcb3818c0c65870a7f0cc03fe7c59d5 Mon Sep 17 00:00:00 2001 From: Ian Wienand Date: Wed, 29 Mar 2023 15:04:37 +1100 Subject: [PATCH] remove-registry-tag: update docker age match Update this match to be a little shorter and use datetimes more directly. Change-Id: I2012091a16b5b5ddb522a5e5ac6976c4f4c580af --- roles/remove-registry-tag/tasks/docker.yaml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/roles/remove-registry-tag/tasks/docker.yaml b/roles/remove-registry-tag/tasks/docker.yaml index 7fc31bef4..6bb1a24bf 100644 --- a/roles/remove-registry-tag/tasks/docker.yaml +++ b/roles/remove-registry-tag/tasks/docker.yaml @@ -36,8 +36,7 @@ _to_delete: '{{ _to_delete|default([]) + [zj_docker_tag] }}' when: - zj_docker_tag.name is regex(remove_registry_tag_regex) - # Was updated > 24 hours ago: - - "((ansible_date_time.iso8601 | regex_replace('^(....-..-..)T(..:..:..).*Z', '\\\\1 \\\\2') | to_datetime) - (zj_docker_tag.last_updated | regex_replace('^(....-..-..)T(..:..:..).*Z', '\\\\1 \\\\2') | to_datetime)).seconds > remove_registry_tag_age" + - (now() - (zj_docker_tag.last_updated | to_datetime('%Y-%m-%dT%H:%M:%S.%fZ')).seconds > remove_registry_tag_age - name: List tags to remove debug: