diff --git a/endpoints/api/repository_models_interface.py b/endpoints/api/repository_models_interface.py index ac54769d7..2d5088942 100644 --- a/endpoints/api/repository_models_interface.py +++ b/endpoints/api/repository_models_interface.py @@ -151,13 +151,14 @@ class Release( class Tag( namedtuple('Tag', [ 'name', 'image_docker_image_id', 'image_aggregate_size', 'lifetime_start_ts', - 'tag_manifest_digest' + 'tag_manifest_digest', 'lifetime_end_ts', ])): """ :type name: string :type image_docker_image_id: string :type image_aggregate_size: int :type lifetime_start_ts: int + :type lifetime_end_ts: int|None :type tag_manifest_digest: string """ @@ -173,6 +174,10 @@ class Tag( last_modified = format_date(datetime.fromtimestamp(self.lifetime_start_ts)) tag_info['last_modified'] = last_modified + if self.lifetime_end_ts: + expiration = format_date(datetime.fromtimestamp(self.lifetime_end_ts)) + tag_info['expiration'] = expiration + if self.tag_manifest_digest is not None: tag_info['manifest_digest'] = self.tag_manifest_digest diff --git a/endpoints/api/repository_models_pre_oci.py b/endpoints/api/repository_models_pre_oci.py index d25ef432d..16a76bbc2 100644 --- a/endpoints/api/repository_models_pre_oci.py +++ b/endpoints/api/repository_models_pre_oci.py @@ -159,7 +159,7 @@ class PreOCIModel(RepositoryDataInterface): return ImageRepositoryRepository(base, [ Tag(tag.name, tag.image.docker_image_id, tag.image.aggregate_size, tag.lifetime_start_ts, - tag.tagmanifest.digest) for tag in tags + tag.tagmanifest.digest, tag.lifetime_end_ts) for tag in tags ], [Count(count.date, count.count) for count in counts], repo.badge_token, repo.trust_enabled)