mirror of https://github.com/docker/cli.git
Merge pull request #1474 from tiborvass/fix-build-stream
build: update session support detection
This commit is contained in:
commit
ea836abed5
|
@ -350,7 +350,7 @@ func runBuild(dockerCli command.Cli, options buildOptions) error {
|
||||||
buildCtx = dockerfileCtx
|
buildCtx = dockerfileCtx
|
||||||
}
|
}
|
||||||
|
|
||||||
s, err := trySession(dockerCli, contextDir)
|
s, err := trySession(dockerCli, contextDir, true)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
|
@ -43,7 +43,7 @@ var errDockerfileConflict = errors.New("ambiguous Dockerfile source: both stdin
|
||||||
func runBuildBuildKit(dockerCli command.Cli, options buildOptions) error {
|
func runBuildBuildKit(dockerCli command.Cli, options buildOptions) error {
|
||||||
ctx := appcontext.Context()
|
ctx := appcontext.Context()
|
||||||
|
|
||||||
s, err := trySession(dockerCli, options.context)
|
s, err := trySession(dockerCli, options.context, false)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,16 +27,16 @@ import (
|
||||||
|
|
||||||
const clientSessionRemote = "client-session"
|
const clientSessionRemote = "client-session"
|
||||||
|
|
||||||
func isSessionSupported(dockerCli command.Cli) bool {
|
func isSessionSupported(dockerCli command.Cli, forStream bool) bool {
|
||||||
if versions.GreaterThanOrEqualTo(dockerCli.Client().ClientVersion(), "1.39") {
|
if !forStream && versions.GreaterThanOrEqualTo(dockerCli.Client().ClientVersion(), "1.39") {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
return dockerCli.ServerInfo().HasExperimental && versions.GreaterThanOrEqualTo(dockerCli.Client().ClientVersion(), "1.31")
|
return dockerCli.ServerInfo().HasExperimental && versions.GreaterThanOrEqualTo(dockerCli.Client().ClientVersion(), "1.31")
|
||||||
}
|
}
|
||||||
|
|
||||||
func trySession(dockerCli command.Cli, contextDir string) (*session.Session, error) {
|
func trySession(dockerCli command.Cli, contextDir string, forStream bool) (*session.Session, error) {
|
||||||
var s *session.Session
|
var s *session.Session
|
||||||
if isSessionSupported(dockerCli) {
|
if isSessionSupported(dockerCli, forStream) {
|
||||||
sharedKey, err := getBuildSharedKey(contextDir)
|
sharedKey, err := getBuildSharedKey(contextDir)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, errors.Wrap(err, "failed to get build shared key")
|
return nil, errors.Wrap(err, "failed to get build shared key")
|
||||||
|
|
Loading…
Reference in New Issue