Skip to content

Conversation

ricky-undeadcoders
Copy link
Contributor

@ricky-undeadcoders ricky-undeadcoders commented Sep 24, 2025

This pull request introduces three new composite actions that (together) perform multi-arch docker builds using Grafana's self-hosted runners:

  • docker-build-push-image: Intended to replace build-push-to-dockerhub and push-to-gar-docker, this handles building and pushing Docker images to both Google Artifact Registry and DockerHub. The action is highly configurable, supports multi-arch builds, and is designed to be extensible for additional registries.
  • docker-export-digest: For Docker multi-arch builds, exports a Docker image digest as a job artifact.
  • docker-import-digests-push-manifest: For Docker multi-arch builds, imports Docker digests from the previous action, and composes and pushes a manifest.

Related to #1348.
Part of https://github.com/grafana/deployment_tools/issues/320068

Copy link
Contributor

@zerok zerok left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great! Just a couple of small issues.

echo "buildkitd-config=${buildkitd_config}" | tee -a "${GITHUB_OUTPUT}"

- name: Set up QEMU
uses: docker/setup-qemu-action@29109295f81e9208d7d86ff1c6c12d2833863392 # v3.6.0
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this perhaps only be done if multiple platforms are specified?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So, I thought yes initially, but in the instance where someone is running on x64 and building only linux/arm64, we would need QEMU and not have it... right? In that case we'd have to configure this with a little more logic, and since this QEMU action takes very little time to run... I didn't figure it was worth the effort.

delete_credentials_file: false

- name: Login to DockerHub
if: ${{ inputs.push == 'true' }}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it be enough to run this only if one of the target images is actually on dockerhub? Same for Login to GAR.

Copy link
Contributor Author

@ricky-undeadcoders ricky-undeadcoders Oct 2, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would. I actually made the choice not to include it because we allow registry to be passed in for both GAR and DockerHub images.... so I coudn't figure out how we'd reliably calculate which registries we're pushing to in the case we get a custom registry name.

The other idea I had was to have registries as an input.... but given we have images already as an input that can be pushed to their registries, I didn't like the idea of including an extra input.

Now that I read up on it though... it doesn't seem like DockerHub can have any registry name other than docker.io... so maybe we don't even need that input and could key off of an image list having docker.io as the reason to login to dockerhub.

Copy link
Contributor

@dsotirakis dsotirakis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

first pass, looks really promising 🙇

steps:
- name: Build Docker Image
id: build
uses: grafana/shared-workflows/actions/docker-build-push-image@main # TODO: Fix version once released
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you can set an arbitrary v0.0.0 version here and it'll be bumped to v0.0.1 upon first release.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Something like this?

uses: grafana/shared-workflows/actions/docker-import-digests-push-manifest@docker-import-digests-push-manifest/v0.0.0

@ricky-undeadcoders ricky-undeadcoders self-assigned this Oct 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants