Fix bc-fips jar hell with OpenSearch core 3.6.0#4652
Fix bc-fips jar hell with OpenSearch core 3.6.0#4652martin-gaievski wants to merge 4 commits intoopensearch-project:mainfrom
Conversation
…es it Signed-off-by: Martin Gaievski <gaievski@amazon.com>
|
Important Review skippedAuto incremental reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the Use the checkbox below for a quick retry:
📝 WalkthroughWalkthroughThe Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes 🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 inconclusive)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Tip Issue Planner is now in beta. Read the docs and try it out! Share your feedback on Discord. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Signed-off-by: Martin Gaievski <gaievski@amazon.com>
78132c0 to
5e5abf6
Compare
|
@martin-gaievski could you please apply spotless? |
I've done that before submitting this change, it doesn't do anything. All my change is in the build.gradle |
Hmm, usually it doesn't fail: https://github.com/opensearch-project/ml-commons/actions/runs/22206846541/job/64232588172?pr=4652 if spotlessApply is applied. |
It looks like the failure is not related to spotless rules, checkout the actual error: and this is problematic line: |
|
|
@martin-gaievski on client/build.gradle file line 85, |
5e5abf6 to
966bbe4
Compare
thanks @mingshl, I pushed new commit with suggested edit, this time spotless check has passed. I do see other 4 CI actions are pending, not sure if you can kink them off as a repo maintainer. |
approved CI. This should work. Let's see!! |
966bbe4 to
16f1feb
Compare
Replace deprecated project.shadow.component(publication) with from components.shadow in client, common, and spi build.gradle files to fix compatibility with Gradle 9.x. Signed-off-by: Martin Gaievski <gaievski@amazon.com>
16f1feb to
81ef5d0
Compare
Seems like it didn't fix the jar hell issue? |
Looking into this problem more deeply, it may be the issue with the opensearch build system, jar hell check should skip jars that match between |
|
@martin-gaievski this fixes ML to adapt to the gradle shadow plugin upgrade from v8 to v9, but this repo also needs to become aware of the FIPS build param. I will raise a PR shortly. |
|
@martin-gaievski @dhrubo-os @mingshl This should address the FIPS build param too: #4654 |
|
Looks like this is superceded by #4654 |
|
Closing the PR, as this is already solved. |
OpenSearch core PR #18921 added bc-fips to the distribution lib/ directory via fipsOnly configuration. The ml-algorithms module declares bc-fips as an implementation dependency, which bundles it in the plugin zip. This causes jar hell when installing the ML plugin since core already provides bc-fips.
Fix:
compileOnly means:
Available on the compile classpath → code that imports org.bouncycastle.crypto.fips.* compiles fine
not included in the plugin zip → no duplicate jar → no jar hell
At runtime, the plugin uses the bc-fips-2.1.2.jar already provided by OpenSearch core's lib/ directory
testRuntimeOnly means:
Available on the test runtime classpath → unit tests that exercise aws-encryption-sdk-java (which calls bc-fips internally) can find the classes
Does not affect the plugin zip packaging
Without
testRuntimeOnly, the bc-fips jar is absent from the test classpath. When unit tests run code paths that trigger aws-encryption-sdk-java → it tries to load BouncyCastle FIPS classes → ClassNotFoundException → test failure. AddingtestRuntimeOnlyprovides the jar specifically for tests, without affecting the packaged plugin.Error from neural-search CI: https://github.com/opensearch-project/neural-search/actions/runs/22154798712/job/64212973643