38 lines
806 B
Python
38 lines
806 B
Python
#!/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))
|
|
|
|
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)
|
|
|
|
print("""\
|
|
include: '/gci-templates/.gitlab-ci.yml'
|
|
|
|
|
|
stages:
|
|
- build
|
|
""")
|
|
|
|
for tag in update_tags:
|
|
print(f"""\
|
|
build-{tag}:
|
|
stage: build
|
|
extends: .kaniko
|
|
variables:
|
|
VERSION: {tag}
|
|
""")
|