Skip to content

ci(hubble): stamp org.opencontainers.image.revision on the image - #29

Merged
imbajin merged 1 commit into
hugegraph:masterfrom
bitflicker64:fix/hubble-image-revision-label
Sep 3, 2026
Merged

ci(hubble): stamp org.opencontainers.image.revision on the image#29
imbajin merged 1 commit into
hugegraph:masterfrom
bitflicker64:fix/hubble-image-revision-label

Conversation

@bitflicker64

@bitflicker64 bitflicker64 commented Sep 2, 2026

Copy link
Copy Markdown
Member

Purpose

hugegraph/hubble:latest carries no org.opencontainers.image.revision label, so a running Hubble container cannot be tied to the apache/hugegraph-toolchain commit it was built from. The other three images in a HugeGraph deployment can.

Labels read from the image configs on Docker Hub on 2026-09-02:

Image org.opencontainers.image.revision org.opencontainers.image.source
hugegraph/pd:latest 98477f0f56a3ad49593ec7632f2f0ee13e72f0dd https://github.com/apache/hugegraph
hugegraph/store:latest 98477f0f56a3ad49593ec7632f2f0ee13e72f0dd https://github.com/apache/hugegraph
hugegraph/server:latest 98477f0f56a3ad49593ec7632f2f0ee13e72f0dd https://github.com/apache/hugegraph
hugegraph/hubble:latest absent absent

Hubble's only label is org.opencontainers.image.version=22.04, inherited from the base image.

This matters beyond tidiness. Hubble publishes on its own nightly cron (0 23 * * * in publish_latest_hubble_image.yml) against apache/hugegraph-toolchain@master, while pd/store/server publish separately against apache/hugegraph@master. Hubble can therefore lag the other three by more than a day, and there is nothing on the image that says so. Deployment test reports that record image digests have to write "Hubble: no revision label" in every table.

What the pd/store/server path does

_publish_image_reusable.yml already resolves the source commit. Its prepare job runs git ls-remote and publishes source_sha:

source_sha="$(git ls-remote "$source_url" "refs/heads/${SOURCE_REF}" | awk 'NR == 1 { print $1 }')"
...
checkout_ref="$source_sha"

The publish job then uses that value only as actions/checkout's ref. Nothing carries it into the image, because none of the four docker/build-push-action steps passes a labels: input.

