Skip to content

Conversation

@bestbeforetoday
Copy link
Member

Instead of relying on QEMU emulation to build multi-arch images, use native arm64 and amd64 build runners to build architecture-specific images, then publish multi-arch metadata with each of the image manifests.

@bestbeforetoday bestbeforetoday requested a review from a team as a code owner March 17, 2025 21:28
@bestbeforetoday bestbeforetoday enabled auto-merge (squash) March 17, 2025 21:28
strategy:
fail-fast: false
matrix:
registry: ${{ fromJSON(github.repository_owner == 'hyperledger' && '["docker.io", "ghcr.io"]' || '["ghcr.io"]') }}
Copy link
Contributor

Choose a reason for hiding this comment

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

In the Fabric release action, I did a dynamic matrix for the registry like this. But I did it for both the metadata job and the docker build job, and I kept digests for each registry in the temp directory. This PR uses the dynamic matrix for the metadata job only. I guess it is acceptable to do a single docker build job with outputs for each registry? The digest will be the same for both registries? Just want to make sure you have tested this for both registries. If this checks out that is good, I will modify the Fabric release job to behave the same to avoid the duplicate builds.

Copy link
Member Author

Choose a reason for hiding this comment

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

I am so glad you queried this. I tested it but only with the GHCR publish because of the guards for hyperledger as the repository owner. I took out the guards and tried publishing to both GHCR and Docker Hub, and saw a parse error on the image name. I have now quoted the image name parameter and simultaneous publishing to both GHCR and Docker Hub works. I left it without guards to force future testing to include both.

The digests of the amd64 and arm64 images are identical in both GHCR and Docker Hub. I think with the image epoch generated from the commit timestamp you should be able to produce images with the same hash over multiple builds anyway. This approach just means each image is only built once before being pushed to both registries.

Copy link
Contributor

Choose a reason for hiding this comment

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

ok, good to know! I'll look at a similar update for fabric repository.

I didn't quite get "I left it without guards to force future testing to include both." Could you clarify what you mean? What is the best way to test in the future?

Copy link
Member Author

@bestbeforetoday bestbeforetoday Mar 19, 2025

Choose a reason for hiding this comment

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

The current change publishes to both GHCR and Docker Hub. There is no guard to only publish to Docker Hub if the repo owner is hyperledger so the behaviour is the same for forks and the main repo. For example, this run on my fork

@bestbeforetoday bestbeforetoday force-pushed the native-docker branch 3 times, most recently from e701798 to 7ba91c8 Compare March 18, 2025 21:19
Instead of relying on QEMU emulation to build multi-arch images, use
native arm64 and amd64 build runners to build architecture-specific
images, then publish multi-arch metadata with each of the image
manifests.

Signed-off-by: Mark S. Lewis <Mark.S.Lewis@outlook.com>
@sonarqubecloud
Copy link

Copy link
Contributor

@denyeart denyeart left a comment

Choose a reason for hiding this comment

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

Thanks for explaining Mark!

@bestbeforetoday bestbeforetoday merged commit 8fb3168 into hyperledger:main Mar 22, 2025
10 checks passed
@bestbeforetoday bestbeforetoday deleted the native-docker branch March 22, 2025 23:30
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.

2 participants