fabric8io/fabric8-maven-plugin

Build Names are suffixed with -*s2i regardless of build strategy

rohanKanojia opened this issue · 3 comments

Description

While building a simple project with Docker build strategy on Openshift. I can see that the build object created during the build process is wrongly named. It is always suffixed with *-s2i regardless of whether build strategy is S2I or Docker. Here are some logs which can offer more clarity of issue:

~/work/repos/fabric8-maven-plugin/samples/webapp : $ mvn fabric8:build -Dfabric8.build.strategy=docker
[INFO] Scanning for projects...
[INFO] 
[INFO] ---------------< io.fabric8:fabric8-maven-sample-webapp >---------------
[INFO] Building fabric8-maven-sample-webapp 4.4-SNAPSHOT
[INFO] --------------------------------[ war ]---------------------------------
[INFO] 
[INFO] --- fabric8-maven-plugin:4.4-SNAPSHOT:build (default-cli) @ fabric8-maven-sample-webapp ---
[INFO] F8: Running in OpenShift mode
[INFO] F8: Using OpenShift build with strategy Docker
[INFO] F8: Running generator webapp
[INFO] F8: webapp: Using fabric8/tomcat-9:1.2.0 as base image for webapp
[INFO] Copying files to /home/rohaan/work/repos/fabric8-maven-plugin/samples/webapp/target/docker/fabric8/fabric8-maven-sample-webapp/latest/build/maven
[INFO] Building tar: /home/rohaan/work/repos/fabric8-maven-plugin/samples/webapp/target/docker/fabric8/fabric8-maven-sample-webapp/latest/tmp/docker-build.tar
[INFO] F8: [fabric8/fabric8-maven-sample-webapp:latest] "webapp": Created docker source tar /home/rohaan/work/repos/fabric8-maven-plugin/samples/webapp/target/docker/fabric8/fabric8-maven-sample-webapp/latest/tmp/docker-build.tar
[INFO] F8: Creating BuildServiceConfig fabric8-maven-sample-webapp-s2i for Docker build
[INFO] F8: Creating ImageStream fabric8-maven-sample-webapp
[INFO] F8: Starting Build fabric8-maven-sample-webapp-s2i
[INFO] F8: Waiting for build fabric8-maven-sample-webapp-s2i-1 to complete...
[INFO] F8: 
[INFO] F8: Pulling image fabric8/tomcat-9:1.2.0 ...
[INFO] F8: Pulled 1/16 layers, 6% complete
[INFO] F8: Pulled 2/16 layers, 12% complete
[INFO] F8: Pulled 3/16 layers, 19% complete
[INFO] F8: Pulled 4/16 layers, 26% complete
[INFO] F8: Pulled 5/16 layers, 32% complete
[INFO] F8: Pulled 6/16 layers, 38% complete
[INFO] F8: Pulled 7/16 layers, 45% complete
[INFO] F8: Pulled 8/16 layers, 51% complete
[INFO] F8: Pulled 9/16 layers, 58% complete
[INFO] F8: Pulled 10/16 layers, 67% complete
[INFO] F8: Pulled 11/16 layers, 71% complete
[INFO] F8: Pulled 12/16 layers, 78% complete
[INFO] F8: Pulled 13/16 layers, 89% complete
[INFO] F8: Pulled 14/16 layers, 91% complete
[INFO] F8: Pulled 15/16 layers, 98% complete
[INFO] F8: Pulled 16/16 layers, 100% complete
[INFO] F8: Extracting
[INFO] F8: Step 1/11 : FROM fabric8/tomcat-9:1.2.0
[INFO] F8:  ---> 9e9dec7efc85
[INFO] F8: Step 2/11 : ENV DEPLOY_DIR /deployments
[INFO] F8:  ---> Running in 4453cb59f8c2
[INFO] F8:  ---> dd6c1a207fc8
[INFO] F8: Removing intermediate container 4453cb59f8c2
[INFO] F8: Step 3/11 : LABEL org.label-schema.description "" org.label-schema.version 4.4-SNAPSHOT org.label-schema.schema-version 1.0 org.label-schema.build-date 2019-11-04T19:32:23.053810 org.label-schema.name fabric8-maven-sample-webapp org.label-schema.vcs-ref 77ccfe8d4e0b998c30d467430e3542b159a27abf org.label-schema.vcs-url git@github.com:rohanKanojia/fabric8-maven-plugin.git
[INFO] F8:  ---> Running in cdf03d9eeb5c
[INFO] F8:  ---> 4efccead4666
[INFO] F8: Removing intermediate container cdf03d9eeb5c
[INFO] F8: Step 4/11 : EXPOSE 8080 8778
[INFO] F8:  ---> Running in 8a20cf3f38bc
[INFO] F8:  ---> fe6b1069810e
[INFO] F8: Removing intermediate container 8a20cf3f38bc
[INFO] F8: Step 5/11 : COPY maven /tmp/24693aef-0be3-4d2a-83cf-bf278da596e6/deployments/
[INFO] F8:  ---> f2e023acfaba
[INFO] F8: Removing intermediate container f656c90d7680
[INFO] F8: Step 6/11 : USER root
[INFO] F8:  ---> Running in d982a20feaeb
[INFO] F8:  ---> be3568f0d08a
[INFO] F8: Removing intermediate container d982a20feaeb
[INFO] F8: Step 7/11 : RUN chown -R jboss:jboss /tmp/24693aef-0be3-4d2a-83cf-bf278da596e6 && cp -rp /tmp/24693aef-0be3-4d2a-83cf-bf278da596e6/* / && rm -rf /tmp/24693aef-0be3-4d2a-83cf-bf278da596e6
[INFO] F8:  ---> Running in 37eadee34511
[INFO] F8: 
[INFO] F8:  ---> 5225761e5431
[INFO] F8: Removing intermediate container 37eadee34511
[INFO] F8: Step 8/11 : USER jboss
[INFO] F8:  ---> Running in c55adf8c8e7a
[INFO] F8:  ---> 35521c3dc7c0
[INFO] F8: Removing intermediate container c55adf8c8e7a
[INFO] F8: Step 9/11 : CMD /opt/tomcat/bin/deploy-and-run.sh
[INFO] F8:  ---> Running in 595504b5a137
[INFO] F8:  ---> 7f6b163e8b12
[INFO] F8: Removing intermediate container 595504b5a137
[INFO] F8: Step 10/11 : ENV "OPENSHIFT_BUILD_NAME" "fabric8-maven-sample-webapp-s2i-1" "OPENSHIFT_BUILD_NAMESPACE" "rokumar"
[INFO] F8:  ---> Running in c50d2d8a9488
[INFO] F8:  ---> b7f2e76b10c8
[INFO] F8: Removing intermediate container c50d2d8a9488
[INFO] F8: Step 11/11 : LABEL "io.openshift.build.name" "fabric8-maven-sample-webapp-s2i-1" "io.openshift.build.namespace" "rokumar"
[INFO] F8:  ---> Running in 3a987bc986bb
[INFO] F8:  ---> bb564729e67f
[INFO] F8: Removing intermediate container 3a987bc986bb
[INFO] F8: Successfully built bb564729e67f
[INFO] F8: 
[INFO] F8: Pushing image 172.30.39.149:5000/rokumar/fabric8-maven-sample-webapp:latest ...
[INFO] F8: Pushed 0/18 layers, 0% complete
[INFO] F8: Pushed 1/18 layers, 17% complete
[INFO] F8: Pushed 2/18 layers, 22% complete
[INFO] F8: Pushed 3/18 layers, 28% complete
[INFO] F8: Pushed 4/18 layers, 33% complete
[INFO] F8: Pushed 5/18 layers, 39% complete
[INFO] F8: Pushed 6/18 layers, 44% complete
[INFO] F8: Pushed 7/18 layers, 50% complete
[INFO] F8: Pushed 8/18 layers, 56% complete
[INFO] F8: Pushed 9/18 layers, 61% complete
[INFO] F8: Pushed 10/18 layers, 67% complete
[INFO] F8: Pushed 11/18 layers, 72% complete
[INFO] F8: Pushed 12/18 layers, 78% complete
[INFO] F8: Pushed 13/18 layers, 83% complete
[INFO] F8: Pushed 14/18 layers, 89% complete
[INFO] F8: Pushed 15/18 layers, 94% complete
[INFO] F8: Pushed 16/18 layers, 100% complete
[INFO] F8: Pushed 17/18 layers, 100% complete
[INFO] F8: Pushed 18/18 layers, 100% complete
[INFO] F8: Push successful
[INFO] F8: Build fabric8-maven-sample-webapp-s2i-1 in status Complete
[INFO] F8: Found tag on ImageStream fabric8-maven-sample-webapp tag: sha256:4ca6affa5aa38d8675dd45c3b26dbca2c02f9daceaa21e84bfda1bcdf3fdd650
[INFO] F8: ImageStream fabric8-maven-sample-webapp written to /home/rohaan/work/repos/fabric8-maven-plugin/samples/webapp/target/fabric8-maven-sample-webapp-is.yml
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  01:59 min
[INFO] Finished at: 2019-11-04T19:34:12+05:30
[INFO] ------------------------------------------------------------------------
~/work/repos/fabric8-maven-plugin/samples/webapp : $ oc get build
NAME                                TYPE      FROM      STATUS     STARTED              DURATION
fabric8-maven-sample-webapp-s2i-1   Docker    Binary    Complete   About a minute ago   1m39s
~/work/repos/fabric8-maven-plugin/samples/webapp : $
  • f-m-p version : 4.3.1
  • Maven version (mvn -v) :
Apache Maven 3.6.1 (d66c9c0b3152b2e69ee9bac180bb8fcc8e6af555; 2019-04-05T00:30:29+05:30)
Maven home: /usr/local/apache-maven/apache-maven-3.6.1
Java version: 11.0.2, vendor: Oracle Corporation, runtime: /usr/local/jdk-11.0.2
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "5.2.18-200.fc30.x86_64", arch: "amd64", family: "unix"
  • Kubernetes / OpenShift setup and version :
oc v3.11.0+0cbc58b
kubernetes v1.11.0+d4cacc0
features: Basic-Auth GSSAPI Kerberos SPNEGO

Server https://api.rh-idev.openshift.com:443
openshift v3.11.43
kubernetes v1.11.0+d4cacc0
  • If it's a bug, how to reproduce :
    Try doing a mvn fabric8:build -Dfabric8.build.strategy=docker and check the name of build object created. It would always be suffixed with *-s2i

The issue is not as trivial as it seems.

The suffix -s2i comes from the configuration property fabric8.s2i.buildNameSuffix (BuildMojo) which by default takes this value.

Given this fact we can consider 3 different scenarios each of one having a different expected behavior:

  • OpenShift build, S2I build strategy, no buildNameSuffix configuration: Build name gets suffixed with -s2i.
  • OpenShift build, Docker build strategy, no buildNameSuffix configuration: Build name doesn't get any suffix.
  • OpenShift build, Any build strategy, buildNameSuffix configuration exists: Build name gets suffixed with the provided buildNameSuffix.

hmm, I see. But from what I see build name is getting *-s2i suffix in the second option.

Yes, I described the expected behavior after the implementation. Just want to confirm this is what we want i.e. if s2i suffix is configured, keep it. Else if it's a s2i build append -2si by default.