Uploaded image for project: 'OpenJDK'
  1. OpenJDK
  2. OPENJDK-96

The openjdk18-openshift image has a bug when dealing with multi module maven projects

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Major Major
    • None
    • None
    • container
    • None

      A new version of openjdk18-openshift was released today (https://access.redhat.com/containers/?tab=overview#/registry.access.redhat.com/redhat-openjdk-18/openjdk18-openshift) and it looks like it has a bug when dealing with multi module maven projects.

      The previously documented solution was to use "ARTIFACT_COPY_ARGS" which we were setting to "*/target" With the latest version of the s2i image, this results in the following warning/error...

      WARN ARTIFACT_COPY_ARGS is deprecated. Please use S2I_SOURCE_DEPLOYMENTS_FILTER to specify artifact types and MAVEN_S2I_ARTIFACT_DIRS to specify the build output directories to copy from.
      /opt/jboss/container/java/s2i/maven-s2i-overrides: line 44: pushd: /tmp/src/target: No such file or directory

      If I set "MAVEN_S2I_ARTIFACT_DIRS" to "*/target" then there are no errors but nothing actually gets copied. Eventually I got it to work by hardcoding the module directories (e.g. "module1/target,module2/target").

      I had to trace through all the source code because MAVEN_S2I_ARTIFACT_DIRS seems to be completely undocumented. I eventually found that I had to use commas to separate the list and I also found where the bug is...

      https://github.com/jboss-openshift/cct_module/blob/master/jboss/container/s2i/core/bash/artifacts/opt/jboss/container/s2i/core/s2i-core

      Line 94...
      if [ -d "${1}/${S2I_SOURCE_DEPLOYMENTS_DIR}" ]; then

      This returns false when using "*/target". It does not produce any error or logging but results in a failed image.

      I believe the following changes should be made...

      1. This code should be changed to support wildcards like it did previously.
      2. The documentation for openjdk18-openshift should be updated for MAVEN_S2I_ARTIFACT_DIRS and the deprecation of ARTIFACT_COPY_ARGS.
      https://access.redhat.com/documentation/en-us/red_hat_jboss_middleware_for_openshift/3/html/red_hat_java_s2i_for_openshift/reference#configuration_environment_variables
      https://docs.openshift.com/online/using_images/s2i_images/java.html"

      3. The scripts should log warnings if source artifacts are not found

              jdowland@redhat.com Jonathan Dowland
              bandrade@redhat.com bruno andrade
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

                Created:
                Updated: