Skip to content

Commit 13e4822

Browse files
committed
Support installing plugin SNAPSHOTs with SNASPHOT distribution
Signed-off-by: Andriy Redko <andriy.redko@aiven.io>
1 parent 034bd2b commit 13e4822

1 file changed

Lines changed: 4 additions & 14 deletions

File tree

distribution/tools/plugin-cli/src/main/java/org/opensearch/plugins/InstallPluginCommand.java

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -137,8 +137,6 @@
137137
*/
138138
class InstallPluginCommand extends EnvironmentAwareCommand {
139139

140-
private static final String PROPERTY_STAGING_ID = "opensearch.plugins.staging";
141-
142140
// exit codes for install
143141
/** A plugin with the same name is already installed. */
144142
static final int PLUGIN_EXISTS = 1;
@@ -309,7 +307,6 @@ private Path download(Terminal terminal, String pluginId, Path tmpDir, boolean i
309307
if (OFFICIAL_PLUGINS.contains(pluginId)) {
310308
final String url = getOpenSearchUrl(
311309
terminal,
312-
getStagingHash(),
313310
Version.CURRENT,
314311
isSnapshot(),
315312
pluginId,
@@ -341,38 +338,31 @@ private Path download(Terminal terminal, String pluginId, Path tmpDir, boolean i
341338
return downloadZip(terminal, pluginId, tmpDir, isBatch);
342339
}
343340

344-
// pkg private so tests can override
345-
String getStagingHash() {
346-
return System.getProperty(PROPERTY_STAGING_ID);
347-
}
348-
349341
boolean isSnapshot() {
350342
return Build.CURRENT.isSnapshot();
351343
}
352344

353345
/** Returns the url for an official opensearch plugin. */
354346
private String getOpenSearchUrl(
355347
final Terminal terminal,
356-
final String stagingHash,
357348
final Version version,
358349
final boolean isSnapshot,
359350
final String pluginId,
360351
final String platform
361352
) throws IOException, UserException {
362353
final String baseUrl;
363-
if (isSnapshot && stagingHash == null) {
354+
if (isSnapshot == false && version.isRelease() == false) {
364355
throw new UserException(
365356
ExitCodes.CONFIG,
366357
"attempted to install release build of official plugin on snapshot build of OpenSearch"
367358
);
368359
}
369-
if (stagingHash != null) {
360+
if (isSnapshot == true) {
370361
baseUrl = String.format(
371362
Locale.ROOT,
372-
"https://artifacts.opensearch.org/snapshots/plugins/%s/%s-%s",
363+
"https://artifacts.opensearch.org/snapshots/plugins/%s/%s",
373364
pluginId,
374-
version,
375-
stagingHash
365+
version + "-SNAPSHOT"
376366
);
377367
} else {
378368
baseUrl = String.format(

0 commit comments

Comments
 (0)