Closed CurryWurry closed 5 years ago
@CurryWurry : cool, Thanks for the report. Will try to reproduce and fix before 4.3.0
@rohanKanojia Hi Rohan, have you been able to replicate this issue?
Hi, sorry I forgot to check. Let me do it tomorrow.
@CurryWurry : Hi, I'm not sure if I tested it properly but I faced a different error when building:
[INFO] --- fabric8-maven-plugin:4.3-SNAPSHOT:build (default-cli) @ fabric8-maven-sample-external-resources ---
[INFO] F8: Running in OpenShift mode
[INFO] F8: Using OpenShift build with strategy Docker
[INFO] Copying files to /home/rohaan/work/repos/fmp-sample-external-resources/target/docker/external-resources/build/target
[WARNING] F8: Dockerfile /home/rohaan/work/repos/fmp-sample-external-resources/Dockerfile does not contain an ADD or COPY directive to include assembly create
d at target/. Ignoring assembly.
[INFO] Building tar: /home/rohaan/work/repos/fmp-sample-external-resources/target/docker/external-resources/tmp/docker-build.tar
[INFO] F8: [external-resources:latest]: Created docker source tar /home/rohaan/work/repos/fmp-sample-external-resources/target/docker/external-resources/tmp/d
ocker-build.tar
[INFO] F8: Creating BuildServiceConfig external-resources-s2i for Docker build
[INFO] F8: Creating ImageStream external-resources
[INFO] F8: Starting Build external-resources-s2i
[INFO] F8: Waiting for build external-resources-s2i-1 to complete...
[INFO] F8:
[INFO] F8: Pulling image openjdk:11 ...
[INFO] F8: Pulled 0/8 layers, 10% complete
[INFO] F8: Pulled 1/8 layers, 18% complete
[INFO] F8: Pulled 2/8 layers, 29% complete
[INFO] F8: Pulled 3/8 layers, 44% complete
[INFO] F8: Pulled 4/8 layers, 65% complete
[INFO] F8: Pulled 5/8 layers, 66% complete
[INFO] F8: Pulled 6/8 layers, 77% complete
[INFO] F8: Pulled 7/8 layers, 88% complete
[INFO] F8: Pulled 7/8 layers, 88% complete
[ERROR] F8: Failed to execute the build: io.fabric8.maven.core.service.Fabric8ServiceException: Unable to build the image using the OpenShift build service
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 01:34 min
[INFO] Finished at: 2019-10-01T19:59:24+05:30
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal io.fabric8:fabric8-maven-plugin:4.3-SNAPSHOT:build (default-cli) on project fabric8-maven-sample-external-resources: Failed to
execute the build: io.fabric8.maven.core.service.Fabric8ServiceException: Unable to build the image using the OpenShift build service -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
I tested using this project: https://github.com/r0haaaan/fmp-openshift-docker-buildmode
Could you please confirm if the reproducing sample has correct configuration?
hey @rohanKanojia
I cloned your repo and build the project against my local minishift install, however using the 4.2.0 version of FMP. Adjusted the Dockerfile a bit to echo myVAR:
ENV JAR=$myVAR
ENTRYPOINT echo "ARGUMENT IS $JAR"
The build went ok, but no build argument is passed:
[INFO] --- fabric8-maven-plugin:4.2.0:build (fmp) @ fabric8-maven-sample-external-resources --- [INFO] F8: Running in OpenShift mode [INFO] F8: Using OpenShift build with strategy Docker [INFO] Copying files to ...\fmp-openshift-docker-buildmode-master\target\docker\external-resources\build\target [WARNING] F8: Dockerfile ...fmp-openshift-docker-buildmode-master\Dockerfile does not contain an ADD or COPY directive to include assembly created at target/. Ignoring assembly. [INFO] Building tar: ...\fmp-openshift-docker-buildmode-master\target\docker\external-resources\tmp\docker-build.tar [INFO] F8: [external-resources:latest]: Created docker source tar ...\fmp-openshift-docker-buildmode-master\target\docker\external-resources\tmp\docker-build.tar [INFO] F8: Creating BuildServiceConfig external-resources-s2i for Docker build [INFO] F8: Creating ImageStream external-resources [INFO] F8: Starting Build external-resources-s2i [INFO] F8: Waiting for build external-resources-s2i-1 to complete... [INFO] F8: Step 1/7 : FROM openjdk:11 [INFO] F8: ---> 0d26b0359fd2 [INFO] F8: Step 2/7 : ARG myVAR [INFO] F8: ---> Running in 6558654559da [INFO] F8: ---> 104a5f29df50 [INFO] F8: Removing intermediate container 6558654559da [INFO] F8: Step 3/7 : VOLUME /tmp [INFO] F8: ---> Running in 3a4c21ac1193 [INFO] F8: ---> 2c0e18eccc34 [INFO] F8: Removing intermediate container 3a4c21ac1193 [INFO] F8: Step 4/7 : ENV JAR $myVAR [INFO] F8: ---> Running in 587007b083da [INFO] F8: ---> 788db217ed76 [INFO] F8: Removing intermediate container 587007b083da [INFO] F8: Step 5/7 : ENTRYPOINT echo "ARGUMENT IS $JAR - ${JAR}" [INFO] F8: ---> Running in e1d15ca9e499 [INFO] F8: ---> b44807342ea1 [INFO] F8: Removing intermediate container e1d15ca9e499 [INFO] F8: Step 6/7 : ENV "OPENSHIFT_BUILD_NAME" "external-resources-s2i-1" "OPENSHIFT_BUILD_NAMESPACE" "myproject" [INFO] F8: ---> Running in cfbf2eeb3eeb [INFO] F8: ---> b11827ecee72 [INFO] F8: Removing intermediate container cfbf2eeb3eeb [INFO] F8: Step 7/7 : LABEL "io.openshift.build.name" "external-resources-s2i-1" "io.openshift.build.namespace" "myproject" [INFO] F8: ---> Running in 49f84e597046 [INFO] F8: ---> d4cb103d9311 [INFO] F8: Removing intermediate container 49f84e597046 [INFO] F8: Successfully built d4cb103d9311 [INFO] F8: Pushing image 172.30.1.1:5000/myproject/external-resources:latest ... [INFO] F8: Pushed 0/7 layers, 0% complete [INFO] F8: Pushed 1/7 layers, 15% complete [INFO] F8: Pushed 2/7 layers, 38% complete [INFO] F8: Pushed 3/7 layers, 55% complete [INFO] F8: Pushed 4/7 layers, 66% complete [INFO] F8: Pushed 5/7 layers, 97% complete [INFO] F8: Pushed 6/7 layers, 99% complete [INFO] F8: Pushed 7/7 layers, 100% complete [INFO] F8: Push successful [INFO] F8: Build external-resources-s2i-1 in status Complete
Testing image:
$>docker run 172.30.1.1:5000/myproject/external-resources
ARGUMENT IS -
I'm logged in via OC to project "myproject" on Minishift, and am using the Minishift Docker daemon (configured using DOCKER_HOST env variable)
@CurryWurry : Hi, Yes I can reproduce your issue. I think maybe it's coming from docker-maven-plugin. I need to fix it there.
strange, when I build docker image in kubernetes mode. arguement is coming. I don't think it's from dmp.
[INFO]
[INFO] ---------< io.fabric8:fabric8-maven-sample-external-resources >---------
[INFO] Building Fabric8 Maven :: Sample :: External Reources 4.3-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- fabric8-maven-plugin:4.3-SNAPSHOT:build (default-cli) @ fabric8-maven-sample-external-resources ---
[INFO] F8: Running in Kubernetes mode
[INFO] F8: Building Container image with Docker in Kubernetes mode
[INFO] Copying files to /home/Rohaan/work/repos/fmp-openshift-docker-buildmode/target/docker/external-resources/build/target
[WARNING] F8: Dockerfile /home/Rohaan/work/repos/fmp-openshift-docker-buildmode/Dockerfile does not contain an ADD or COPY directive to include assembly created at target/. Ignoring assembly.
[INFO] Building tar: /home/Rohaan/work/repos/fmp-openshift-docker-buildmode/target/docker/external-resources/tmp/docker-build.tar
[INFO] F8: [external-resources:latest]: Created docker-build.tar in 1 second
[INFO] F8: [external-resources:latest]: Built image sha256:04dd7
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 5.411 s
[INFO] Finished at: 2019-10-07T19:48:05+05:30
[INFO] ------------------------------------------------------------------------
~/work/repos/fmp-openshift-docker-buildmode : $ docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
external-resources latest 04dd75400d4b 7 seconds ago 605 MB
fabric8/fabric8-maven-sample-external-resources latest 59f2f93050ff 20 minutes ago 605 MB
172.30.1.1:5000/myproject/external-resources latest 0ad991b1057e 20 minutes ago 605 MB
172.30.1.1:5000/myproject/random-generator 0.0.1 4cf90ced3184 30 minutes ago 610 MB
docker.io/openshift/origin-node v3.11.0 4dd5a4550da4 3 days ago 1.19 GB
docker.io/openshift/origin-control-plane v3.11.0 f70d2f036942 3 days ago 831 MB
docker.io/openshift/origin-docker-builder v3.11.0 a5ffc31506bc 3 days ago 462 MB
docker.io/openshift/origin-deployer v3.11.0 3a966789d934 3 days ago 385 MB
docker.io/openshift/origin-hyperkube v3.11.0 d0169046cac7 3 days ago 510 MB
docker.io/openshift/origin-cli v3.11.0 f406c45164c9 3 days ago 385 MB
docker.io/openshift/origin-hypershift v3.11.0 9402852785ff 3 days ago 551 MB
docker.io/openshift/origin-pod v3.11.0 bd95bbb2f8af 3 days ago 263 MB
<none> <none> 96ce58cae670 2 weeks ago 831 MB
docker.io/openshift/origin-haproxy-router v3.11.0 92225ca78ac2 2 weeks ago 411 MB
docker.io/openjdk 11 0d26b0359fd2 3 weeks ago 605 MB
docker.io/openshift/origin-docker-registry v3.11.0 875b808526a0 8 months ago 310 MB
docker.io/openshift/origin-web-console v3.11.0 be30b6cce5fa 11 months ago 339 MB
docker.io/openshift/origin-service-serving-cert-signer v3.11 47dadf9d43b6 11 months ago 276 MB
docker.io/fabric8/s2i-java 2.3 10a0b9c43308 14 months ago 573 MB
~/work/repos/fmp-openshift-docker-buildmode : $ docker run 04dd75400d4b
ARGUMENT IS TEST
~/work/repos/fmp-openshift-docker-buildmode : $
hey @rohanKanojia . Thanks for checking. So it seems it only doesn't work in openshift mode
Yep, let me see why build args are not passing
Does ( or can this ) fix be applied to docker-maven-plugin ?
I'm seeing this same issue with docker-maven-plugin 0.31.0 and 0.31-SNAPSHOT when trying to build an image with Openshift.
Thanks.
@plord12 : As far as I remember, it was working when I did it using docker-maven-plugin. But not on Openshift, on minikube
bdw, Why are you not using Fabric8 Maven Plugin instead? it includes docker-maven-plugin and it is dmp's equivalent for Openshift/Kubernetes.
In order for it to work on Openshift, you also need to specify args in BuildConfig
's BuildStrategy. FMP takes care of it for you.
@plord12 : As far as I remember, it was working when I did it using docker-maven-plugin. But not on Openshift, on minikube
Okay, thanks. Trying some more I found that the following Dockerfile snippet works with docker-desktop and mimikube but fails on minishift -
ARG docker_base_version
FROM sbrt-base:${docker_base_version}
However I can drop ARG to get it to work on all three. So I'm good to go :-)
bdw, Why are you not using Fabric8 Maven Plugin instead? it includes docker-maven-plugin and it is dmp's equivalent for Openshift/Kubernetes.
I'm currently using the start goal which isn't available on Fabric8 Maven Plugin ( as far as I can see anyhow ).
@plord12 : oh, yeah. If you're dealing with docker only, then you should use docker-maven-plugin. FMP is not designed to deal with single containers.
I'm trying to pass build arguments using an external Dockerfile, but fail to get it working
global properties:
`