Skip to content

Commit 6ac361f

Browse files
opensearch-trigger-bot[bot]github-actions[bot]zelinh
authored
[Backport 2.x] Add CI bundle pattern to distribution download (#5573)
* Add CI bundle pattern to distribution download (#5348) * Add CI bundle pattern for ivy repo Signed-off-by: Zelin Hao <[email protected]> * Gradle update Signed-off-by: Zelin Hao <[email protected]> * Extract path Signed-off-by: Zelin Hao <[email protected]> * Change with customDistributionDownloadType Signed-off-by: Zelin Hao <[email protected]> * Add default for exception handle Signed-off-by: Zelin Hao <[email protected]> * Add documentations Signed-off-by: Zelin Hao <[email protected]> Signed-off-by: Zelin Hao <[email protected]> (cherry picked from commit fe8fd67) Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> * Reorder logics to fix tests Signed-off-by: Zelin Hao <[email protected]> Signed-off-by: Zelin Hao <[email protected]> Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: Zelin Hao <[email protected]>
1 parent 994802a commit 6ac361f

File tree

3 files changed

+41
-13
lines changed

3 files changed

+41
-13
lines changed

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
1616
- Adding support to register settings dynamically ([#5495](https://github.com/opensearch-project/OpenSearch/pull/5495))
1717
- Adding auto release workflow ([#5582](https://github.com/opensearch-project/OpenSearch/pull/5582))
1818
- Added experimental support for extensions ([#5347](https://github.com/opensearch-project/OpenSearch/pull/5347)), ([#5518](https://github.com/opensearch-project/OpenSearch/pull/5518))
19+
- Add CI bundle pattern to distribution download ([#5348](https://github.com/opensearch-project/OpenSearch/pull/5348))
1920

2021

2122
### Dependencies

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

+36-13
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,8 @@ public class DistributionDownloadPlugin implements Plugin<Project> {
8080
private static final String RELEASE_PATTERN_LAYOUT = "/core/opensearch/[revision]/[module]-min-[revision](-[classifier]).[ext]";
8181
private static final String SNAPSHOT_PATTERN_LAYOUT =
8282
"/snapshots/core/opensearch/[revision]/[module]-min-[revision](-[classifier])-latest.[ext]";
83+
private static final String BUNDLE_PATTERN_LAYOUT =
84+
"/ci/dbc/distribution-build-opensearch/[revision]/latest/linux/x64/tar/dist/opensearch/[module]-[revision](-[classifier]).[ext]";
8385

8486
private NamedDomainObjectContainer<OpenSearchDistribution> distributionsContainer;
8587
private NamedDomainObjectContainer<DistributionResolution> distributionsResolutionStrategiesContainer;
@@ -196,24 +198,45 @@ private static void setupDownloadServiceRepo(Project project) {
196198
return;
197199
}
198200
Object customDistributionUrl = project.findProperty("customDistributionUrl");
199-
// checks if custom Distribution Url has been passed by user from plugins
201+
Object customDistributionDownloadType = project.findProperty("customDistributionDownloadType");
202+
// distributionDownloadType is default min if is not specified; download the distribution from CI if is bundle
203+
String distributionDownloadType = customDistributionDownloadType != null
204+
&& customDistributionDownloadType.toString().equals("bundle") ? "bundle" : "min";
205+
206+
addIvyRepo2(project, DOWNLOAD_REPO_NAME_ES, "https://artifacts-no-kpi.elastic.co", FAKE_IVY_GROUP_ES);
207+
addIvyRepo2(project, SNAPSHOT_REPO_NAME_ES, "https://snapshots-no-kpi.elastic.co", FAKE_SNAPSHOT_IVY_GROUP_ES);
208+
200209
if (customDistributionUrl != null) {
201210
addIvyRepo(project, DOWNLOAD_REPO_NAME, customDistributionUrl.toString(), FAKE_IVY_GROUP, "");
202211
addIvyRepo(project, SNAPSHOT_REPO_NAME, customDistributionUrl.toString(), FAKE_SNAPSHOT_IVY_GROUP, "");
203-
} else {
204-
addIvyRepo(
205-
project,
206-
DOWNLOAD_REPO_NAME,
207-
"https://artifacts.opensearch.org",
208-
FAKE_IVY_GROUP,
209-
"/releases" + RELEASE_PATTERN_LAYOUT,
210-
"/release-candidates" + RELEASE_PATTERN_LAYOUT
211-
);
212-
addIvyRepo(project, SNAPSHOT_REPO_NAME, "https://artifacts.opensearch.org", FAKE_SNAPSHOT_IVY_GROUP, SNAPSHOT_PATTERN_LAYOUT);
212+
return;
213+
}
214+
switch (distributionDownloadType) {
215+
case "bundle":
216+
addIvyRepo(project, DOWNLOAD_REPO_NAME, "https://ci.opensearch.org", FAKE_IVY_GROUP, BUNDLE_PATTERN_LAYOUT);
217+
addIvyRepo(project, SNAPSHOT_REPO_NAME, "https://ci.opensearch.org", FAKE_SNAPSHOT_IVY_GROUP, BUNDLE_PATTERN_LAYOUT);
218+
break;
219+
case "min":
220+
addIvyRepo(
221+
project,
222+
DOWNLOAD_REPO_NAME,
223+
"https://artifacts.opensearch.org",
224+
FAKE_IVY_GROUP,
225+
"/releases" + RELEASE_PATTERN_LAYOUT,
226+
"/release-candidates" + RELEASE_PATTERN_LAYOUT
227+
);
228+
addIvyRepo(
229+
project,
230+
SNAPSHOT_REPO_NAME,
231+
"https://artifacts.opensearch.org",
232+
FAKE_SNAPSHOT_IVY_GROUP,
233+
SNAPSHOT_PATTERN_LAYOUT
234+
);
235+
break;
236+
default:
237+
throw new IllegalArgumentException("Unsupported property argument: " + distributionDownloadType);
213238
}
214239

215-
addIvyRepo2(project, DOWNLOAD_REPO_NAME_ES, "https://artifacts-no-kpi.elastic.co", FAKE_IVY_GROUP_ES);
216-
addIvyRepo2(project, SNAPSHOT_REPO_NAME_ES, "https://snapshots-no-kpi.elastic.co", FAKE_SNAPSHOT_IVY_GROUP_ES);
217240
}
218241

219242
/**

0 commit comments

Comments
 (0)