#!/usr/bin/env python3 import re from dxf import DXF from os import environ REPO = 'mattermost/mattermost-enterprise-edition' dxf = DXF('registry-1.docker.io', REPO) dxf.authenticate(actions=["pull"]) tags = dxf.list_aliases() tags = [tag for tag in tags if re.match( r"^\d+\.\d+\.\d+$", tag) and int(tag.split('.')[0]) >= 8] try: local_dxf = DXF(environ['CI_REGISTRY'], environ['CI_PROJECT_PATH']) local_dxf.authenticate( environ['CI_REGISTRY_USER'], environ['CI_REGISTRY_PASSWORD'], actions=["pull"]) local_tags = local_dxf.list_aliases() except: local_tags = [] update_tags = set(tags) - set(local_tags) update_tags.add('latest') print(' '.join(update_tags))