Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
Tonis Tiigi authored on 2017/04/05 01:54:21... | ... |
@@ -6002,6 +6002,28 @@ func (s *DockerSuite) TestBuildFromPreviousBlock(c *check.C) { |
6002 | 6002 |
dockerCmdWithResult("run", "build1", "cat", "f2").Assert(c, icmd.Expected{Out: "bar2"}) |
6003 | 6003 |
} |
6004 | 6004 |
|
6005 |
+func (s *DockerTrustSuite) TestCopyFromTrustedBuild(c *check.C) { |
|
6006 |
+ img1 := s.setupTrustedImage(c, "trusted-build1") |
|
6007 |
+ img2 := s.setupTrustedImage(c, "trusted-build2") |
|
6008 |
+ dockerFile := fmt.Sprintf(` |
|
6009 |
+ FROM %s AS build-base |
|
6010 |
+ RUN echo ok > /foo |
|
6011 |
+ FROM %s |
|
6012 |
+ COPY --from=build-base foo bar`, img1, img2) |
|
6013 |
+ |
|
6014 |
+ name := "testcopyfromtrustedbuild" |
|
6015 |
+ |
|
6016 |
+ r := buildImage(name, trustedBuild, build.WithDockerfile(dockerFile)) |
|
6017 |
+ r.Assert(c, icmd.Expected{ |
|
6018 |
+ Out: fmt.Sprintf("FROM %s@sha", img1[:len(img1)-7]), |
|
6019 |
+ }) |
|
6020 |
+ r.Assert(c, icmd.Expected{ |
|
6021 |
+ Out: fmt.Sprintf("FROM %s@sha", img2[:len(img2)-7]), |
|
6022 |
+ }) |
|
6023 |
+ |
|
6024 |
+ dockerCmdWithResult("run", name, "cat", "bar").Assert(c, icmd.Expected{Out: "ok"}) |
|
6025 |
+} |
|
6026 |
+ |
|
6005 | 6027 |
// TestBuildOpaqueDirectory tests that a build succeeds which |
6006 | 6028 |
// creates opaque directories. |
6007 | 6029 |
// See https://github.com/docker/docker/issues/25244 |