Skip to content

Commit 87179a6

Browse files
authored
Merge pull request #750 from thaJeztah/rpm_fix_buildx_vars
[master] buildx: fix missing git-commit in version
2 parents dac1ad3 + ce1da79 commit 87179a6

File tree

4 files changed

+20
-2
lines changed

4 files changed

+20
-2
lines changed

deb/Makefile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ GO_IMAGE?=$(GO_BASE_IMAGE):$(GO_VERSION)-buster
99
GEN_DEB_VER=$(shell ./gen-deb-ver $(realpath $(CURDIR)/../src/github.com/docker/cli) "$(VERSION)")
1010
EPOCH?=5
1111
SCAN_GITCOMMIT?=$(shell cd $(realpath $(CURDIR)/../src/github.com/docker/scan-cli-plugin) && git rev-parse --short HEAD)
12+
BUILDX_GITCOMMIT?=$(shell cd $(realpath $(CURDIR)/../src/github.com/docker/buildx) && git rev-parse --short HEAD)
1213

1314
ifdef BUILD_IMAGE
1415
BUILD_IMAGE_FLAG=--build-arg $(BUILD_IMAGE)
@@ -34,6 +35,7 @@ RUN?=docker run --rm \
3435
-e CLI_GITCOMMIT=$(CLI_GITCOMMIT) \
3536
-e ENGINE_GITCOMMIT=$(ENGINE_GITCOMMIT) \
3637
-e BUILDX_VERSION=$(DOCKER_BUILDX_REF) \
38+
-e BUILDX_GITCOMMIT=$(BUILDX_GITCOMMIT) \
3739
-e COMPOSE_VERSION=$(DOCKER_COMPOSE_REF) \
3840
-e SCAN_VERSION=$(DOCKER_SCAN_REF) \
3941
-e SCAN_GITCOMMIT=$(SCAN_GITCOMMIT) \

deb/common/rules

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,14 @@ override_dh_auto_build:
1919
# Build buildx plugin
2020
cd /go/src/github.com/docker/buildx \
2121
&& mkdir -p /usr/libexec/docker/cli-plugins/ \
22-
&& CGO_ENABLED=0 GO111MODULE=on go build -mod=vendor -o /usr/libexec/docker/cli-plugins/docker-buildx -ldflags "-X github.com/docker/buildx/version.Version=$(BUILDX_VERSION) -X github.com/docker/buildx/version.Revision=$(git rev-parse HEAD) -X github.com/docker/buildx/version.Package=github.com/docker/buildx" ./cmd/buildx
22+
&& GO111MODULE=on \
23+
CGO_ENABLED=0 \
24+
go build \
25+
-mod=vendor \
26+
-trimpath \
27+
-ldflags "-X github.com/docker/buildx/version.Version=$(BUILDX_VERSION) -X github.com/docker/buildx/version.Revision=$(BUILDX_GITCOMMIT) -X github.com/docker/buildx/version.Package=github.com/docker/buildx" \
28+
-o "/usr/libexec/docker/cli-plugins/docker-buildx" \
29+
./cmd/buildx
2330

2431
# Build the compose plugin
2532
cd /go/src/github.com/docker/compose \

rpm/Makefile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ GEN_SCAN_RPM_VER=$(shell ./gen-rpm-ver $(realpath $(CURDIR)/../src/github.com/do
1010
CLI_GITCOMMIT?=$(shell cd $(realpath $(CURDIR)/../src/github.com/docker/cli) && git rev-parse --short HEAD)
1111
ENGINE_GITCOMMIT?=$(shell cd $(realpath $(CURDIR)/../src/github.com/docker/docker) && git rev-parse --short HEAD)
1212
SCAN_GITCOMMIT?=$(shell cd $(realpath $(CURDIR)/../src/github.com/docker/scan-cli-plugin) && git rev-parse --short HEAD)
13+
BUILDX_GITCOMMIT?=$(shell cd $(realpath $(CURDIR)/../src/github.com/docker/buildx) && git rev-parse --short HEAD)
1314

1415
ifdef BUILD_IMAGE
1516
BUILD_IMAGE_FLAG=--build-arg $(BUILD_IMAGE)
@@ -38,6 +39,7 @@ RPMBUILD_FLAGS?=-ba\
3839
--define '_origversion $(word 4, $(GEN_RPM_VER))' \
3940
--define '_buildx_rpm_version $(word 1,$(GEN_BUILDX_RPM_VER))' \
4041
--define '_buildx_version $(word 4,$(GEN_BUILDX_RPM_VER))' \
42+
--define '_buildx_gitcommit $(BUILDX_GITCOMMIT)' \
4143
--define '_compose_rpm_version $(word 1,$(GEN_COMPOSE_RPM_VER))' \
4244
--define '_compose_version $(word 4,$(GEN_COMPOSE_RPM_VER))' \
4345
--define '_scan_rpm_version $(word 1,$(GEN_SCAN_RPM_VER))' \

rpm/SPECS/docker-buildx-plugin.spec

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,14 @@ Docker Buildx plugin for the Docker CLI.
2222

2323
%build
2424
pushd ${RPM_BUILD_DIR}/src/buildx
25-
bash -c 'CGO_ENABLED=0 GO111MODULE=on go build -mod=vendor -o bin/docker-buildx -ldflags "-X github.com/docker/buildx/version.Version=%{_buildx_version} -X github.com/docker/buildx/version.Revision=%{_buildx_gitcommit} -X github.com/docker/buildx/version.Package=github.com/docker/buildx" ./cmd/buildx'
25+
GO111MODULE=on \
26+
CGO_ENABLED=0 \
27+
go build \
28+
-mod=vendor \
29+
-trimpath \
30+
-ldflags="-X github.com/docker/buildx/version.Version=%{_buildx_version} -X github.com/docker/buildx/version.Revision=%{_buildx_gitcommit} -X github.com/docker/buildx/version.Package=github.com/docker/buildx" \
31+
-o "bin/docker-buildx" \
32+
./cmd/buildx
2633
popd
2734

2835
%check

0 commit comments

Comments
 (0)