-
Notifications
You must be signed in to change notification settings - Fork 61
[OPENJDK-2994] Cleanup: Fail the build if jdeps fails #537
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the right idea, but it's not quite working right yet. Given this example app
BASEIMG=ubi9/openjdk-21:1.18
APPSRC=https://github.com/jmtd/quarkus-quickstarts.git
CONTEXTDIR=getting-started
rev=3.9.2
OUTIMG=out-s2i-image
s2i build --pull-policy never --context-dir=$CONTEXTDIR -r=${rev} \
-e S2I_ENABLE_JLINK=true \
$APPSRC \
$BASEIMG \
$OUTIMG
The build fails, with the end of the log being
Working with:
/deployments/quarkus-run.jar
/deployments
jdeps failed: return code 2
Build completed successfully
Tracing the code, the logging before the last line is due to
redhat-openjdk-containers/modules/jlink/artifacts/opt/jboss/container/java/jlink/mkdeps.sh
Line 16 in 011fd65
echo "Working with: " |
The last line is printed by s2i itself, not our scripts.
So how come the exit 2
is not signalling failure to s2i?
I don't seem to be able to specify the revision, S2I isn't liking it: error: pathspec '3.9.2' did not match any file(s) known to git However running without it and ensuring that jdeps fails I can see similar strange behavior: Invoking mkdeps
I think the culprit is this script: https://github.com/jmtd/quarkus-quickstarts/blob/master/getting-started/.s2i/bin/assemble The S2I scripts on the container side exit at the correct point when jdeps fails, then S2I runs the user defined assemble script in the application. This seems like an issue with how S2I prioritizes and orders the scripts and I'm not sure if it's something we have any control over from the builder image. |
Hi @Josh-Matsuoka , that would be a really good explanation… unfortunately I pasted incorrect reproducer instructions. I have a local clone of quarkus-quickstarts with two remotes: quarkusio and jmtd. The tag 3.9.2 indeed doesn't exist in the jmtd remote -- but i wasn't using the master branch, I was using the tag from the quarkusio repository. So the following reproduces it, and sadly is not explained by a custom s2i assemble script:
|
The culprit here was this section:
The return code was reported and the scripts exited but $? became 0 due to the echo so from S2I's point of view the build succeeded. The better route here is to remove this, the return code gets passsed back up to assemble where we can use log_error to report it properly. This now works as expected: Working with: |
Addresses https://issues.redhat.com/browse/OPENJDK-2994
This adds some error checking to the s2i assemble script to make sure if any of the subcommands fail (mkdeps, mkstrippeddeps, etc) that the error is communicated and the build fails.
Requires #535 for manual testing with 21
To test:
Add the following to generate_deps or find an application that otherwise causes jdeps to fail:
Build the image
Run an S2i build:
The build will hit the generate_deps failure and exit after that point.