浏览代码

Sort unconsumed build arguments before usage

Golang map iteration order is not guaranteed, so in some cases the built slice has it's output of order as well. This means that testing for exact warning messages in docker build output would result in random test failures, making it more annoying for end-users to test against this functionality.

Signed-off-by: Jose Diaz-Gonzalez <email@josediazgonzalez.com>
Jose Diaz-Gonzalez 2 年之前
父节点
当前提交
079a9d4562
共有 1 个文件被更改,包括 2 次插入0 次删除
  1. 2 0
      builder/dockerfile/buildargs.go

+ 2 - 0
builder/dockerfile/buildargs.go

@@ -3,6 +3,7 @@ package dockerfile // import "github.com/docker/docker/builder/dockerfile"
 import (
 	"fmt"
 	"io"
+	"sort"
 
 	"github.com/docker/docker/runconfig/opts"
 )
@@ -80,6 +81,7 @@ func (b *BuildArgs) WarnOnUnusedBuildArgs(out io.Writer) {
 		}
 	}
 	if len(leftoverArgs) > 0 {
+		sort.Strings(leftoverArgs)
 		fmt.Fprintf(out, "[Warning] One or more build-args %v were not consumed\n", leftoverArgs)
 	}
 }