Merge pull request #1603 from gtardif/compose-cli-plugin-version

Separate compose CLI plugin version from Cloud integration version
This commit is contained in:
Guillaume Tardif 2021-04-27 10:56:59 +02:00 committed by GitHub
commit 38b4220bdb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 9 additions and 6 deletions

View File

@ -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

View File

@ -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

View File

@ -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"
)

View File

@ -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"),
})
}