builder: set buildkit's exported product variable via PRODUCT

This introduces a PRODUCT environment variable that is used to set a constant
at dockerversion.ProductName.

That is then used to set BuildKit's ExportedProduct variable in order to show
useful error messages to users when a certain version of the product doesn't
support a BuildKit feature.

Signed-off-by: Tibor Vass <tibor@docker.com>
Upstream-commit: 195919d9d645aa4ab5680a2331c57ff33eb9e5d9
Component: engine
This commit is contained in:
Tibor Vass
2018-07-16 21:41:54 +00:00
parent adc3470981
commit 5dc7f8fc9b
6 changed files with 15 additions and 3 deletions
+7
View File
@@ -10,6 +10,7 @@ import (
"github.com/docker/docker/dockerversion"
"github.com/docker/docker/pkg/reexec"
"github.com/docker/docker/pkg/term"
"github.com/moby/buildkit/util/apicaps"
"github.com/sirupsen/logrus"
"github.com/spf13/cobra"
)
@@ -42,6 +43,12 @@ func newDaemonCommand() *cobra.Command {
return cmd
}
func init() {
if dockerversion.ProductName != "" {
apicaps.ExportedProduct = dockerversion.ProductName
}
}
func main() {
if reexec.Init() {
return