Skip to content

ONBUILD triggers are passed to grandchildren #6445

@gdm85

Description

@gdm85

I have been reading a bit comments on #3254 however I think there is a bug with the inheritance of ONBUILD traits.

If you run this testcase script I made you will get this output:

Sending build context to Docker daemon  2.56 kB
Sending build context to Docker daemon 
Step 0 : FROM ubuntu:13.10
 ---> 5e019ab7bf6d
Step 1 : RUN echo I am your grand father
 ---> Running in 716bf27e3daa
I am your grand father
 ---> 08f54b7b1d27
Removing intermediate container 716bf27e3daa
Step 2 : ONBUILD RUN echo I am your father
 ---> Running in 36b48fb45a94
 ---> 996c6025057e
Removing intermediate container 36b48fb45a94
Successfully built 996c6025057e
--------------------------- Built base1
Sending build context to Docker daemon  2.56 kB
Sending build context to Docker daemon 
Step 0 : FROM base1
# Executing 1 build triggers
Step onbuild-0 : RUN echo I am your father
 ---> Running in b51dcf17e3c1
I am your father
 ---> bf166aafd85f
 ---> bf166aafd85f
Removing intermediate container b51dcf17e3c1
Successfully built bf166aafd85f
--------------------------- Built base2
Sending build context to Docker daemon  2.56 kB
Sending build context to Docker daemon 
Step 0 : FROM base2
# Executing 1 build triggers
Step onbuild-0 : RUN echo I am your father
 ---> Running in c934c886134e
I am your father
 ---> e7b35d4ed757
 ---> e7b35d4ed757
Removing intermediate container c934c886134e
Step 1 : EXPOSE 1000
 ---> Running in 7e133b504bec
 ---> 3cae131d2ef4
Removing intermediate container 7e133b504bec
Successfully built 3cae131d2ef4
--------------------------- Built base3

As you can see, base3 is running an ONBUILD trait that should only have been on base2. Building of base3 is saying the same as base2, although no output should instead have been printed.

This is blocking me from using ONBUILD effectively.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions