Fix distribution build: pin analytics-api dep to 3.7.0-SNAPSHOT#5455
Fix distribution build: pin analytics-api dep to 3.7.0-SNAPSHOT#5455lezzago wants to merge 2 commits into
Conversation
The distribution build (./build.sh -s false) sets
-Dopensearch.version=3.7.0, which made the dep declared as
${opensearch_version} resolve to "3.7.0" — a release coordinate that
will never exist for org.opensearch.sandbox:analytics-api. OpenSearch
core's sandbox/build.gradle deliberately disables publish tasks for
sandbox artifacts unless -Dsandbox.enabled=true AND build.snapshot=true,
explicitly to "prevent accidental inclusion of these artifacts in a
release distribution". Build 11942 fails at :opensearch-sql-plugin:compileJava
with `Could not find org.opensearch.sandbox:analytics-api:3.7.0`.
Hardcode the dep version to "3.7.0-SNAPSHOT" — same pattern already used
by core/build.gradle:67 for the same artifact. The bundled jar continues
to ship inside the SQL plugin so QueryPlanExecutor remains resolvable at
runtime even when the analytics-engine plugin is absent (verified by
loading the rebuilt plugin into a 3.7.0 cluster — all 11 plugins load
cleanly, cluster transitions to GREEN).
Resolves opensearch-project#5434
Signed-off-by: Ashish Agrawal <ashisagr@amazon.com>
PR Code Analyzer ❗AI-powered 'Code-Diff-Analyzer' found issues on commit 8b62fc2.
The table above displays the top 10 most important findings. Pull Requests Author(s): Please update your Pull Request according to the report above. Repository Maintainer(s): You can Thanks. |
|
Re: Code-Diff-Analyzer findings — both flags are about the hardcoded Why a literal
Why this isn't a new pattern: Re: SNAPSHOT supply-chain risk: the SQL plugin already pulls |
| api project(":ppl") | ||
| api project(':api') | ||
| implementation("org.opensearch.sandbox:analytics-api:${opensearch_version}") | ||
| implementation 'org.opensearch.sandbox:analytics-api:3.7.0-SNAPSHOT' |
There was a problem hiding this comment.
Why is the env var not working? https://github.com/oepnsearch-project/sql/blob/9ae998347aa4cd3d4a074f954a30eba9fa7d721a/build.gradle#L9
There was a problem hiding this comment.
Good catch — bare ${opensearch_version} doesn't work because that variable swings between two values:
| Mode | -Dopensearch.version |
resolves to |
|---|---|---|
| Local dev (default) | not passed | 3.7.0-SNAPSHOT ✅ |
| CI distribution build | 3.7.0 |
3.7.0 ❌ — sandbox artifact never published as a release coord |
OpenSearch core's sandbox/build.gradle explicitly disables release publishing for sandbox artifacts ("prevent accidental inclusion of these artifacts in a release distribution"), so analytics-api:3.7.0 doesn't exist anywhere — only 3.7.0-SNAPSHOT does. That's the actual #5434 failure.
Appending -SNAPSHOT directly (${opensearch_version}-SNAPSHOT) doesn't work either: in local dev that produces 3.7.0-SNAPSHOT-SNAPSHOT.
Pushed 8b62fc2 which uses the same tokenize pattern build.gradle:12 already uses for opensearch_build:
implementation "org.opensearch.sandbox:analytics-api:${opensearch_version.tokenize('-')[0]}-SNAPSHOT"Strips any existing -SNAPSHOT suffix, then appends one. Resolves to 3.7.0-SNAPSHOT in both modes; auto-tracks version bumps. Verified locally with both -Dopensearch.version=3.7.0 -Dbuild.snapshot=false (CI release) and the default snapshot mode.
Address review feedback: instead of hardcoding "3.7.0-SNAPSHOT", derive
the snapshot version from ${opensearch_version} via the same tokenize
pattern build.gradle:12 already uses for opensearch_build. The dep now
auto-tracks version bumps and resolves correctly in both release-mode CI
(${opensearch_version}=3.7.0) and local snapshot builds
(${opensearch_version}=3.7.0-SNAPSHOT) without producing a malformed
"-SNAPSHOT-SNAPSHOT" suffix.
Signed-off-by: Ashish Agrawal <ashisagr@amazon.com>
Summary
Pin
analytics-apito3.7.0-SNAPSHOTinplugin/build.gradle. The previous${opensearch_version}resolves to3.7.0in release builds, but sandbox artifacts are never published with a release coordinate, so the build fails:Same hardcoded snapshot pattern is already used in
core/build.gradle:67for the same artifact.Resolves #5434
Test plan
./gradlew assemble -DskipTests=true(snapshot mode) — passesbash scripts/build.sh -v 3.7.0 -p linux -a arm64 -s false -o buildsreproduced locally — passes (was failing onmain)