mirror of
https://github.com/moby/moby.git
synced 2025-08-01 05:47:11 +03:00
Merge pull request #29856 from Microsoft/jjh/warntoout
Windows to Linux build warning to stdout
This commit is contained in:
@ -334,7 +334,7 @@ func runBuild(dockerCli *command.DockerCli, options buildOptions) error {
|
|||||||
// Windows: show error message about modified file permissions if the
|
// Windows: show error message about modified file permissions if the
|
||||||
// daemon isn't running Windows.
|
// daemon isn't running Windows.
|
||||||
if response.OSType != "windows" && runtime.GOOS == "windows" && !options.quiet {
|
if response.OSType != "windows" && runtime.GOOS == "windows" && !options.quiet {
|
||||||
fmt.Fprintln(dockerCli.Err(), `SECURITY WARNING: You are building a Docker image from Windows against a non-Windows Docker host. All files and directories added to build context will have '-rwxr-xr-x' permissions. It is recommended to double check and reset permissions for sensitive files and directories.`)
|
fmt.Fprintln(dockerCli.Out(), `SECURITY WARNING: You are building a Docker image from Windows against a non-Windows Docker host. All files and directories added to build context will have '-rwxr-xr-x' permissions. It is recommended to double check and reset permissions for sensitive files and directories.`)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Everything worked so if -q was provided the output from the daemon
|
// Everything worked so if -q was provided the output from the daemon
|
||||||
|
@ -4644,23 +4644,20 @@ func (s *DockerSuite) TestBuildStderr(c *check.C) {
|
|||||||
// This test just makes sure that no non-error output goes
|
// This test just makes sure that no non-error output goes
|
||||||
// to stderr
|
// to stderr
|
||||||
name := "testbuildstderr"
|
name := "testbuildstderr"
|
||||||
_, _, stderr, err := buildImageWithStdoutStderr(name,
|
_, stdout, stderr, err := buildImageWithStdoutStderr(name,
|
||||||
"FROM busybox\nRUN echo one", true)
|
"FROM busybox\nRUN echo one", true)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
c.Fatal(err)
|
c.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
if runtime.GOOS == "windows" &&
|
// Windows to non-Windows should have a security warning
|
||||||
daemonPlatform != "windows" {
|
if runtime.GOOS == "windows" && daemonPlatform != "windows" && !strings.Contains(stdout, "SECURITY WARNING:") {
|
||||||
// Windows to non-Windows should have a security warning
|
c.Fatalf("Stdout contains unexpected output: %q", stdout)
|
||||||
if !strings.Contains(stderr, "SECURITY WARNING:") {
|
}
|
||||||
c.Fatalf("Stderr contains unexpected output: %q", stderr)
|
|
||||||
}
|
// Stderr should always be empty
|
||||||
} else {
|
if stderr != "" {
|
||||||
// Other platform combinations should have no stderr written too
|
c.Fatalf("Stderr should have been empty, instead it's: %q", stderr)
|
||||||
if stderr != "" {
|
|
||||||
c.Fatalf("Stderr should have been empty, instead it's: %q", stderr)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user