Docker Build Image may wrongly read status for #isBuildSuccessIndicated
See original GitHub issueI’ve just spotted this bug when I tried to build the image where in Dockerfile I install some python modules via pip3 (using RUN). The image building should have failed as the result of RUN chained commands returned non-zero result but (!) the Benjamin’s gradle-docker-plugin stated that it succeeded.
That was strange enough so I started to investigate. I found that python module installation via pip3 prints something like this: Successfully built jsondiff wrapt PyYAML future pycparser
causing:
- the gradle task to succeed even though it shouldn’t have (due to non-zero exit code)
- Benjamin’s plugin to print something like this:
Created image with ID 'jsondiff wrapt PyYAML future pycparser'
and probably such bizarre image id is used later on.
Even if image creation was successful (RUN command returned success) I’m afraid that wrong image id could be picked up.
The problem is in BuildResponseItem#BUILD_SUCCESS && BuildResponseItem#isBuildSuccessIndicated. I’m not sure what other programmatic option can be used to check if build was successful besides tracing logs, but if logs really must be used, then I would suggest to enhance BUILD_SUCCESS pattern to include regexp of the ID pattern (or check BUILD_SUCCESS first and then check the ID presence using regexp to save some CPU cycles). Or maybe BuildResponseItem should wait for very last lines somehow?
The sample output from docker image build is:
Successfully built c0d3ff212415
Successfully tagged abc:latest <-- optional
Issue Analytics
- State:
- Created 5 years ago
- Reactions:3
- Comments:6 (4 by maintainers)
I still persist that this issue should be addressed.
Please re-open, don’t ignore this issue just like that.