|
@@ -1722,8 +1722,8 @@ func (s *DockerSuite) TestBuildWithInaccessibleFilesInContext(c *check.C) {
|
|
|
c.Fatalf("output should've contained the string: no permission to read from but contained: %s", out)
|
|
|
}
|
|
|
|
|
|
- if !strings.Contains(out, "Error checking context is accessible") {
|
|
|
- c.Fatalf("output should've contained the string: Error checking context is accessible")
|
|
|
+ if !strings.Contains(out, "Error checking context") {
|
|
|
+ c.Fatalf("output should've contained the string: Error checking context")
|
|
|
}
|
|
|
}
|
|
|
{
|
|
@@ -1759,8 +1759,8 @@ func (s *DockerSuite) TestBuildWithInaccessibleFilesInContext(c *check.C) {
|
|
|
c.Fatalf("output should've contained the string: can't access %s", out)
|
|
|
}
|
|
|
|
|
|
- if !strings.Contains(out, "Error checking context is accessible") {
|
|
|
- c.Fatalf("output should've contained the string: Error checking context is accessible")
|
|
|
+ if !strings.Contains(out, "Error checking context") {
|
|
|
+ c.Fatalf("output should've contained the string: Error checking context\ngot:%s", out)
|
|
|
}
|
|
|
|
|
|
}
|
|
@@ -3651,15 +3651,52 @@ func (s *DockerSuite) TestBuildDockerignoringWholeDir(c *check.C) {
|
|
|
".gitignore": "",
|
|
|
".dockerignore": ".*\n",
|
|
|
})
|
|
|
+ c.Assert(err, check.IsNil)
|
|
|
defer ctx.Close()
|
|
|
- if err != nil {
|
|
|
+ if _, err = buildImageFromContext(name, ctx, true); err != nil {
|
|
|
+ c.Fatal(err)
|
|
|
+ }
|
|
|
+
|
|
|
+ c.Assert(ctx.Add(".dockerfile", "*"), check.IsNil)
|
|
|
+ if _, err = buildImageFromContext(name, ctx, true); err != nil {
|
|
|
+ c.Fatal(err)
|
|
|
+ }
|
|
|
+
|
|
|
+ c.Assert(ctx.Add(".dockerfile", "."), check.IsNil)
|
|
|
+ if _, err = buildImageFromContext(name, ctx, true); err != nil {
|
|
|
c.Fatal(err)
|
|
|
}
|
|
|
+
|
|
|
+ c.Assert(ctx.Add(".dockerfile", "?"), check.IsNil)
|
|
|
if _, err = buildImageFromContext(name, ctx, true); err != nil {
|
|
|
c.Fatal(err)
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+func (s *DockerSuite) TestBuildDockerignoringBadExclusion(c *check.C) {
|
|
|
+ name := "testbuilddockerignorewholedir"
|
|
|
+ dockerfile := `
|
|
|
+ FROM busybox
|
|
|
+ COPY . /
|
|
|
+ RUN [[ ! -e /.gitignore ]]
|
|
|
+ RUN [[ -f /Makefile ]]`
|
|
|
+ ctx, err := fakeContext(dockerfile, map[string]string{
|
|
|
+ "Dockerfile": "FROM scratch",
|
|
|
+ "Makefile": "all:",
|
|
|
+ ".gitignore": "",
|
|
|
+ ".dockerignore": "!\n",
|
|
|
+ })
|
|
|
+ c.Assert(err, check.IsNil)
|
|
|
+ defer ctx.Close()
|
|
|
+ if _, err = buildImageFromContext(name, ctx, true); err == nil {
|
|
|
+ c.Fatalf("Build was supposed to fail but didn't")
|
|
|
+ }
|
|
|
+
|
|
|
+ if err.Error() != "failed to build the image: Error checking context: 'Illegal exclusion pattern: !'.\n" {
|
|
|
+ c.Fatalf("Incorrect output, got:%q", err.Error())
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
func (s *DockerSuite) TestBuildLineBreak(c *check.C) {
|
|
|
name := "testbuildlinebreak"
|
|
|
_, err := buildImage(name,
|