1
0
mirror of https://github.com/moby/moby.git synced 2025-07-30 18:23:29 +03:00

Add hint of progress to the output of docker build

This fix tries to address the issue raised in 24912 where docker
build only consists of the current step without overall total steps.

This fix adds the overall total steps so that end user could follow
the progress of the docker build.

An additonal test has been added to cover the changes.

This fix fixes 24912.

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
This commit is contained in:
Yong Tang
2016-07-24 01:06:10 -07:00
parent b8a08ddd69
commit 35418c1455
5 changed files with 24 additions and 8 deletions

View File

@ -5402,7 +5402,7 @@ func (s *DockerSuite) TestBuildNoDupOutput(c *check.C) {
c.Fatalf("Build should have worked: %q", err)
}
exp := "\nStep 2 : RUN env\n"
exp := "\nStep 2/2 : RUN env\n"
if !strings.Contains(out, exp) {
c.Fatalf("Bad output\nGot:%s\n\nExpected to contain:%s\n", out, exp)
}
@ -5419,7 +5419,7 @@ func (s *DockerSuite) TestBuildStartsFromOne(c *check.C) {
c.Fatalf("Build should have worked: %q", err)
}
exp := "\nStep 1 : FROM busybox\n"
exp := "\nStep 1/1 : FROM busybox\n"
if !strings.Contains(out, exp) {
c.Fatalf("Bad output\nGot:%s\n\nExpected to contain:%s\n", out, exp)
}
@ -6967,3 +6967,16 @@ func (s *DockerSuite) TestBuildCmdShellArgsEscaped(c *check.C) {
c.Fatalf("CMD was not escaped Config.Cmd: got %v", res)
}
}
// Test case for #24912.
func (s *DockerSuite) TestBuildStepsWithProgress(c *check.C) {
name := "testbuildstepswithprogress"
totalRun := 5
_, out, err := buildImageWithOut(name, "FROM busybox\n"+strings.Repeat("RUN echo foo\n", totalRun), true)
c.Assert(err, checker.IsNil)
c.Assert(out, checker.Contains, fmt.Sprintf("Step 1/%d : FROM busybox", 1+totalRun))
for i := 2; i <= 1+totalRun; i++ {
c.Assert(out, checker.Contains, fmt.Sprintf("Step %d/%d : RUN echo foo", i, 1+totalRun))
}
}