Skip to content

ci: use docker github builder to build the image - #1544

Merged
crazy-max merged 3 commits into
masterfrom
docker-github-builder
Nov 16, 2026
Merged

crazy-max merged 3 commits into
masterfrom
docker-github-builder

Conversation

@crazy-max

Copy link
Copy Markdown
Owner

@crazy-max

Copy link
Copy Markdown
Owner Author

https://github.com/crazy-max/diun/actions/runs/19333611496/job/55303090837#step:8:560


#38 [linux/amd64 build 1/1] RUN --mount=type=bind,target=.     --mount=type=bind,from=version,source=/tmp/.version,target=/tmp/.version     --mount=type=cache,target=/root/.cache     --mount=type=cache,target=/go/pkg/mod <<EOT (set -ex...)
#38 0.111 + cat /tmp/.version
#38 0.113 + xx-go build -trimpath -ldflags '-s -w -X main.version=8f3d03f' -o /usr/bin/diun ./cmd
#38 ...

Seems git context doesn't fetch full history so versioning is broken.

Before when using path context and @action/checkout with fetch-depth: 0:

-
name: Checkout
uses: actions/checkout@v5
with:
fetch-depth: 0

We had: https://github.com/crazy-max/diun/actions/runs/19331978878/job/55297510739#step:8:596

#40 [linux/amd64->ppc64le build 1/1] RUN --mount=type=bind,target=.     --mount=type=bind,from=version,source=/tmp/.version,target=/tmp/.version     --mount=type=cache,target=/root/.cache     --mount=type=cache,target=/go/pkg/mod <<EOT (set -ex...)
#40 0.098 + cat /tmp/.version
#40 0.102 + xx-go build -trimpath -ldflags '-s -w -X main.version=v4.30.0-30-g42da408e' -o /usr/bin/diun ./cmd
#40 ...

@tonistiigi I wonder if we could have a new query param for git context to set fetch-depth similar to @action/checkout:

@crazy-max
crazy-max force-pushed the docker-github-builder branch 4 times, most recently from 0d90992 to cc98112 Compare November 16, 2025 10:36
@crazy-max
crazy-max force-pushed the docker-github-builder branch 5 times, most recently from 3615b57 to 5934dfb Compare December 1, 2025 11:12
@crazy-max
crazy-max marked this pull request as ready for review December 1, 2025 12:09
@crazy-max
crazy-max marked this pull request as draft December 19, 2025 08:08
@crazy-max
crazy-max force-pushed the docker-github-builder branch 9 times, most recently from b12dce7 to d2e7da2 Compare March 18, 2026 12:14
@crazy-max
crazy-max force-pushed the docker-github-builder branch from d2e7da2 to c73c27c Compare October 15, 2026 14:23
Comment thread .github/workflows/build.yml Fixed
Comment thread .github/workflows/build.yml Fixed
@crazy-max
crazy-max force-pushed the docker-github-builder branch from c73c27c to 07d80d2 Compare October 15, 2026 14:28
@crazy-max
crazy-max force-pushed the docker-github-builder branch 2 times, most recently from 63d9096 to a0db50b Compare October 15, 2026 15:00
@crazy-max
crazy-max force-pushed the docker-github-builder branch 2 times, most recently from e7276e5 to ed3d31b Compare November 16, 2026 08:42
@crazy-max

Copy link
Copy Markdown
Owner Author

Found a workaround for this: keep .git in the Git context with BUILDKIT_CONTEXT_KEEP_GIT_DIR=1, then use a writable bind mount in the version stage to run git fetch --unshallow --tags origin before git describe.

This restores the tag-based version without needing actions/checkout or a separate named context. The fetched history is discarded after the RUN; only /tmp/.version is kept. The version step now needs network access when it runs, and remote tag changes won't invalidate an already cached result.

@crazy-max
crazy-max marked this pull request as ready for review November 16, 2026 08:44
@crazy-max
crazy-max force-pushed the docker-github-builder branch from ed3d31b to 40fd562 Compare November 16, 2026 08:52
@crazy-max
crazy-max force-pushed the docker-github-builder branch from 40fd562 to 785a5a6 Compare November 16, 2026 08:58
@crazy-max
crazy-max merged commit 82063cd into master Nov 16, 2026
68 checks passed
@crazy-max
crazy-max deleted the docker-github-builder branch November 16, 2026 09:13
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