Skip to content

Commit

Permalink
Merge pull request #549 from thaJeztah/fix_scan_cli_version
Browse files Browse the repository at this point in the history
rpm: scan-cli-plugin: fix build-time "version" and "commit" variables
  • Loading branch information
fredericdalleau authored Jun 2, 2021
2 parents f00ec07 + 20c5fee commit 3f7664e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
5 changes: 4 additions & 1 deletion rpm/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ GEN_RPM_VER=$(shell ./gen-rpm-ver $(realpath $(CURDIR)/../src/github.com/docker/
GEN_SCAN_RPM_VER=$(shell ./gen-rpm-ver $(realpath $(CURDIR)/../src/github.com/docker/scan-cli-plugin) "$(DOCKER_SCAN_REF)")
CLI_GITCOMMIT?=$(shell cd $(realpath $(CURDIR)/../src/github.com/docker/cli) && git rev-parse --short HEAD)
ENGINE_GITCOMMIT?=$(shell cd $(realpath $(CURDIR)/../src/github.com/docker/docker) && git rev-parse --short HEAD)
SCAN_GITCOMMIT?=$(shell cd $(realpath $(CURDIR)/../src/github.com/docker/scan-cli-plugin) && git rev-parse --short HEAD)

ifdef BUILD_IMAGE
BUILD_IMAGE_FLAG=--build-arg $(BUILD_IMAGE)
Expand All @@ -33,7 +34,9 @@ RPMBUILD_FLAGS?=-ba\
--define '_release $(word 2,$(GEN_RPM_VER))' \
--define '_version $(word 1,$(GEN_RPM_VER))' \
--define '_origversion $(word 4, $(GEN_RPM_VER))' \
--define '_scan_version $(word 1,$(GEN_SCAN_RPM_VER))' \
--define '_scan_rpm_version $(word 1,$(GEN_SCAN_RPM_VER))' \
--define '_scan_version $(word 4,$(GEN_SCAN_RPM_VER))' \
--define '_scan_gitcommit $(SCAN_GITCOMMIT)' \
$(RPMBUILD_EXTRA_FLAGS) \
$(SPECS)

Expand Down
4 changes: 2 additions & 2 deletions rpm/SPECS/docker-scan-plugin.spec
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
%global debug_package %{nil}

Name: docker-scan-plugin
Version: %{_scan_version}
Version: %{_scan_rpm_version}
Release: %{_release}%{?dist}
Epoch: 0
Source0: scan-cli-plugin.tgz
Expand All @@ -26,7 +26,7 @@ Docker Scan plugin for the Docker CLI.

%build
pushd ${RPM_BUILD_DIR}/src/scan-cli-plugin
bash -c 'GOPROXY="https://proxy.golang.org" PLATFORM_BINARY=docker-scan make native-build'
bash -c 'GOPROXY="https://proxy.golang.org" TAG_NAME="%{_scan_version}" COMMIT="%{_scan_gitcommit}" PLATFORM_BINARY=docker-scan make native-build'
popd


Expand Down

0 comments on commit 3f7664e

Please sign in to comment.