File tree Expand file tree Collapse file tree 2 files changed +16
-9
lines changed Expand file tree Collapse file tree 2 files changed +16
-9
lines changed Original file line number Diff line number Diff line change @@ -17,8 +17,8 @@ BUILDTAGS += $(EXTRA_BUILDTAGS)
1717
1818COMMIT := $(shell git describe --dirty --long --always)
1919EXTRA_VERSION :=
20- VERSION := $( shell cat ./VERSION)$( EXTRA_VERSION )
21- LDFLAGS_COMMON := -X main.gitCommit= $( COMMIT ) -X main.version =$(VERSION )
20+ LDFLAGS_COMMON := -X main.gitCommit= $( COMMIT ) \
21+ $( if $( strip $( EXTRA_VERSION ) ) , -X main.extraVersion =$(EXTRA_VERSION ) , )
2222
2323GOARCH := $(shell $(GO ) env GOARCH)
2424
@@ -118,11 +118,11 @@ release: runcimage
118118 --rm -v $(CURDIR ) :/go/src/$(PROJECT ) \
119119 -e RELEASE_ARGS=$(RELEASE_ARGS ) \
120120 $(RUNC_IMAGE ) make localrelease
121- script/release_sign.sh -S $(GPG_KEYID ) -r release/ $( VERSION ) -v $( VERSION )
121+ script/release_sign.sh -S $(GPG_KEYID )
122122
123123.PHONY : localrelease
124124localrelease : verify-changelog
125- script/release_build.sh -r release/ $( VERSION ) -v $( VERSION ) $(RELEASE_ARGS )
125+ script/release_build.sh $(RELEASE_ARGS )
126126
127127.PHONY : dbuild
128128dbuild : runcimage
Original file line number Diff line number Diff line change 11package main
22
33import (
4+ _ "embed"
45 "errors"
56 "fmt"
67 "io"
@@ -19,12 +20,18 @@ import (
1920 "github.com/urfave/cli"
2021)
2122
22- // version must be set from the contents of VERSION file by go build's
23- // -X main.version= option in the Makefile.
24- var version = "unknown"
23+ // version is set from the contents of VERSION file.
24+ //
25+ //go:embed VERSION
26+ var version string
27+
28+ // extraVersion is an optional suffix appended to runc version.
29+ // It can be set via Makefile ("make EXTRA_VERSION=xxx") or by
30+ // adding -X main.extraVersion=xxx option to the go build command.
31+ var extraVersion = ""
2532
2633// gitCommit will be the hash that the binary was built from
27- // and will be populated by the Makefile
34+ // and will be populated by the Makefile.
2835var gitCommit = ""
2936
3037func printVersion (c * cli.Context ) {
@@ -73,7 +80,7 @@ value for "bundle" is the current directory.`
7380func main () {
7481 app := cli .NewApp ()
7582 app .Name = "runc"
76- app .Version = version
83+ app .Version = strings . TrimSpace ( version ) + extraVersion
7784 app .Usage = usage
7885
7986 cli .VersionPrinter = printVersion
You can’t perform that action at this time.
0 commit comments