diff options
author | Austin S. Hemmelgarn <austin@netdata.cloud> | 2024-03-05 08:49:58 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-03-05 08:49:58 -0500 |
commit | cac652e384f04a4ceda611a6ec187d6c8ef49ab9 (patch) | |
tree | ffd6713c4091d3d8574a7ea7b838f7104295592c /.github/scripts | |
parent | a0e176013a740590d9556cac5c30d64a7b4f437d (diff) |
Rework Docker CI to build each platform in it's own runner. (#17088)
* Rework Docker CI to build each platform in it's own runner.
* Remove bogus conditional in publish step.
Diffstat (limited to '.github/scripts')
-rwxr-xr-x | .github/scripts/gen-docker-build-output.py | 11 | ||||
-rwxr-xr-x | .github/scripts/gen-docker-imagetool-args.py | 27 | ||||
-rwxr-xr-x | .github/scripts/gen-docker-tags.py | 35 |
3 files changed, 63 insertions, 10 deletions
diff --git a/.github/scripts/gen-docker-build-output.py b/.github/scripts/gen-docker-build-output.py new file mode 100755 index 0000000000..e6cc2afc94 --- /dev/null +++ b/.github/scripts/gen-docker-build-output.py @@ -0,0 +1,11 @@ +#!/usr/bin/env python3 + +import sys + +event = sys.argv[1] + +match event: + case 'workflow_dispatch': + print('type=image,push=true,push-by-digest=true,name-canonical=true') + case _: + print('type=docker') diff --git a/.github/scripts/gen-docker-imagetool-args.py b/.github/scripts/gen-docker-imagetool-args.py new file mode 100755 index 0000000000..c0eaa1cfca --- /dev/null +++ b/.github/scripts/gen-docker-imagetool-args.py @@ -0,0 +1,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)}') diff --git a/.github/scripts/gen-docker-tags.py b/.github/scripts/gen-docker-tags.py index 8c88d3b5e6..1c393638a4 100755 --- a/.github/scripts/gen-docker-tags.py +++ b/.github/scripts/gen-docker-tags.py @@ -2,18 +2,33 @@ import sys -version = sys.argv[1].split('.') -suffix = sys.argv[2] +github_event = sys.argv[1] +version = sys.argv[2] -REPO = f'netdata/netdata{suffix}' -GHCR = f'ghcr.io/{REPO}' -QUAY = f'quay.io/{REPO}' +REPO = 'netdata/netdata-ci-test' -tags = [] +REPOS = ( + REPO, + # f'ghcr.io/{REPO}', + f'quay.io/{REPO}', +) -for repo in [REPO, GHCR, QUAY]: - tags.append(':'.join([repo, version[0]])) - tags.append(':'.join([repo, '.'.join(version[0:2])])) - tags.append(':'.join([repo, '.'.join(version[0:3])])) +match version: + case '': + tags = (f'{REPO}:test',) + case 'nightly': + tags = tuple([ + f'{r}:{t}' for r in REPOS for t in ('edge', 'latest') + ]) + case _: + v = f'v{version}'.split('.') + + tags = tuple([ + f'{r}:{t}' for r in REPOS for t in ( + v[0], + '.'.join(v[0:2]), + '.'.join(v[0:3]), + ) + ]) print(','.join(tags)) |