Open sunix opened 3 years ago
There's a collision in mode detection here.
The Dockerfile in the root directory makes JKube assume we are running in Simple Dockerfile mode.
JIB build strategy is not compatible with (any of) the Dockerfile mode(s).
I'm not sure what the right approach here can be.
Some ideas:
My suggestion is avoid failure when possible: if the user is requesting the JIB build strategy, we have to obey and build with JIB even if the Dockerfile is not used.
It may be good to add a kind of summary at the end of the build. Something like:
[INFO] k8s: /home/sunix/github/parisjug/live-stream-question/target/docker/java/live-stream-question/1.0.0/tmp/docker-build.tar successfully built
[INFO] k8s: Docker image built with JIB strategy
[WARN] k8s: Dockerfile detected but ignored as Dockerfile mode is not supported with JIB build strategy
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 16.411 s
[INFO] Finished at: 2021-10-05T09:36:45+02:00
[INFO] ------------------------------------------------------------------------
Yes, but the user might be assuming that JKube is operationg in Dockerfile mode, and it's not, which will lead them to unexpected (and maybe unpleasant) results. Thus we might want the user to opt-in to said way of working by forcing them to provide an extra-flag.
Your proposal aligns with my second suggestion "Additional warning and fall-back to next mode....", but as I say there, I find this very dangerous. We can further discuss this during triage session.
As agreed during triage meeting:
jkube.ignore-docker-file-mode
)
-Djkube.ignore-docker-file-mode
)
Description
As a user, I would like to use the jib build strategy and not the default docker one. So when I am invoking:
It should use the jib strategy.
However if a Dockerfile is located in the root folder of the project, the error is raised:
Info
Eclipse JKube version : 1.4.0
Maven version (
mvn -v
) : 3.8.1 and 3.6.3Kubernetes / Red Hat OpenShift setup and version : N/A
If it's a bug, how to reproduce :
mvn k8s:build -Djkube.build.strategy=jib
Sample Reproducer Project : https://github.com/parisjug/live-stream-question