The pd/store/server path stamps the same value explicitly. In _publish_pd_store_server_reusable.yml on the topling-runtime-variant branch (open as #28), the serial build passes:

--label "org.opencontainers.image.source=${SOURCE_URL}"
--label "org.opencontainers.image.revision=${SOURCE_SHA}"

and the Bake path passes the same two values through --set:

--set "*.labels.org.opencontainers.image.source=${SOURCE_URL}"
--set "*.labels.org.opencontainers.image.revision=${SOURCE_SHA}"

with SOURCE_URL: https://github.com/${{ inputs.source_repository }} and SOURCE_SHA from the prepare job. Those lines are what put the labels on the pd/store/server images currently on Docker Hub, since the recent publishes of those three were manual runs from that branch. The master copy of the pd/store/server workflow does not stamp them yet, so this change and #28 arrive at the same behaviour from the two sides.

Both publish paths resolve the source SHA, only the pd/store/server one puts it on the image

Main changes

.github/workflows/_publish_image_reusable.yml

  • The publish job gains one env entry that builds the label list from values it already has:
    env:
      IMAGE_LABELS: |
        org.opencontainers.image.revision=${{ needs.prepare.outputs.source_sha }}
        org.opencontainers.image.source=https://github.com/${{ inputs.source_repository }}
  • All four docker/build-push-action steps gain labels: ${{ env.IMAGE_LABELS }} next to their existing tags:. The two smoke-test builds are included so the image that is tested and the image that is pushed carry identical metadata.

README.md

  • One bullet added to the _publish_image_reusable.yml responsibility list.

No input, tag, cache, platform or gating behaviour changes. Labels are image config metadata, so no layer is rebuilt and the registry caches stay valid. tests/test_publish_prepare.sh passes unchanged.

The other wrappers that call this reusable workflow (publish_latest_loader_image.yml, publish_latest_ai_image.yml, publish_latest_vermeer_image.yml) gain the two labels as well. That is deliberate: every image this workflow publishes becomes traceable by the same rule.

How to verify

An image built from this branch would carry, for the current apache/hugegraph-toolchain@master:

org.opencontainers.image.revision  451abb1e489049b723de1c2be80c14aeb16fe2e0
org.opencontainers.image.source    https://github.com/apache/hugegraph-toolchain
  • Dispatch "Publish hubble image(latest)" from this branch with publish: false. The rendered labels input is printed in the "Build and push image with mvn args" step log, and the resolved SHA is in the prepare job output.
  • After the next published run, check the pushed image without pulling it:
docker buildx imagetools inspect --format '{{json .Image.Config.Labels}}' hugegraph/hubble:latest
  • Or, on a pulled image:
docker inspect --format '{{index .Config.Labels "org.opencontainers.image.revision"}}' hugegraph/hubble:latest

The value must equal the apache/hugegraph-toolchain commit the run checked out, the same way hugegraph/pd:latest reports its apache/hugegraph commit today.

Related

Summary by CodeRabbit

  • 新功能

    • 发布的容器镜像现在包含源提交版本和源代码仓库信息标签。
    • 该标签配置已应用于正式构建和 Smoke Test 构建。
  • 文档

    • 更新 README,说明容器镜像新增的元数据标签。

The pd/store/server publish path passes the resolved source SHA to the
build as --label org.opencontainers.image.revision (and the matching
--set "*.labels...." for the Bake path), so hugegraph/pd:latest,
hugegraph/store:latest and hugegraph/server:latest can be traced back to
the apache/hugegraph commit they were built from.

The standard image path resolves the same SHA in its prepare job and uses
it only as the checkout ref, so hugegraph/hubble:latest carries no
org.opencontainers.image.revision label and a running Hubble container
cannot be tied to a hugegraph-toolchain commit. Hubble is built on its own
nightly schedule, so it can also lag the other three images with nothing
on the image to show it.

Pass the resolved SHA and the source repository URL to
docker/build-push-action as labels, which brings hubble in line with
pd/store/server. Every other wrapper that calls this reusable
workflow gains the same two labels.
Copilot AI lite review requested due to automatic review settings September 2, 2026 20:23

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟢 Approval recommended

The workflow changes are minimal, consistent across all build steps, and correctly derive labels from already-validated/used inputs and outputs.

Pull request overview

This PR updates the shared image publishing reusable workflow so all images it builds (including smoke-test builds) are stamped with OCI provenance metadata, making hugegraph/hubble:latest traceable back to the exact apache/hugegraph-toolchain commit it was built from.

Changes:

  • Define a job-level IMAGE_LABELS env var that includes org.opencontainers.image.revision (resolved source_sha) and org.opencontainers.image.source (GitHub repo URL).
  • Pass labels: ${{ env.IMAGE_LABELS }} into all docker/build-push-action build steps (smoke-test and publish).
  • Document the added responsibility in README.md.
File summaries
File Description
README.md Documents that the standard reusable publisher stamps OCI revision and source labels.
.github/workflows/_publish_image_reusable.yml Adds a shared label block and applies it consistently to all build/push steps.
Review details
  • Files reviewed: 2/2 changed files
  • Comments generated: 0
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@coderabbitai

coderabbitai Bot commented Sep 2, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Team

Run ID: a8f0e92f-7d87-48ae-8a15-18d10bc824e9

📥 Commits

Reviewing files that changed from the base of the PR and between ab87d13 and 9cbfd7c.

📒 Files selected for processing (2)
  • .github/workflows/_publish_image_reusable.yml
  • README.md

Included review availability: Your plan provides up to 1 included review per hour; 0 remain after this review.


Walkthrough

发布工作流新增 IMAGE_LABELS 环境变量。该变量包含镜像源提交和源仓库信息,并应用于四个 Docker 构建步骤。README.md 更新了对应说明。

Changes

OCI 镜像标签

Layer / File(s) Summary
配置镜像标签
.github/workflows/_publish_image_reusable.yml, README.md
发布作业生成 org.opencontainers.image.revisionorg.opencontainers.image.source 标签,并将标签应用于带或不带 Maven 参数的 smoke test 和正式镜像构建。README.md 记录该行为。

Estimated code review effort: 1 (简单) | ~5 分钟

Merge Risk: ⚪ Minimal · up to 9cbfd

The change adds source and revision metadata to images without altering build inputs, tags, caching, platforms, or gating behavior; no actionable merge-blocking risk remains after normal checks and review.

Suggested reviewers: imbajin

Poem

小兔给镜像贴标签,
提交来源写得明白。
四次构建都不漏,
smoke 与正式并排跑。
README 也把路径说明白。

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed 标题明确描述了主要变更:在 Hubble 镜像上添加 org.opencontainers.image.revision OCI 标签。该描述与工作流更新一致。标题未提及 org.opencontainers.image.source,但无需涵盖所有细节。
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 0…
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Full details: Docstring Coverage

Explanation

No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 0 files. (2 skipped: 2 unsupported.)

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@imbajin imbajin left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM. The resolved source SHA and repository are applied consistently to all build paths, restoring image-level provenance without changing publication semantics.

@imbajin
imbajin merged commit 9d0bb92 into hugegraph:master Sep 3, 2026
1 check passed
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