Browse Source

Separate compose CLI plugin version from Cloud integration version

Signed-off-by: Guillaume Tardif <[email protected]>
Guillaume Tardif 4 years ago
parent
commit
28bd7bda3e
4 changed files with 9 additions and 6 deletions
  1. 1 1
      builder.Makefile
  2. 5 4
      cli/cmd/compose/version.go
  3. 2 0
      internal/variables.go
  4. 1 1
      main.go

+ 1 - 1
builder.Makefile

@@ -28,7 +28,7 @@ STATIC_FLAGS=CGO_ENABLED=0
 
 GIT_TAG?=$(shell git describe --tags --match "v[0-9]*")
 
-LDFLAGS="-s -w -X $(PKG_NAME)/internal.Version=${GIT_TAG}"
+LDFLAGS="-s -w -X $(PKG_NAME)/internal.Version=${GIT_TAG} -X $(PKG_NAME)/internal.ComposePluginVersion=2.0.0-beta.1"
 GO_BUILD=$(STATIC_FLAGS) go build -trimpath -ldflags=$(LDFLAGS)
 
 BINARY?=bin/docker

+ 5 - 4
cli/cmd/compose/version.go

@@ -34,9 +34,10 @@ type versionOptions struct {
 func versionCommand() *cobra.Command {
 	opts := versionOptions{}
 	cmd := &cobra.Command{
-		Use:   "version",
-		Short: "Show the Docker Compose version information",
-		Args:  cobra.MaximumNArgs(0),
+		Use:    "version",
+		Short:  "Show the Docker Compose version information",
+		Args:   cobra.MaximumNArgs(0),
+		Hidden: true,
 		RunE: func(cmd *cobra.Command, _ []string) error {
 			runVersion(opts)
 			return nil
@@ -51,7 +52,7 @@ func versionCommand() *cobra.Command {
 }
 
 func runVersion(opts versionOptions) {
-	displayedVersion := strings.TrimPrefix(internal.Version, "v")
+	displayedVersion := strings.TrimPrefix(internal.ComposePluginVersion, "v")
 	if opts.short {
 		fmt.Println(displayedVersion)
 		return

+ 2 - 0
internal/variables.go

@@ -26,4 +26,6 @@ const (
 var (
 	// Version is the version of the CLI injected in compilation time
 	Version = "dev"
+	// ComposePluginVersion is the version of the compose cli plugin, injected in compilation time
+	ComposePluginVersion = "dev"
 )

+ 1 - 1
main.go

@@ -61,6 +61,6 @@ func main() {
 		manager.Metadata{
 			SchemaVersion: "0.1.0",
 			Vendor:        "Docker Inc.",
-			Version:       strings.TrimPrefix(internal.Version, "v"),
+			Version:       strings.TrimPrefix(internal.ComposePluginVersion, "v"),
 		})
 }