0
0
Fork 0
mirror of https://github.com/netdata/netdata.git synced 2025-04-26 13:54:48 +00:00

Push Docker images to registries individually.

Because docker/build-push-action can't handle the case of pushing to
multiple registries by digest.
This commit is contained in:
Austin S. Hemmelgarn 2024-03-05 10:03:14 -05:00
parent 149719ca8c
commit 935ffce114
No known key found for this signature in database
GPG key ID: 4138B50D9B8289C6
2 changed files with 21 additions and 12 deletions

View file

@ -1,11 +0,0 @@
#!/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')

View file

@ -146,6 +146,7 @@ jobs:
- name: Docker Hub Login
id: docker-hub-login
if: github.repository == 'netdata/netdata' && needs.file-check.outputs.run == 'true' && github.event_name == 'workflow_dispatch'
continue-on-error: true
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
@ -153,6 +154,7 @@ jobs:
# - name: GitHub Container Registry Login
# id: ghcr-login
# if: github.repository == 'netdata/netdata' && needs.file-check.outputs.run == 'true' && github.event_name == 'workflow_dispatch'
# continue-on-error: true
# uses: docker/login-action@v3
# with:
# registry: ghcr.io
@ -161,6 +163,7 @@ jobs:
- name: Quay.io Login
id: quay-login
if: github.repository == 'netdata/netdata' && needs.file-check.outputs.run == 'true' && github.event_name == 'workflow_dispatch'
continue-on-error: true
uses: docker/login-action@v3
with:
registry: quay.io
@ -173,12 +176,27 @@ jobs:
with:
platforms: ${{ matrix.platform }}
tags: ${{ needs.gen-tags.outputs.tags }}
load: true
build-args: OFFICIAL_IMAGE=${{ env.OFFICIAL_IMAGE }}
outputs: ${{ steps.gen-config.outputs.output-config }}
- name: Test Image
id: test
if: needs.file-check.outputs.run == 'true' && matrix.platform == 'linux/amd64'
run: .github/scripts/docker-test.sh
- name: Push to Docker Hub
id: push-docker-hub
if: github.repository == 'netdata/netdata' && needs.file-check.outputs.run == 'true' && github.event_name == 'workflow_dispatch' && steps.docker-hub-login.outcome == 'success'
continue-on-error: true
run: docker image push 'netdata/netdata@${{ steps.build.outputs.digest }}'
# - name: Push to GitHub Container Registry
# id: push-ghcr
# if: github.repository == 'netdata/netdata' && needs.file-check.outputs.run == 'true' && github.event_name == 'workflow_dispatch' && steps.docker-hub-login.outcome == 'success'
# continue-on-error: true
# run: docker image push 'netdata/netdata@${{ steps.build.outputs.digest }}'
- name: Push to Quay.io
id: push-quay
if: github.repository == 'netdata/netdata' && needs.file-check.outputs.run == 'true' && github.event_name == 'workflow_dispatch' && steps.docker-hub-login.outcome == 'success'
continue-on-error: true
run: docker image push 'quay.io/netdata/netdata@${{ steps.build.outputs.digest }}'
- name: Export Digest
id: export-digest
if: github.repository == 'netdata/netdata' && needs.file-check.outputs.run == 'true' && github.event_name == 'workflow_dispatch'
@ -214,6 +232,8 @@ jobs:
Login to Quay: ${{ steps.quay-login.outcome }}
Build image: ${{ steps.build.outcome }}
Test image: ${{ steps.test.outcome }}
Push to Docker Hub: ${{ steps.push-docker-hub.outcome }}
Push to Quay: ${{ steps.push-quay.outcome }}
Export digest: ${{ steps.export-digest.outcome }}
Upload digest: ${{ steps.upload-digest.outcome }}
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_URL }}