mirror of
https://github.com/tiennm99/goclaw.git
synced 2026-10-14 06:17:41 +00:00
* fix(build): embed commit SHA for release provenance (#1571 part 2) Docker builds exclude .git via .dockerignore, so buildvcs cannot read VCS metadata and published images carry no commit information. A running image cannot be lined up with the source commit it was built from. Embed cmd.CommitSHA at link time (maintainer-endorsed option 2) and surface it in goclaw version output: - cmd: add CommitSHA var, print commit in version cmd when injected - Makefile: pass git rev-parse HEAD via LDFLAGS - Dockerfile: accept COMMIT_SHA build arg (default unknown) - docker-compose.yml: pass GOCLAW_COMMIT_SHA through as build arg - release workflows: inject github.sha into release and dev-beta builds Backward compatible: binaries built without the flag keep the existing version output format. * fix(build): pass COMMIT_SHA to docker image builds, surface it in doctor/upgrade Review follow-up for PR #1590: - Add COMMIT_SHA=${{ github.sha }} to the build-args of every docker/build-push-action step (release.yaml, dev-beta-release.yaml, release-beta.yaml, fork-image.yaml) so published images — the artifact issue #1571 is about — carry the commit, not just release tarball binaries. - Surface the commit in doctor and upgrade output (App version line) via a shared commitSuffix() helper, so operators can read provenance from logs without exec'ing goclaw version (review suggestion #2). - version cmd refactored onto the same helper; output unchanged.
This commit is contained in:
1 parent
3f90057c24
commit
52ced3710f
10 files changed
+32
-9
No files matched your search
@@ -149,7 +149,7 @@ jobs:
|
||||
VERSION: ${{ needs.beta_version.outputs.tag }}
|
||||
run: |
|
||||
CGO_ENABLED=0 go build -tags embedui \
|
||||
-ldflags="-s -w -X github.com/nextlevelbuilder/goclaw/cmd.Version=${VERSION}" \
|
||||
-ldflags="-s -w -X github.com/nextlevelbuilder/goclaw/cmd.Version=${VERSION} -X github.com/nextlevelbuilder/goclaw/cmd.CommitSHA=${{ github.sha }}" \
|
||||
-o goclaw .
|
||||
tar -czf "goclaw-${VERSION}-linux-amd64.tar.gz" goclaw migrations/ skills/
|
||||
|
||||
@@ -197,7 +197,7 @@ jobs:
|
||||
VERSION: ${{ needs.beta_version.outputs.tag }}
|
||||
run: |
|
||||
CGO_ENABLED=0 go build -tags embedui \
|
||||
-ldflags="-s -w -X github.com/nextlevelbuilder/goclaw/cmd.Version=${VERSION}" \
|
||||
-ldflags="-s -w -X github.com/nextlevelbuilder/goclaw/cmd.Version=${VERSION} -X github.com/nextlevelbuilder/goclaw/cmd.CommitSHA=${{ github.sha }}" \
|
||||
-o goclaw .
|
||||
tar -czf "goclaw-${VERSION}-${{ matrix.goos }}-${{ matrix.goarch }}.tar.gz" goclaw migrations/ skills/
|
||||
|
||||
@@ -352,6 +352,7 @@ jobs:
|
||||
ENABLE_FULL_SKILLS=${{ matrix.enable_full_skills }}
|
||||
ENABLE_MEDIA_PROBES=${{ matrix.enable_media_probes }}
|
||||
VERSION=${{ needs.beta_version.outputs.tag }}
|
||||
COMMIT_SHA=${{ github.sha }}
|
||||
cache-from: type=gha,scope=dev-beta-${{ matrix.variant }}
|
||||
cache-to: type=gha,mode=max,scope=dev-beta-${{ matrix.variant }}
|
||||
|
||||
|
||||
@@ -49,5 +49,6 @@ jobs:
|
||||
ENABLE_OTEL=false
|
||||
ENABLE_FULL_SKILLS=false
|
||||
VERSION=fork-dev
|
||||
COMMIT_SHA=${{ github.sha }}
|
||||
cache-from: type=gha
|
||||
cache-to: type=gha,mode=max
|
||||
@@ -153,5 +153,6 @@ jobs:
|
||||
ENABLE_FULL_SKILLS=${{ matrix.enable_full_skills }}
|
||||
ENABLE_MEDIA_PROBES=${{ matrix.enable_media_probes }}
|
||||
VERSION=${{ github.ref_name }}
|
||||
COMMIT_SHA=${{ github.sha }}
|
||||
cache-from: type=gha,scope=beta-${{ matrix.variant }}
|
||||
cache-to: type=gha,mode=max,scope=beta-${{ matrix.variant }}
|
||||
@@ -104,7 +104,7 @@ jobs:
|
||||
VERSION: v${{ needs.release.outputs.version }}
|
||||
run: |
|
||||
CGO_ENABLED=0 go build -tags embedui \
|
||||
-ldflags="-s -w -X github.com/nextlevelbuilder/goclaw/cmd.Version=${VERSION}" \
|
||||
-ldflags="-s -w -X github.com/nextlevelbuilder/goclaw/cmd.Version=${VERSION} -X github.com/nextlevelbuilder/goclaw/cmd.CommitSHA=${{ github.sha }}" \
|
||||
-o goclaw .
|
||||
tar -czf "goclaw-${{ needs.release.outputs.version }}-${{ matrix.goos }}-${{ matrix.goarch }}.tar.gz" goclaw migrations/ skills/
|
||||
|
||||
@@ -228,6 +228,7 @@ jobs:
|
||||
ENABLE_FULL_SKILLS=${{ matrix.enable_full_skills }}
|
||||
ENABLE_MEDIA_PROBES=${{ matrix.enable_media_probes }}
|
||||
VERSION=v${{ needs.release.outputs.version }}
|
||||
COMMIT_SHA=${{ github.sha }}
|
||||
cache-from: type=gha,scope=release-${{ matrix.variant }}
|
||||
cache-to: type=gha,mode=max,scope=release-${{ matrix.variant }}
|
||||
provenance: false
|
||||
|
||||
Reference in new issue
Block a user