Skip to content
This repository has been archived by the owner on Nov 27, 2023. It is now read-only.

Commit

Permalink
Merge pull request #1603 from gtardif/compose-cli-plugin-version
Browse files Browse the repository at this point in the history
Separate compose CLI plugin version from Cloud integration version
  • Loading branch information
gtardif authored Apr 27, 2021
2 parents 9370ca3 + 28bd7bd commit 38b4220
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 6 deletions.
2 changes: 1 addition & 1 deletion builder.Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
9 changes: 5 additions & 4 deletions cli/cmd/compose/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
2 changes: 2 additions & 0 deletions internal/variables.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)
2 changes: 1 addition & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"),
})
}

0 comments on commit 38b4220

Please sign in to comment.