Skip to content

fix(docker): stamp release image metadata#224

Merged
SantiagoDePolonia merged 1 commit into
mainfrom
chore/tag-version-at-docker
Apr 11, 2026
Merged

fix(docker): stamp release image metadata#224
SantiagoDePolonia merged 1 commit into
mainfrom
chore/tag-version-at-docker

Conversation

@SantiagoDePolonia

@SantiagoDePolonia SantiagoDePolonia commented Apr 11, 2026

Copy link
Copy Markdown
Contributor

Summary

  • pass VERSION, COMMIT, and DATE build args into Docker image builds
  • derive release Docker metadata from the pushed tag, GitHub SHA, and UTC build time

Verification

  • go test ./cmd/gomodel ./internal/version
  • docker build --build-arg VERSION=0.1.15 --build-arg COMMIT=824a135e93b650e87d24e7bae3045dc3abdfe39f --build-arg DATE=2026-04-11T13:46:26Z -t gomodel:metadata-test .
  • docker run --rm gomodel:metadata-test -version

Summary by CodeRabbit

  • Chores
    • Docker images now include version, commit hash, and build date information in the compiled binary for improved traceability during deployment and debugging.
    • Build pipeline enhanced to automatically compute and include metadata with each image release.

@coderabbitai

coderabbitai Bot commented Apr 11, 2026

Copy link
Copy Markdown
Contributor

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 261cc53c-f5cc-4952-9bc2-d0dd5546d5a2

📥 Commits

Reviewing files that changed from the base of the PR and between 824a135 and dcdb1e2.

📒 Files selected for processing (2)
  • .github/workflows/release.yml
  • Dockerfile

📝 Walkthrough

Walkthrough

The changes introduce build metadata injection into the Docker image build process. A new GitHub Actions workflow step computes version, commit SHA, and UTC timestamp from the git tag and environment, then passes these values to the Docker build via build arguments, which injects them into the compiled binary through linker flags.

Changes

Cohort / File(s) Summary
Workflow Build Metadata
.github/workflows/release.yml
Added Set build metadata step that extracts version from tag name, current commit SHA, and timestamp, exporting them as outputs for subsequent Docker build invocation.
Binary Version Injection
Dockerfile
Added VERSION, COMMIT, and DATE build arguments (with defaults: dev, none, unknown) and injected them into the compiled binary via -ldflags -X flags targeting gomodel/internal/version package variables.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Poem

🐰 A version, a commit, a timestamp too,
Now baked into binaries, fresh and new,
Metadata flows from workflow to build,
With ldflags our binary's now filled,
Tracking the changes, we hop with delight! 🏷️

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: adding version metadata stamping to Docker release images through build arguments and ldflags injection.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch chore/tag-version-at-docker

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 and usage tips.

@SantiagoDePolonia SantiagoDePolonia merged commit 9aabfe6 into main Apr 11, 2026
16 checks passed
@SantiagoDePolonia SantiagoDePolonia deleted the chore/tag-version-at-docker branch April 25, 2026 11:57
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.

1 participant