Fix publishing Docker Images to secondary registries. (#14389)
Austin S. Hemmelgarn committed
Jan 31, 2023 at 10:40 UTC
89500eb54402058461ef5cc8f4a0a58fc2ed20bc
2 files changed
+22
-8
.github/scripts/gen-docker-tags.py
+9
-4
@@ -6,9 +6,14 @@ version = sys.argv[1].split('.')
6
suffix = sys.argv[2]
7
8
REPO = f'netdata/netdata{suffix}'
9
+GHCR = f'ghcr.io/{REPO}'
10
+QUAY = f'quay.io/{REPO}'
11
10
-MAJOR = ':'.join([REPO, version[0]])
11
-MINOR = ':'.join([REPO, '.'.join(version[0:2])])
12
-PATCH = ':'.join([REPO, '.'.join(version[0:3])])
12
+tags = []
13
14
-print(','.join([MAJOR, MINOR, PATCH]))
14
+for repo in [REPO, GHCR, QUAY]:
15
+ tags.append(':'.join([repo, version[0]]))
16
+ tags.append(':'.join([repo, '.'.join(version[0:2])]))
17
+ tags.append(':'.join([repo, '.'.join(version[0:3])]))
18
+
19
+print(','.join(tags))
.github/workflows/docker.yml
+13
-4
@@ -151,13 +151,13 @@ jobs:
151
id: release-tags
152
if: github.event.inputs.version != 'nightly'
153
run: |
154
- echo "tags=netdata/netdata:latest,netdata/netdata:stable,$(.github/scripts/gen-docker-tags.py ${{ needs.normalize-tag.outputs.tag }} '')" \
154
+ echo "tags=netdata/netdata:latest,netdata/netdata:stable,ghcr.io/netdata/netdata:latest,ghcr.io/netdata/netdata:stable,quay.io/netdata/netdata:latest,quay.io/netdata/netdata:stable,$(.github/scripts/gen-docker-tags.py ${{ needs.normalize-tag.outputs.tag }} '')" \
155
>> "${GITHUB_ENV}"
156
- name: Determine which tags to use
157
id: nightly-tags
158
if: github.event.inputs.version == 'nightly'
159
run: |
160
- echo "tags=netdata/netdata:latest,netdata/netdata:edge" >> "${GITHUB_ENV}"
160
+ echo "tags=netdata/netdata:latest,netdata/netdata:edge,ghcr.io/netdata/netdata:latest,ghcr.io/netdata/netdata:edge,quay.io/netdata/netdata:latest,quay.io/netdata/netdata:edge" >> "${GITHUB_ENV}"
161
- name: Mark image as official
162
id: env
163
if: github.repository == 'netdata/netdata'
@@ -254,13 +254,13 @@ jobs:
254
id: release-tags
255
if: github.event.inputs.version != 'nightly'
256
run: |
257
- echo "tags=netdata/netdata-debug:latest,netdata/netdata-debug:stable,$(.github/scripts/gen-docker-tags.py ${{ needs.normalize-tag.outputs.tag }} '-debug')" \
257
+ echo "tags=netdata/netdata:latest,netdata/netdata:stable,ghcr.io/netdata/netdata:latest,ghcr.io/netdata/netdata:stable,quay.io/netdata/netdata:latest,quay.io/netdata/netdata:stable,$(.github/scripts/gen-docker-tags.py ${{ needs.normalize-tag.outputs.tag }} '')" \
258
>> "${GITHUB_ENV}"
259
- name: Determine which tags to use
260
id: nightly-tags
261
if: github.event.inputs.version == 'nightly'
262
run: |
263
- echo "tags=netdata/netdata-debug:latest,netdata/netdata-debug:edge" >> "${GITHUB_ENV}"
263
+ echo "tags=netdata/netdata:latest,netdata/netdata:edge,ghcr.io/netdata/netdata:latest,ghcr.io/netdata/netdata:edge,quay.io/netdata/netdata:latest,quay.io/netdata/netdata:edge" >> "${GITHUB_ENV}"
264
- name: Mark image as official
265
id: env
266
if: github.repository == 'netdata/netdata'
@@ -286,6 +286,14 @@ jobs:
286
registry: ghcr.io
287
username: ${{ github.repository_owner }}
288
password: ${{ secrets.GITHUB_TOKEN }}
289
+ - name: Quay.io Login
290
+ id: quay-login
291
+ if: github.repository == 'netdata/netdata'
292
+ uses: docker/login-action@v2
293
+ with:
294
+ registry: quay.io
295
+ username: ${{ secrets.NETDATABOT_QUAY_USERNAME }}
296
+ password: ${{ secrets.NETDATABOT_QUAY_TOKEN }}
297
- name: Docker Build
298
id: build
299
uses: docker/build-push-action@v3
@@ -314,6 +322,7 @@ jobs:
322
Setup buildx: ${{ steps.buildx.outcome }}
323
Login to DockerHub: ${{ steps.docker-hub-login.outcome }}
324
Login to GHCR: ${{ steps.ghcr-login.outcome }}
325
+ Login to Quay: ${{ steps.quay-login.outcome }}
326
Build and publish images: ${{ steps.build.outcome }}
327
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_URL }}
328
if: >-