jboss-openshift / cct_module

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

S2I_SOURCE_DEPLOYMENTS_FILTER does not support sub-directories #336

Open vorburger opened 5 years ago

vorburger commented 5 years ago

https://github.com/jboss-container-images/openjdk/issues/75

jmtd commented 5 years ago

text from that issue:

While working on https://github.com/quarkusio/quarkus-quickstarts/pull/81, I'm using:

ARTIFACT_COPY_ARGS=-p -r lib/ *-runner.jar

seeing this:

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.

I've therefore attempted to use S2I_SOURCE_DEPLOYMENTS_FILTER instead of ARTIFACT_COPY_ARGS like this:

S2I_SOURCE_DEPLOYMENTS_FILTER=*-runner.jar lib/*.jar

as, according to https://github.com/jboss-openshift/cct_module/blob/master/jboss/container/s2i/core/api/README.adoc (which is somewhat hard to find BTW, see #74), it's a "Space separated list of filters to be applied when copying deployments." ...

INFO Copying deployments from target to /deployments...
'/tmp/src/target/quarkus-quickstart-1.0-SNAPSHOT-runner.jar' -> '/deployments/quarkus-quickstart-1.0-SNAPSHOT-runner.jar'
Build completed successfully

... but this does not work. Upon investigating this, I found that it does not actually copy the lib/*.jar (only *-runner.jar) - I'm guessing that S2I_SOURCE_DEPLOYMENTS_FILTER does not support sub-directories? It should.

jmtd commented 5 years ago

@vorburger did you also specify MAVEN_S2I_ARTIFACT_DIRS at the same time as S2I_SOURCE_DEPLOYMENTS_FILTER? I wonder whether the former on its own would be sufficient (the filter probaly defaults to *jar) but I have not tested it yet.

I've started trying to trace down precisely why we are claiming ARTIFACT_COPY_ARGS is deprecated. The deprecation warning was brought in with the massive refactoring in 1ff1d963, which unfortunately makes tracing why it was introduced a bit trickier (I was hoping that I could git blame myself to a JIRA issue number). That commit also introduced S2I_SOURCE_DEPLOYMENTS_FILTER and MAVEN_S2I_ARTIFACT_DIRS.

This is also relevant: https://issues.jboss.org/browse/CLOUD-3126 ("The openjdk18-openshift image has a bug when dealing with multi module maven projects") which appears on the surface to be the same problem.

pilhuhn commented 4 years ago

Has this been solved meanwhile? If so: how?

cescoffier commented 4 years ago

Same here? We are facing the same issue in Quarkus. Any ETA?

pilhuhn commented 4 years ago

This is what we do now:

    - name: MAVEN_S2I_ARTIFACT_DIRS
       value: external/target
     - name: SCRIPT_DEBUG
       value: "true"
     - name: S2I_SOURCE_DEPLOYMENTS_FILTER
       value: '*.jar lib'

The script_debug is technically not needed, but extremely helpful when having those kinds of issues. external/ is the dir, where in our multi-mvn-project build the final artifacts are put.

cescoffier commented 4 years ago

Thanks @pilhuhn ! So you replaced ARTIFACT_COPY_ARGS with S2I_SOURCE_DEPLOYMENTS_FILTER and MAVEN_S2I_ARTIFACT_DIRS.

pilhuhn commented 4 years ago

@cescoffier Yes

cescoffier commented 4 years ago

Thanks for the help @pilhuhn

If someone is looking for the Quarkus version, here it is. In the .s2i/environment file, you need:

MAVEN_S2I_ARTIFACT_DIRS=target
S2I_SOURCE_DEPLOYMENTS_FILTER=*-runner.jar lib
JAVA_OPTIONS=-Dquarkus.http.host=0.0.0.0
AB_JOLOKIA_OFF=true
brunobaiano commented 3 years ago

With this new quarkus version, i can´t use this command. Someone can help?

this works ARTIFACT_COPY_ARGS=-r quarkus-app/*

jmtd commented 3 years ago

Which quarkus version exactly are you using -- 1.13.3.Final or something else? Here's a working set of environment variables as specified for the getting-started quickstart for 1.13.3.Final:

MAVEN_S2I_ARTIFACT_DIRS=target/quarkus-app
S2I_SOURCE_DEPLOYMENTS_FILTER=app lib quarkus quarkus-run.jar
JAVA_OPTIONS=-Dquarkus.http.host=0.0.0.0

I think the above variables should work for any Quarkus version since the switch to "fast-jar" build layout by default.

brunobaiano commented 3 years ago

Thanks! this works for me!