-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[dockerfile2llb] fix daemon crash: check for circular dependency in convert #999
Conversation
|
@@ -1130,6 +1134,41 @@ func isReachable(from, to *dispatchState) (ret bool) { | |||
return false | |||
} | |||
|
|||
func hasCircularDependency(states []*dispatchState) (bool, *dispatchState) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we have UT?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sure, added "TestDockerfileCircularDependencies"
visited := make(map[*dispatchState]struct{}) | ||
path := make(map[*dispatchState]struct{}) | ||
|
||
visit = func (state *dispatchState) bool { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: can be visit := ...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
visit is called recursively, I get "undefined: visit" when using " := "; this is the go's order of evaluation
Signed-off-by: Stepan Blyshchak <stepanblischak@gmail.com>
Signed-off-by: Stepan Blyshchak <stepanblischak@gmail.com>
… dependency To have stageName in error output in case one stage depends on itself Signed-off-by: Stepan Blyshchak <stepanblischak@gmail.com>
Signed-off-by: Stepan Blyshchak <stepanblischak@gmail.com>
1e6367b
to
ea4bb02
Compare
Thanks @Blyschak |
This should be back ported to Docker 18.09? |
@AkihiroSuda I have no specific wish to back port it to 18.09, so only if you want |
Signed-off-by: Stepan Blyshchak stepanblischak@gmail.com
By creating a simple dockerfile like this:
and building using following command:
DOCKER_BUILDKIT=1 /usr/bin/docker build -t test .
dockerd crashes (part of log):
Interestingly that dockerfile:
does not crashes that daemon however there is a cyclic dependency on stages and IMO resulted image is undefined.
Lagacy builder with same dockerfile fails with a another error:
I have added a check for circular dependency after convert fills all dependencies in, so now I get: