mirror of
https://github.com/moby/moby.git
synced 2026-01-11 18:51:37 +00:00
Expose license status in Info (#37612)
* Expose license status in Info This wires up a new field in the Info payload that exposes the license. For moby this is hardcoded to always report a community edition. Downstream enterprise dockerd will have additional licensing logic wired into this function to report details about the current license status. Signed-off-by: Daniel Hiltgen <daniel.hiltgen@docker.com> * Code review comments Signed-off-by: Daniel Hiltgen <daniel.hiltgen@docker.com> * Add windows autogen support Signed-off-by: Daniel Hiltgen <daniel.hiltgen@docker.com>
This commit is contained in:
committed by
Tibor Vass
parent
8613b34a7e
commit
896d1b1c61
1
Makefile
1
Makefile
@@ -57,6 +57,7 @@ DOCKER_ENVS := \
|
|||||||
-e no_proxy \
|
-e no_proxy \
|
||||||
-e VERSION \
|
-e VERSION \
|
||||||
-e PLATFORM \
|
-e PLATFORM \
|
||||||
|
-e DEFAULT_PRODUCT_LICENSE \
|
||||||
-e PRODUCT
|
-e PRODUCT
|
||||||
# note: we _cannot_ add "-e DOCKER_BUILDTAGS" here because even if it's unset in the shell, that would shadow the "ENV DOCKER_BUILDTAGS" set in our Dockerfile, which is very important for our official builds
|
# note: we _cannot_ add "-e DOCKER_BUILDTAGS" here because even if it's unset in the shell, that would shadow the "ENV DOCKER_BUILDTAGS" set in our Dockerfile, which is very important for our official builds
|
||||||
|
|
||||||
|
|||||||
@@ -3896,6 +3896,14 @@ definitions:
|
|||||||
- "name=seccomp,profile=default"
|
- "name=seccomp,profile=default"
|
||||||
- "name=selinux"
|
- "name=selinux"
|
||||||
- "name=userns"
|
- "name=userns"
|
||||||
|
ProductLicense:
|
||||||
|
description: |
|
||||||
|
Reports a summary of the product license on the daemon.
|
||||||
|
|
||||||
|
If a commercial license has been applied to the daemon, information
|
||||||
|
such as number of nodes, and expiration are included.
|
||||||
|
type: "string"
|
||||||
|
example: "Community Engine"
|
||||||
|
|
||||||
|
|
||||||
# PluginsInfo is a temp struct holding Plugins name
|
# PluginsInfo is a temp struct holding Plugins name
|
||||||
|
|||||||
@@ -204,6 +204,7 @@ type Info struct {
|
|||||||
RuncCommit Commit
|
RuncCommit Commit
|
||||||
InitCommit Commit
|
InitCommit Commit
|
||||||
SecurityOptions []string
|
SecurityOptions []string
|
||||||
|
ProductLicense string `json:",omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// KeyValue holds a key/value pair
|
// KeyValue holds a key/value pair
|
||||||
|
|||||||
@@ -73,6 +73,7 @@ func (daemon *Daemon) SystemInfo() (*types.Info, error) {
|
|||||||
daemon.fillDriverInfo(v)
|
daemon.fillDriverInfo(v)
|
||||||
daemon.fillPluginsInfo(v)
|
daemon.fillPluginsInfo(v)
|
||||||
daemon.fillSecurityOptions(v, sysInfo)
|
daemon.fillSecurityOptions(v, sysInfo)
|
||||||
|
daemon.fillLicense(v)
|
||||||
|
|
||||||
return v, nil
|
return v, nil
|
||||||
}
|
}
|
||||||
|
|||||||
10
daemon/licensing.go
Normal file
10
daemon/licensing.go
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
package daemon // import "github.com/docker/docker/daemon"
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/docker/docker/api/types"
|
||||||
|
"github.com/docker/docker/dockerversion"
|
||||||
|
)
|
||||||
|
|
||||||
|
func (daemon *Daemon) fillLicense(v *types.Info) {
|
||||||
|
v.ProductLicense = dockerversion.DefaultProductLicense
|
||||||
|
}
|
||||||
18
daemon/licensing_test.go
Normal file
18
daemon/licensing_test.go
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
package daemon // import "github.com/docker/docker/daemon"
|
||||||
|
|
||||||
|
import (
|
||||||
|
"testing"
|
||||||
|
|
||||||
|
"github.com/docker/docker/api/types"
|
||||||
|
"github.com/docker/docker/dockerversion"
|
||||||
|
"gotest.tools/assert"
|
||||||
|
)
|
||||||
|
|
||||||
|
func TestfillLicense(t *testing.T) {
|
||||||
|
v := &types.Info{}
|
||||||
|
d := &Daemon{
|
||||||
|
root: "/var/lib/docker/",
|
||||||
|
}
|
||||||
|
d.fillLicense(v)
|
||||||
|
assert.Assert(t, v.ProductLicense == dockerversion.DefaultProductLicense)
|
||||||
|
}
|
||||||
@@ -6,13 +6,14 @@ package dockerversion // import "github.com/docker/docker/dockerversion"
|
|||||||
// Default build-time variable for library-import.
|
// Default build-time variable for library-import.
|
||||||
// This file is overridden on build with build-time informations.
|
// This file is overridden on build with build-time informations.
|
||||||
const (
|
const (
|
||||||
GitCommit = "library-import"
|
GitCommit = "library-import"
|
||||||
Version = "library-import"
|
Version = "library-import"
|
||||||
BuildTime = "library-import"
|
BuildTime = "library-import"
|
||||||
IAmStatic = "library-import"
|
IAmStatic = "library-import"
|
||||||
ContainerdCommitID = "library-import"
|
ContainerdCommitID = "library-import"
|
||||||
RuncCommitID = "library-import"
|
RuncCommitID = "library-import"
|
||||||
InitCommitID = "library-import"
|
InitCommitID = "library-import"
|
||||||
PlatformName = ""
|
PlatformName = ""
|
||||||
ProductName = ""
|
ProductName = ""
|
||||||
|
DefaultProductLicense = ""
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -19,6 +19,8 @@ keywords: "API, Docker, rcli, REST, documentation"
|
|||||||
|
|
||||||
* `GET /info` now returns an empty string, instead of `<unknown>` for `KernelVersion`
|
* `GET /info` now returns an empty string, instead of `<unknown>` for `KernelVersion`
|
||||||
and `OperatingSystem` if the daemon was unable to obtain this information.
|
and `OperatingSystem` if the daemon was unable to obtain this information.
|
||||||
|
* `GET /info` now returns information about the product license, if a license
|
||||||
|
has been applied to the daemon.
|
||||||
|
|
||||||
## V1.38 API changes
|
## V1.38 API changes
|
||||||
|
|
||||||
|
|||||||
@@ -15,13 +15,14 @@ package dockerversion
|
|||||||
// Default build-time variable for library-import.
|
// Default build-time variable for library-import.
|
||||||
// This file is overridden on build with build-time informations.
|
// This file is overridden on build with build-time informations.
|
||||||
const (
|
const (
|
||||||
GitCommit string = "$GITCOMMIT"
|
GitCommit string = "$GITCOMMIT"
|
||||||
Version string = "$VERSION"
|
Version string = "$VERSION"
|
||||||
BuildTime string = "$BUILDTIME"
|
BuildTime string = "$BUILDTIME"
|
||||||
IAmStatic string = "${IAMSTATIC:-true}"
|
IAmStatic string = "${IAMSTATIC:-true}"
|
||||||
ContainerdCommitID string = "${CONTAINERD_COMMIT}"
|
ContainerdCommitID string = "${CONTAINERD_COMMIT}"
|
||||||
PlatformName string = "${PLATFORM}"
|
PlatformName string = "${PLATFORM}"
|
||||||
ProductName string = "${PRODUCT}"
|
ProductName string = "${PRODUCT}"
|
||||||
|
DefaultProductLicense string = "${DEFAULT_PRODUCT_LICENSE}"
|
||||||
)
|
)
|
||||||
|
|
||||||
// AUTOGENERATED FILE; see /go/src/github.com/docker/docker/hack/make/.go-autogen
|
// AUTOGENERATED FILE; see /go/src/github.com/docker/docker/hack/make/.go-autogen
|
||||||
|
|||||||
@@ -16,7 +16,8 @@ param(
|
|||||||
[Parameter(Mandatory=$true)][string]$CommitString,
|
[Parameter(Mandatory=$true)][string]$CommitString,
|
||||||
[Parameter(Mandatory=$true)][string]$DockerVersion,
|
[Parameter(Mandatory=$true)][string]$DockerVersion,
|
||||||
[Parameter(Mandatory=$false)][string]$Platform,
|
[Parameter(Mandatory=$false)][string]$Platform,
|
||||||
[Parameter(Mandatory=$false)][string]$Product
|
[Parameter(Mandatory=$false)][string]$Product,
|
||||||
|
[Parameter(Mandatory=$false)][string]$DefaultProductLicense
|
||||||
)
|
)
|
||||||
|
|
||||||
$ErrorActionPreference = "Stop"
|
$ErrorActionPreference = "Stop"
|
||||||
@@ -42,11 +43,12 @@ package dockerversion
|
|||||||
// Default build-time variable for library-import.
|
// Default build-time variable for library-import.
|
||||||
// This file is overridden on build with build-time informations.
|
// This file is overridden on build with build-time informations.
|
||||||
const (
|
const (
|
||||||
GitCommit string = "'+$CommitString+'"
|
GitCommit string = "'+$CommitString+'"
|
||||||
Version string = "'+$DockerVersion+'"
|
Version string = "'+$DockerVersion+'"
|
||||||
BuildTime string = "'+$buildDateTime+'"
|
BuildTime string = "'+$buildDateTime+'"
|
||||||
PlatformName string = "'+$Platform+'"
|
PlatformName string = "'+$Platform+'"
|
||||||
ProductName string = "'+$Product+'"
|
ProductName string = "'+$Product+'"
|
||||||
|
DefaultProductLicense string = "'+$DefaultProductLicense+'"
|
||||||
)
|
)
|
||||||
|
|
||||||
// AUTOGENERATED FILE; see hack\make\.go-autogen.ps1
|
// AUTOGENERATED FILE; see hack\make\.go-autogen.ps1
|
||||||
|
|||||||
Reference in New Issue
Block a user