VOL-2126 - update version information in dockerfile
Change-Id: I8ae4f097184286c2cc8c5a2bb0e4d86335a83090
diff --git a/cmd/simulated_onu/main.go b/cmd/simulated_onu/main.go
index caa29c0..cbcf44f 100644
--- a/cmd/simulated_onu/main.go
+++ b/cmd/simulated_onu/main.go
@@ -329,6 +329,11 @@
cf := config.NewAdapterFlags()
cf.ParseCommandArguments()
+ if cf.PrintVersion {
+ fmt.Println(version.VersionInfo.String(""))
+ return
+ }
+
//// Setup logging
//Setup default logger - applies for packages that do not have specific logger set
diff --git a/docker/Dockerfile.simulated_onu b/docker/Dockerfile.simulated_onu
index b9a346d..ad622f1 100644
--- a/docker/Dockerfile.simulated_onu
+++ b/docker/Dockerfile.simulated_onu
@@ -47,13 +47,13 @@
SHELL ["/bin/ash", "-o", "pipefail", "-c"]
RUN go build -mod=vendor -o /build/simulated_onu \
-ldflags \
- "-X github.com/opencord/voltha-go/common/version.version=$org_label_schema_version \
- -X github.com/opencord/voltha-go/common/version.vcsRef=$org_label_schema_vcs_ref \
- -X github.com/opencord/voltha-go/common/version.vcsDirty=$org_opencord_vcs_dirty \
- -X github.com/opencord/voltha-go/common/version.goVersion=$(go version 2>&1 | sed -E 's/.*go([0-9]+\.[0-9]+\.[0-9]+).*/\1/g') \
- -X github.com/opencord/voltha-go/common/version.os=$(go env GOHOSTOS) \
- -X github.com/opencord/voltha-go/common/version.arch=$(go env GOHOSTARCH) \
- -X github.com/opencord/voltha-go/common/version.buildTime=$org_label_schema_build_date" \
+ "-X github.com/opencord/voltha-lib-go/pkg/version.version=$org_label_schema_version \
+ -X github.com/opencord/voltha-lib-go/pkg/version.vcsRef=$org_label_schema_vcs_ref \
+ -X github.com/opencord/voltha-lib-go/pkg/version.vcsDirty=$org_opencord_vcs_dirty \
+ -X github.com/opencord/voltha-lib-go/pkg/version.goVersion=$(go version 2>&1 | sed -E 's/.*go([0-9]+\.[0-9]+\.[0-9]+).*/\1/g') \
+ -X github.com/opencord/voltha-lib-go/pkg/version.os=$(go env GOHOSTOS) \
+ -X github.com/opencord/voltha-lib-go/pkg/version.arch=$(go env GOHOSTARCH) \
+ -X github.com/opencord/voltha-lib-go/pkg/version.buildTime=$org_label_schema_build_date" \
cmd/simulated_onu/main.go
# -------------
diff --git a/internal/pkg/config/config.go b/internal/pkg/config/config.go
index a8ef37e..9e4c414 100644
--- a/internal/pkg/config/config.go
+++ b/internal/pkg/config/config.go
@@ -40,6 +40,7 @@
default_CoreTopic = "rwcore"
default_ProbeHost = ""
default_ProbePort = 8080
+ default_PrintVersion = false
)
// AdapterFlags represents the set of configurations used by the read-write adaptercore service
@@ -60,6 +61,7 @@
Banner bool
ProbeHost string
ProbePort int
+ PrintVersion bool
}
func init() {
@@ -84,6 +86,7 @@
Banner: default_Banner,
ProbeHost: default_ProbeHost,
ProbePort: default_ProbePort,
+ PrintVersion: default_PrintVersion,
}
return &adapterFlags
}
@@ -135,6 +138,9 @@
help = fmt.Sprintf("The port on which to listen to answer liveness and readiness probe queries over HTTP.")
flag.IntVar(&(so.ProbePort), "probe_port", default_ProbePort, help)
+ help = fmt.Sprintf("Print the version information and exit.")
+ flag.BoolVar(&so.PrintVersion, "version", default_PrintVersion, help)
+
flag.Parse()
containerName := getContainerInfo()