Skip to content

Conversation

@gyutaeb
Copy link
Contributor

@gyutaeb gyutaeb commented Jan 12, 2026

Summary

Extend the existing docker workflow to push images to GitHub Container Registry (ghcr.io/libbpf/bpftool) when a new tag is pushed or when changes are merged to main.

Behavior

Event Action
Pull Request Build and test locally (no push)
Push to main branch Build multi-arch and push with main tag
Version tag (v1.0.0) Build and push with version tag

Test

  • Tested workflow on forked repository (github.com/gyutaeb/bpftool)

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR extends the Docker workflow to publish bpftool container images to GitHub Container Registry (GHCR) when version tags are pushed or changes are merged to the main branch. It adds multi-architecture support (amd64/arm64) and build caching while preserving the existing PR testing workflow.

Changes:

  • Add trigger for version tags and configure GHCR publishing on push events
  • Add multi-architecture build support with Docker Buildx and QEMU
  • Add build caching using GitHub Actions cache for improved build performance

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated 4 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated 2 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@gyutaeb
Copy link
Contributor Author

gyutaeb commented Jan 13, 2026

@qmonnet
Thanks for review! I've added conditions to always build the test image for PRs, and to run multi-arch builds only on releases. I have also addressed all review comments.

Copy link
Member

@qmonnet qmonnet left a comment

Choose a reason for hiding this comment

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

Well I triggered a review from Copilot to see if it would catch anything interesting, but I haven't done my own review yet 😅

It looks good overall, but given that we don't reuse any step between the two cases (testing for PR vs. pushing a new image), why not make them separate jobs? It would avoid keeping the conditions for github.event_name being a PR at every step. (The linter is shared but it's small enough that we can duplicate it; we probably don't need it for pushing images by the way, especially because it runs after the image is built and pushed). What do you think?

Extend the existing docker workflow to push images to GitHub Container
Registry (ghcr.io/libbpf/bpftool) when a new tag is pushed or when
changes are merged to main.

- Add trigger for version tags (v*.*.*)
- Add GHCR login and push steps
- Add multi-arch build support (linux/amd64, linux/arm64)
- Add build caching using GitHub Actions cache
- Add automatic latest tag management with semantic version comparison
- Split workflow into separate jobs for testing (PR) and publishing (release)

Link: libbpf#232
Signed-off-by: Gyutae Bae <gyutae.bae@navercorp.com>
@gyutaeb gyutaeb force-pushed the feature-publishing-image branch from cb04af6 to 8fa08a7 Compare January 14, 2026 01:46
Copy link
Member

@qmonnet qmonnet left a comment

Choose a reason for hiding this comment

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

Looks good, thank you!

Do I need to set up anything for ghcr.io before the workflow runs, or will it automatically create the new image repository on the first run?

@gyutaeb
Copy link
Contributor Author

gyutaeb commented Jan 15, 2026

Looks good, thank you!

Do I need to set up anything for ghcr.io before the workflow runs, or will it automatically create the new image repository on the first run?

@qmonnet
No additional configuration is required! Merging this PR acts as a push to the main branch, so it will trigger a build for the bpftool:main image. Later, when a new version(e.g., v7.7.0) is released, the workflow will automatically build and push both the v7.7.0 and latest tags.

@qmonnet
Copy link
Member

qmonnet commented Jan 15, 2026

OK thank you let's merge it then 👍

@qmonnet qmonnet merged commit 1cb60a5 into libbpf:main Jan 15, 2026
4 checks passed
@gyutaeb
Copy link
Contributor Author

gyutaeb commented Jan 15, 2026

@qmonnet
Thank you! I will keep an eye on the workflow.
https://github.com/libbpf/bpftool/actions/runs/21025852702

@qmonnet
Copy link
Member

qmonnet commented Jan 15, 2026

Thanks!

I ticked the box to have packages show up on the home page of the repo.

One question, do you know what is the unknown/unknown arch image that is generated along with arm64 and amd64?

image

@gyutaeb
Copy link
Contributor Author

gyutaeb commented Jan 15, 2026

@qmonnet
it looks like the GHCR package is set to private.

❯ docker pull ghcr.io/libbpf/bpftool:main
Error response from daemon: {"message":"unable to retrieve auth token: invalid username/password: unauthorized"}
  • Solution:
    • Go to https://github.com/orgs/libbpf/packages
    • Click on the bpftool package
    • Click "Package settings" on the right side
    • In the "Danger Zone" section, select "Change package visibility" → Public

@gyutaeb
Copy link
Contributor Author

gyutaeb commented Jan 15, 2026

Thanks!

I ticked the box to have packages show up on the home page of the repo.

One question, do you know what is the unknown/unknown arch image that is generated along with arm64 and amd64?

@qmonnet
When Docker Buildx builds multi-platform images, it automatically generates the attestations by default.
This attestation data has no OS/architecture information, so it appears as unknown/unknown.

It doesn't affect functionality, but if you want to remove it for a cleaner look, I can disable attestations in the workflow:

- name: Build and push Docker image
  uses: docker/build-push-action@v6
  with:
    # ... existing settings ...
    provenance: false
    sbom: false

@qmonnet
Copy link
Member

qmonnet commented Jan 15, 2026

it looks like the GHCR package is set to private.

Good catch, thank you. I don't have sufficient permissions in the libbpf organisation to make it public myself, let me ping someone who can.

it automatically generates the attestations by default.

Oh right, got it thanks! No problem, let's keep them.

@qmonnet
Copy link
Member

qmonnet commented Jan 15, 2026

Daniel changed the setting, it's visible now 🎉

@gyutaeb
Copy link
Contributor Author

gyutaeb commented Jan 16, 2026

@qmonnet
Double-checked. Looks good!

❯ docker pull ghcr.io/libbpf/bpftool:main
0ec3d8645767: Already exists
08781c4af5f3: Download complete
a594ec760d2d: Download complete
951fe14e4e63: Download complete
ghcr.io/libbpf/bpftool:main

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.

[Feature Request] Automate publishing official Docker images to GHCR

2 participants