mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Merge pull request #15877 from Microsoft/10662-trigger
Fix trigger count and output
This commit is contained in:
commit
0009852cb0
2 changed files with 8 additions and 7 deletions
|
@ -535,7 +535,11 @@ func (b *builder) processImageFrom(img *image.Image) error {
|
||||||
|
|
||||||
// Process ONBUILD triggers if they exist
|
// Process ONBUILD triggers if they exist
|
||||||
if nTriggers := len(b.Config.OnBuild); nTriggers != 0 {
|
if nTriggers := len(b.Config.OnBuild); nTriggers != 0 {
|
||||||
fmt.Fprintf(b.ErrStream, "# Executing %d build triggers\n", nTriggers)
|
word := "trigger"
|
||||||
|
if nTriggers > 1 {
|
||||||
|
word = "triggers"
|
||||||
|
}
|
||||||
|
fmt.Fprintf(b.ErrStream, "# Executing %d build %s...\n", nTriggers, word)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Copy the ONBUILD triggers, and remove them from the config, since the config will be committed.
|
// Copy the ONBUILD triggers, and remove them from the config, since the config will be committed.
|
||||||
|
@ -543,7 +547,7 @@ func (b *builder) processImageFrom(img *image.Image) error {
|
||||||
b.Config.OnBuild = []string{}
|
b.Config.OnBuild = []string{}
|
||||||
|
|
||||||
// parse the ONBUILD triggers by invoking the parser
|
// parse the ONBUILD triggers by invoking the parser
|
||||||
for stepN, step := range onBuildTriggers {
|
for _, step := range onBuildTriggers {
|
||||||
ast, err := parser.Parse(strings.NewReader(step))
|
ast, err := parser.Parse(strings.NewReader(step))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
@ -557,8 +561,6 @@ func (b *builder) processImageFrom(img *image.Image) error {
|
||||||
return fmt.Errorf("%s isn't allowed as an ONBUILD trigger", n.Value)
|
return fmt.Errorf("%s isn't allowed as an ONBUILD trigger", n.Value)
|
||||||
}
|
}
|
||||||
|
|
||||||
fmt.Fprintf(b.OutStream, "Trigger %d, %s\n", stepN, step)
|
|
||||||
|
|
||||||
if err := b.dispatch(i, n); err != nil {
|
if err := b.dispatch(i, n); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
|
@ -4255,10 +4255,9 @@ func (s *DockerSuite) TestBuildOnBuildOutput(c *check.C) {
|
||||||
c.Fatal(err)
|
c.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
if !strings.Contains(out, "Trigger 0, RUN echo foo") {
|
if !strings.Contains(out, "# Executing 1 build trigger") {
|
||||||
c.Fatal("failed to find the ONBUILD output", out)
|
c.Fatal("failed to find the build trigger output", out)
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *DockerSuite) TestBuildInvalidTag(c *check.C) {
|
func (s *DockerSuite) TestBuildInvalidTag(c *check.C) {
|
||||||
|
|
Loading…
Reference in a new issue