jboss-openshift / cct_module

CEKit modules shared by OpenShift container images
Apache License 2.0
45 stars 79 forks source link

[CLOUD-3387] s2i/run attempts to source missing scl-enable-maven #354

Open jmtd opened 5 years ago

jmtd commented 5 years ago

With the OpenJDK RHEL8/JDK11 image, on start up, one gets the following error

/usr/local/s2i/run: line 15: /opt/jboss/container/maven/default//scl-enable-maven: No such file or directory

The image uses the following modules at the top level (image):

  install:
  - name: jboss.container.openjdk.jdk
    version: "8"
  - name: jboss.container.java.s2i.bash
  - name: jboss.container.openjdk.jdk
    version: "11"
  - name: jboss.container.maven.35.bash
    version: "3.5"

Cekit (3.4.0) unravels this to the following full list

jboss.container.java.jvm.api     jboss.container.maven.35.bash       jboss.container.prometheus.bash
jboss.container.java.jvm.bash    jboss.container.maven.api           jboss.container.proxy.api
jboss.container.java.proxy.bash  jboss.container.maven.default.bash  jboss.container.s2i.core.api
jboss.container.java.run.bash    jboss.container.maven.s2i.api       jboss.container.s2i.core.bash
jboss.container.java.s2i.bash    jboss.container.maven.s2i.bash      jboss.container.user
jboss.container.jolokia.api      jboss.container.openjdk.jdk         jboss.container.util.logging.bash
jboss.container.jolokia.bash     jboss.container.prometheus.api

the script jboss/container/java/s2i/bash/artifacts/usr/local/s2i/run contains the following

# XXX: Not sure why we need to setup maven, but this was part of the old s2i-setup script, so...
source "${JBOSS_CONTAINER_MAVEN_DEFAULT_MODULE}/scl-enable-maven"

(that comment looks suspicious)

the var JBOSS_CONTAINER_MAVEN_DEFAULT_MODULE is not set in that script. It's defined as set in jboss/container/maven/default/bash/module.yaml, so it's set by the build process (in the Dockerfile) to /opt/jboss/container/maven/default/.

jmtd commented 5 years ago

Ultimately we can probably delete those two lines from the s2i/run script.

jmtd commented 5 years ago

same issue with openjdk/openjdk-11-rhel8 but not openjdk/openjdk-11-rhel7 or redhat-openjdk-18/openjdk18-openshift:1.6

jmtd commented 5 years ago

In the working image, /opt/jboss/container/maven/default/scl-enable-maven -> /opt/jboss/container/maven/35/scl-enable-maven

jmtd commented 5 years ago

This is the line that creates the symlink:

jboss/container/maven/default/bash/configure.sh:ln -s /opt/jboss/container/maven/35/* /opt/jboss/container/maven/default

There's a few things wrong there. It's 35-specific so will fail for 36 amongst other things. There directory is created by the 35scl module when copying in the single file scl-enable-maven which the 35 module doesn't have so doesn't copy and so doesn't create the directory.

m4rc77 commented 3 years ago

FYI: The error /usr/local/s2i/run: line 15: /opt/jboss/container/maven/default//scl-enable-maven: No such file or directory also occurs in UBI images registry.access.redhat.com/ubi8/openjdk-11:latest and registry.access.redhat.com/ubi8/openjdk-8:latest.

A simple RUN touch /opt/jboss/container/maven/default/scl-enable-maven in the Dockerfile let's the error disappear. Hope there are no side-effects ;-)

jmtd commented 3 years ago

A simple RUN touch /opt/jboss/container/maven/default/scl-enable-maven in the Dockerfile let's the error disappear. Hope there are no side-effects ;-)

That should be fine. I think we fixed this a while ago in our development branch but we haven't made a release since. (Soon!)