Skip to content

Commit

Permalink
Add BaseVersion metadata
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
ghaskins committed Feb 17, 2017
1 parent d4b5649 commit c583115
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
7 changes: 6 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,17 @@ PROJECT_VERSION=$(BASE_VERSION)
endif

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

# defined in common/metadata/metadata.go
METADATA_VAR = Version=$(PROJECT_VERSION)
METADATA_VAR += BaseVersion=$(BASEIMAGE_RELEASE)

GO_LDFLAGS = $(patsubst %,-X $(PKGNAME)/common/metadata.%,$(METADATA_VAR))

CHAINTOOL_URL ?= https://github.com/hyperledger/fabric-chaintool/releases/download/$(CHAINTOOL_RELEASE)/chaintool

export GO_LDFLAGS
Expand Down
4 changes: 3 additions & 1 deletion common/metadata/metadata.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,6 @@ limitations under the License.

package metadata

var Version string // defined by the Makefile and passed in with ldflags
// Variables defined by the Makefile and passed in with ldflags
var Version string
var BaseVersion string
3 changes: 2 additions & 1 deletion core/container/util/dockerutil.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,8 @@ func getArch() string {
func parseDockerfileTemplate(template string) string {
r := strings.NewReplacer(
"$(ARCH)", getArch(),
"$(PROJECT_VERSION)", metadata.Version)
"$(PROJECT_VERSION)", metadata.Version,
"$(BASE_VERSION)", metadata.BaseVersion)

return r.Replace(template)
}
Expand Down

0 comments on commit c583115

Please sign in to comment.