diff --git a/tagging/images_hierarchy.py b/tagging/images_hierarchy.py index 4154c9d8..5c7f696b 100644 --- a/tagging/images_hierarchy.py +++ b/tagging/images_hierarchy.py @@ -5,6 +5,7 @@ from typing import Optional, List from .taggers import ( TaggerInterface, SHATagger, + DateTagger, UbuntuVersionTagger, PythonVersionTagger, JupyterNotebookVersionTagger, @@ -39,6 +40,7 @@ ALL_IMAGES = { parent_image=None, taggers=[ SHATagger, + DateTagger, UbuntuVersionTagger, PythonVersionTagger, JupyterNotebookVersionTagger, diff --git a/tagging/taggers.py b/tagging/taggers.py index ceea21e1..ee7e6f02 100644 --- a/tagging/taggers.py +++ b/tagging/taggers.py @@ -1,5 +1,6 @@ # Copyright (c) Jupyter Development Team. # Distributed under the terms of the Modified BSD License. +from datetime import datetime import logging from .git_helper import GitHelper from .docker_runner import DockerRunner @@ -50,6 +51,12 @@ class SHATagger(TaggerInterface): return GitHelper.commit_hash_tag() +class DateTagger(TaggerInterface): + @staticmethod + def tag_value(container) -> str: + return datetime.utcnow().strftime("%Y-%m-%d") + + class UbuntuVersionTagger(TaggerInterface): @staticmethod def tag_value(container) -> str: