mirror of
				https://github.com/moby/moby.git
				synced 2022-11-09 12:21:53 -05:00 
			
		
		
		
	Builder counts from 1
Signed-off-by: John Howard <jhoward@microsoft.com>
This commit is contained in:
		
							parent
							
								
									78698855ce
								
							
						
					
					
						commit
						17d6c6c7e5
					
				
					 5 changed files with 30 additions and 13 deletions
				
			
		| 
						 | 
				
			
			@ -293,7 +293,7 @@ func (b *builder) dispatch(stepN int, ast *parser.Node) error {
 | 
			
		|||
	original := ast.Original
 | 
			
		||||
	flags := ast.Flags
 | 
			
		||||
	strs := []string{}
 | 
			
		||||
	msg := fmt.Sprintf("Step %d : %s", stepN, strings.ToUpper(cmd))
 | 
			
		||||
	msg := fmt.Sprintf("Step %d : %s", stepN+1, strings.ToUpper(cmd))
 | 
			
		||||
 | 
			
		||||
	if len(ast.Flags) > 0 {
 | 
			
		||||
		msg += " " + strings.Join(ast.Flags, " ")
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -110,9 +110,9 @@ There should be informational output of the reason for failure output to
 | 
			
		|||
    $ docker build -t fail .
 | 
			
		||||
    Sending build context to Docker daemon 2.048 kB
 | 
			
		||||
    Sending build context to Docker daemon
 | 
			
		||||
    Step 0 : FROM busybox
 | 
			
		||||
    Step 1 : FROM busybox
 | 
			
		||||
     ---> 4986bf8c1536
 | 
			
		||||
    Step 1 : RUN exit 13
 | 
			
		||||
    Step 2 : RUN exit 13
 | 
			
		||||
     ---> Running in e26670ec7a0a
 | 
			
		||||
    INFO[0000] The command [/bin/sh -c exit 13] returned a non-zero code: 13
 | 
			
		||||
    $ echo $?
 | 
			
		||||
| 
						 | 
				
			
			@ -167,9 +167,9 @@ you must use `--rm=false`. This does not affect the build cache.
 | 
			
		|||
    $ docker build .
 | 
			
		||||
    Uploading context 18.829 MB
 | 
			
		||||
    Uploading context
 | 
			
		||||
    Step 0 : FROM busybox
 | 
			
		||||
    Step 1 : FROM busybox
 | 
			
		||||
     ---> 769b9341d937
 | 
			
		||||
    Step 1 : CMD echo Hello world
 | 
			
		||||
    Step 2 : CMD echo Hello world
 | 
			
		||||
     ---> Using cache
 | 
			
		||||
     ---> 99cc1ad10469
 | 
			
		||||
    Successfully built 99cc1ad10469
 | 
			
		||||
| 
						 | 
				
			
			@ -177,9 +177,9 @@ you must use `--rm=false`. This does not affect the build cache.
 | 
			
		|||
    $ docker build .
 | 
			
		||||
    Uploading context  6.76 MB
 | 
			
		||||
    Uploading context
 | 
			
		||||
    Step 0 : FROM busybox
 | 
			
		||||
    Step 1 : FROM busybox
 | 
			
		||||
     ---> 769b9341d937
 | 
			
		||||
    Step 1 : CMD echo Hello world
 | 
			
		||||
    Step 2 : CMD echo Hello world
 | 
			
		||||
     ---> Using cache
 | 
			
		||||
     ---> 99cc1ad10469
 | 
			
		||||
    Successfully built 99cc1ad10469
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -120,7 +120,7 @@ So, you'll need an entry for both the servers in your local `/etc/hosts` file.
 | 
			
		|||
 | 
			
		||||
        $ docker build -t notarysandbox .
 | 
			
		||||
        Sending build context to Docker daemon 2.048 kB
 | 
			
		||||
        Step 0 : FROM debian:jessie
 | 
			
		||||
        Step 1 : FROM debian:jessie
 | 
			
		||||
         ...
 | 
			
		||||
         Successfully built 5683f17e9d72
 | 
			
		||||
     
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -293,12 +293,12 @@ Now let's take our `Dockerfile` and use the `docker build` command to build an i
 | 
			
		|||
    $ docker build -t ouruser/sinatra:v2 .
 | 
			
		||||
    Sending build context to Docker daemon 2.048 kB
 | 
			
		||||
    Sending build context to Docker daemon 
 | 
			
		||||
    Step 0 : FROM ubuntu:14.04
 | 
			
		||||
    Step 1 : FROM ubuntu:14.04
 | 
			
		||||
     ---> e54ca5efa2e9
 | 
			
		||||
    Step 1 : MAINTAINER Kate Smith <ksmith@example.com>
 | 
			
		||||
    Step 2 : MAINTAINER Kate Smith <ksmith@example.com>
 | 
			
		||||
     ---> Using cache
 | 
			
		||||
     ---> 851baf55332b
 | 
			
		||||
    Step 2 : RUN apt-get update && apt-get install -y ruby ruby-dev
 | 
			
		||||
    Step 3 : RUN apt-get update && apt-get install -y ruby ruby-dev
 | 
			
		||||
     ---> Running in 3a2558904e9b
 | 
			
		||||
    Selecting previously unselected package libasan0:amd64.
 | 
			
		||||
    (Reading database ... 11518 files and directories currently installed.)
 | 
			
		||||
| 
						 | 
				
			
			@ -433,7 +433,7 @@ Now let's take our `Dockerfile` and use the `docker build` command to build an i
 | 
			
		|||
    Running hooks in /etc/ca-certificates/update.d....done.
 | 
			
		||||
     ---> c55c31703134
 | 
			
		||||
    Removing intermediate container 3a2558904e9b
 | 
			
		||||
    Step 3 : RUN gem install sinatra
 | 
			
		||||
    Step 4 : RUN gem install sinatra
 | 
			
		||||
     ---> Running in 6b81cb6313e5
 | 
			
		||||
    unable to convert "\xC3" to UTF-8 in conversion from ASCII-8BIT to UTF-8 to US-ASCII for README.rdoc, skipping
 | 
			
		||||
    unable to convert "\xC3" to UTF-8 in conversion from ASCII-8BIT to UTF-8 to US-ASCII for README.rdoc, skipping
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -5316,7 +5316,24 @@ func (s *DockerSuite) TestBuildNoDupOutput(c *check.C) {
 | 
			
		|||
		c.Fatalf("Build should have worked: %q", err)
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	exp := "\nStep 1 : RUN env\n"
 | 
			
		||||
	exp := "\nStep 2 : RUN env\n"
 | 
			
		||||
	if !strings.Contains(out, exp) {
 | 
			
		||||
		c.Fatalf("Bad output\nGot:%s\n\nExpected to contain:%s\n", out, exp)
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// GH15826
 | 
			
		||||
func (s *DockerSuite) TestBuildStartsFromOne(c *check.C) {
 | 
			
		||||
	// Explicit check to ensure that build starts from step 1 rather than 0
 | 
			
		||||
	name := "testbuildstartsfromone"
 | 
			
		||||
 | 
			
		||||
	_, out, err := buildImageWithOut(name, `
 | 
			
		||||
  FROM busybox`, false)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		c.Fatalf("Build should have worked: %q", err)
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	exp := "\nStep 1 : FROM busybox\n"
 | 
			
		||||
	if !strings.Contains(out, exp) {
 | 
			
		||||
		c.Fatalf("Bad output\nGot:%s\n\nExpected to contain:%s\n", out, exp)
 | 
			
		||||
	}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue