Skip to content

Commit ea836ab

Browse files
authored
Merge pull request #1474 from tiborvass/fix-build-stream
build: update session support detection
2 parents 727a83b + 3e8c41b commit ea836ab

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

cli/command/image/build.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -350,7 +350,7 @@ func runBuild(dockerCli command.Cli, options buildOptions) error {
350350
buildCtx = dockerfileCtx
351351
}
352352

353-
s, err := trySession(dockerCli, contextDir)
353+
s, err := trySession(dockerCli, contextDir, true)
354354
if err != nil {
355355
return err
356356
}

cli/command/image/build_buildkit.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ var errDockerfileConflict = errors.New("ambiguous Dockerfile source: both stdin
4343
func runBuildBuildKit(dockerCli command.Cli, options buildOptions) error {
4444
ctx := appcontext.Context()
4545

46-
s, err := trySession(dockerCli, options.context)
46+
s, err := trySession(dockerCli, options.context, false)
4747
if err != nil {
4848
return err
4949
}

cli/command/image/build_session.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,16 +27,16 @@ import (
2727

2828
const clientSessionRemote = "client-session"
2929

30-
func isSessionSupported(dockerCli command.Cli) bool {
31-
if versions.GreaterThanOrEqualTo(dockerCli.Client().ClientVersion(), "1.39") {
30+
func isSessionSupported(dockerCli command.Cli, forStream bool) bool {
31+
if !forStream && versions.GreaterThanOrEqualTo(dockerCli.Client().ClientVersion(), "1.39") {
3232
return true
3333
}
3434
return dockerCli.ServerInfo().HasExperimental && versions.GreaterThanOrEqualTo(dockerCli.Client().ClientVersion(), "1.31")
3535
}
3636

37-
func trySession(dockerCli command.Cli, contextDir string) (*session.Session, error) {
37+
func trySession(dockerCli command.Cli, contextDir string, forStream bool) (*session.Session, error) {
3838
var s *session.Session
39-
if isSessionSupported(dockerCli) {
39+
if isSessionSupported(dockerCli, forStream) {
4040
sharedKey, err := getBuildSharedKey(contextDir)
4141
if err != nil {
4242
return nil, errors.Wrap(err, "failed to get build shared key")

0 commit comments

Comments
 (0)