Skip to content

Commit fe8fd67

Browse files
authored
Add CI bundle pattern to distribution download (opensearch-project#5348)
* Add CI bundle pattern for ivy repo Signed-off-by: Zelin Hao <zelinhao@amazon.com> * Gradle update Signed-off-by: Zelin Hao <zelinhao@amazon.com> * Extract path Signed-off-by: Zelin Hao <zelinhao@amazon.com> * Change with customDistributionDownloadType Signed-off-by: Zelin Hao <zelinhao@amazon.com> * Add default for exception handle Signed-off-by: Zelin Hao <zelinhao@amazon.com> * Add documentations Signed-off-by: Zelin Hao <zelinhao@amazon.com> Signed-off-by: Zelin Hao <zelinhao@amazon.com>
1 parent 0475d1c commit fe8fd67

File tree

3 files changed

+37
-11
lines changed

3 files changed

+37
-11
lines changed

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
1717
- Added jackson dependency to server ([#5366] (https://github.com/opensearch-project/OpenSearch/pull/5366))
1818
- Added experimental extensions to main ([#5347](https://github.com/opensearch-project/OpenSearch/pull/5347))
1919
- Adding support to register settings dynamically ([#5495](https://github.com/opensearch-project/OpenSearch/pull/5495))
20+
- Add CI bundle pattern to distribution download ([#5348](https://github.com/opensearch-project/OpenSearch/pull/5348))
2021

2122
### Dependencies
2223
- Bumps `log4j-core` from 2.18.0 to 2.19.0

TESTING.md

+4
Original file line numberDiff line numberDiff line change
@@ -383,6 +383,10 @@ Use -Dtest.class and -Dtests.method to run a specific bwcTest test. For example
383383
-Dtests.class=org.opensearch.upgrades.RecoveryIT \
384384
-Dtests.method=testHistoryUUIDIsGenerated
385385

386+
Use `-PcustomDistributionDownloadType=bundle` to run the bwcTest against the test cluster with latest CI distribution bundle set up for the specified version; this property is default to min and exclusive choices between `bundle` and `min`:
387+
388+
./gradlew bwcTest -PcustomDistributionDownloadType=bundle
389+
386390
When running `./gradlew check`, minimal bwc checks are also run against compatible versions that are not yet released.
387391

388392
## BWC Testing against a specific remote/branch

buildSrc/src/main/java/org/opensearch/gradle/DistributionDownloadPlugin.java

+32-11
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,8 @@ public class DistributionDownloadPlugin implements Plugin<Project> {
7373
private static final String RELEASE_PATTERN_LAYOUT = "/core/opensearch/[revision]/[module]-min-[revision](-[classifier]).[ext]";
7474
private static final String SNAPSHOT_PATTERN_LAYOUT =
7575
"/snapshots/core/opensearch/[revision]/[module]-min-[revision](-[classifier])-latest.[ext]";
76+
private static final String BUNDLE_PATTERN_LAYOUT =
77+
"/ci/dbc/distribution-build-opensearch/[revision]/latest/linux/x64/tar/dist/opensearch/[module]-[revision](-[classifier]).[ext]";
7678

7779
private NamedDomainObjectContainer<OpenSearchDistribution> distributionsContainer;
7880
private NamedDomainObjectContainer<DistributionResolution> distributionsResolutionStrategiesContainer;
@@ -174,20 +176,39 @@ private static void setupDownloadServiceRepo(Project project) {
174176
return;
175177
}
176178
Object customDistributionUrl = project.findProperty("customDistributionUrl");
177-
// checks if custom Distribution Url has been passed by user from plugins
179+
Object customDistributionDownloadType = project.findProperty("customDistributionDownloadType");
180+
// distributionDownloadType is default min if is not specified; download the distribution from CI if is bundle
181+
String distributionDownloadType = customDistributionDownloadType != null
182+
&& customDistributionDownloadType.toString().equals("bundle") ? "bundle" : "min";
178183
if (customDistributionUrl != null) {
179184
addIvyRepo(project, DOWNLOAD_REPO_NAME, customDistributionUrl.toString(), FAKE_IVY_GROUP, "");
180185
addIvyRepo(project, SNAPSHOT_REPO_NAME, customDistributionUrl.toString(), FAKE_SNAPSHOT_IVY_GROUP, "");
181-
} else {
182-
addIvyRepo(
183-
project,
184-
DOWNLOAD_REPO_NAME,
185-
"https://artifacts.opensearch.org",
186-
FAKE_IVY_GROUP,
187-
"/releases" + RELEASE_PATTERN_LAYOUT,
188-
"/release-candidates" + RELEASE_PATTERN_LAYOUT
189-
);
190-
addIvyRepo(project, SNAPSHOT_REPO_NAME, "https://artifacts.opensearch.org", FAKE_SNAPSHOT_IVY_GROUP, SNAPSHOT_PATTERN_LAYOUT);
186+
return;
187+
}
188+
switch (distributionDownloadType) {
189+
case "bundle":
190+
addIvyRepo(project, DOWNLOAD_REPO_NAME, "https://ci.opensearch.org", FAKE_IVY_GROUP, BUNDLE_PATTERN_LAYOUT);
191+
addIvyRepo(project, SNAPSHOT_REPO_NAME, "https://ci.opensearch.org", FAKE_SNAPSHOT_IVY_GROUP, BUNDLE_PATTERN_LAYOUT);
192+
break;
193+
case "min":
194+
addIvyRepo(
195+
project,
196+
DOWNLOAD_REPO_NAME,
197+
"https://artifacts.opensearch.org",
198+
FAKE_IVY_GROUP,
199+
"/releases" + RELEASE_PATTERN_LAYOUT,
200+
"/release-candidates" + RELEASE_PATTERN_LAYOUT
201+
);
202+
addIvyRepo(
203+
project,
204+
SNAPSHOT_REPO_NAME,
205+
"https://artifacts.opensearch.org",
206+
FAKE_SNAPSHOT_IVY_GROUP,
207+
SNAPSHOT_PATTERN_LAYOUT
208+
);
209+
break;
210+
default:
211+
throw new IllegalArgumentException("Unsupported property argument: " + distributionDownloadType);
191212
}
192213
}
193214

0 commit comments

Comments
 (0)