File tree Expand file tree Collapse file tree 1 file changed +10
-4
lines changed Expand file tree Collapse file tree 1 file changed +10
-4
lines changed Original file line number Diff line number Diff line change @@ -68,10 +68,16 @@ ENV GOFLAGS=-mod=vendor
68
68
# scan the version/revision info
69
69
FROM buildkit-base AS buildkit-version
70
70
# TODO: PKG should be inferred from go modules
71
- RUN --mount=target=. \
72
- PKG=github.com/moby/buildkit VERSION=$(git describe --match 'v[0-9]*' --dirty='.m' --always --tags) REVISION=$(git rev-parse HEAD)$(if ! git diff --no-ext-diff --quiet --exit-code; then echo .m; fi); \
73
- echo "-X ${PKG}/version.Version=${VERSION} -X ${PKG}/version.Revision=${REVISION} -X ${PKG}/version.Package=${PKG}" | tee /tmp/.ldflags; \
74
- echo -n "${VERSION}" | tee /tmp/.version;
71
+ RUN --mount=target=. <<'EOT'
72
+ git rev-parse HEAD 2>/dev/null || {
73
+ echo >&2 "Failed to get git revision, make sure --build-arg BUILDKIT_CONTEXT_KEEP_GIT_DIR=1 is set when building from Git directly"
74
+ exit 1
75
+ }
76
+ set -ex
77
+ export PKG=github.com/moby/buildkit VERSION=$(git describe --match 'v[0-9]*' --dirty='.m' --always --tags) REVISION=$(git rev-parse HEAD)$(if ! git diff --no-ext-diff --quiet --exit-code; then echo .m; fi);
78
+ echo "-X ${PKG}/version.Version=${VERSION} -X ${PKG}/version.Revision=${REVISION} -X ${PKG}/version.Package=${PKG}" > /tmp/.ldflags;
79
+ echo -n "${VERSION}" > /tmp/.version;
80
+ EOT
75
81
76
82
# build buildctl binary
77
83
FROM buildkit-base AS buildctl
You can’t perform that action at this time.
0 commit comments