summaryrefslogtreecommitdiffstats
path: root/.github/scripts/gen-docker-imagetool-args.py
blob: c0eaa1cfcaee3941ea3af919b21d46801bb065f6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#!/usr/bin/env python3

import sys

from pathlib import Path

DIGEST_PATH = Path(sys.argv[1])
TAG_PREFIX = sys.argv[2]
TAGS = sys.argv[3]

if TAG_PREFIX:
    PUSH_TAGS = tuple([
        t for t in TAGS.split(',') if t.startswith(TAG_PREFIX)
    ])
else:
    PUSH_TAGS = tuple([
        t for t in TAGS.split(',') if t.startswith('netdata/')
    ])

IMAGE_NAME = PUSH_TAGS[0].split(':')[0]

images = []

for f in DIGEST_PATH.glob('*'):
    images.append(f'{IMAGE_NAME}@sha256:{f.name}')

print(f'-t {" -t ".join(PUSH_TAGS)} {" ".join(images)}')