Skip to content

Commit c583115

Browse files
committed
Add BaseVersion metadata
This will make it possible to refer to our hyperledger/fabric-base* series of images from the configuration file. We will exploit this later in the series to support using baseos/basejvm as a minimal container. Change-Id: Ic43ecf17c669f8965793471f8f6f3c2d56210d46 Signed-off-by: Greg Haskins <[email protected]>
1 parent d4b5649 commit c583115

File tree

3 files changed

+11
-3
lines changed

3 files changed

+11
-3
lines changed

Makefile

+6-1
Original file line numberDiff line numberDiff line change
@@ -45,12 +45,17 @@ PROJECT_VERSION=$(BASE_VERSION)
4545
endif
4646

4747
PKGNAME = github.com/$(PROJECT_NAME)
48-
GO_LDFLAGS = -X $(PKGNAME)/common/metadata.Version=$(PROJECT_VERSION)
4948
CGO_FLAGS = CGO_CFLAGS=" "
5049
ARCH=$(shell uname -m)
5150
CHAINTOOL_RELEASE=v0.10.2
5251
BASEIMAGE_RELEASE=$(shell cat ./.baseimage-release)
5352

53+
# defined in common/metadata/metadata.go
54+
METADATA_VAR = Version=$(PROJECT_VERSION)
55+
METADATA_VAR += BaseVersion=$(BASEIMAGE_RELEASE)
56+
57+
GO_LDFLAGS = $(patsubst %,-X $(PKGNAME)/common/metadata.%,$(METADATA_VAR))
58+
5459
CHAINTOOL_URL ?= https://github.com/hyperledger/fabric-chaintool/releases/download/$(CHAINTOOL_RELEASE)/chaintool
5560

5661
export GO_LDFLAGS

common/metadata/metadata.go

+3-1
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,6 @@ limitations under the License.
1616

1717
package metadata
1818

19-
var Version string // defined by the Makefile and passed in with ldflags
19+
// Variables defined by the Makefile and passed in with ldflags
20+
var Version string
21+
var BaseVersion string

core/container/util/dockerutil.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,8 @@ func getArch() string {
5858
func parseDockerfileTemplate(template string) string {
5959
r := strings.NewReplacer(
6060
"$(ARCH)", getArch(),
61-
"$(PROJECT_VERSION)", metadata.Version)
61+
"$(PROJECT_VERSION)", metadata.Version,
62+
"$(BASE_VERSION)", metadata.BaseVersion)
6263

6364
return r.Replace(template)
6465
}

0 commit comments

Comments
 (0)