Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace checked-in ZIPs with dynamic dependencies #327

Merged
merged 2 commits into from
Apr 14, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,6 @@ out/
*.log
http
.project
.settings
.settings
src/test/resources/job-scheduler/
src/test/resources/bwc/
39 changes: 34 additions & 5 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,21 @@ buildscript {
// 2.0.0-alpha1-SNAPSHOT -> 2.0.0.0-alpha1-SNAPSHOT
version_tokens = opensearch_version.tokenize('-')
opensearch_build = version_tokens[0] + '.0'
job_scheduler_no_snapshot = opensearch_build
if (buildVersionQualifier) {
opensearch_build += "-${buildVersionQualifier}"
job_scheduler_no_snapshot += "-${buildVersionQualifier}"
}
if (isSnapshot) {
opensearch_build += "-SNAPSHOT"
}
opensearch_no_snapshot = opensearch_version.replace("-SNAPSHOT","")
job_scheduler_resource_folder = "src/test/resources/job-scheduler"
// notification_version = System.getProperty("notification.version", opensearch_build)
common_utils_version = System.getProperty("common_utils.version", opensearch_build)
job_scheduler_version = System.getProperty("job_scheduler_version.version", opensearch_build)
job_scheduler_build_download = 'https://ci.opensearch.org/ci/dbc/distribution-build-opensearch/' + opensearch_no_snapshot +
'/latest/linux/x64/builds/opensearch/plugins/opensearch-job-scheduler-' + job_scheduler_no_snapshot + '.zip'
kotlin_version = System.getProperty("kotlin.version", "1.6.10")
}

Expand Down Expand Up @@ -234,6 +240,17 @@ test {
systemProperty 'tests.security.manager', 'false'
}

ext.getPluginResource = { download_to_folder, download_from_src ->
project.mkdir download_to_folder
ant.get(src: download_from_src,
dest: download_to_folder,
httpusecaches: false)
return fileTree(download_to_folder).getSingleFile()
}

// Download the job scheduler test dependency
getPluginResource(job_scheduler_resource_folder, job_scheduler_build_download)
Copy link
Contributor

@thalurur thalurur Apr 14, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

does this mean this method will be called for all gradle tasks?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's right. I believe that we also initialize the integTest clusters with the plugin zips for all targets in the configuration phase, so to get around downloading the resource always, we would need to refactor the cluster setup, which I didn't have time to take on at this point

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

got it, lets create an issue for this - we don't need to address it immediately

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.


File repo = file("$buildDir/testclusters/repo")
def _numNodes = findProperty('numNodes') as Integer ?: 1
testClusters.integTest {
Expand All @@ -254,7 +271,7 @@ testClusters.integTest {
plugin(provider({
new RegularFile() {
@Override
File getAsFile() { fileTree("src/test/resources/job-scheduler").getSingleFile() }
File getAsFile() { fileTree(job_scheduler_resource_folder).getSingleFile() }
}
}))

Expand Down Expand Up @@ -347,6 +364,18 @@ String bwcVersion = "1.13.2.0"
String bwcJobSchedulerVersion = "1.13.0.0"
String baseName = "indexmanagementBwcCluster"
String bwcFilePath = "src/test/resources/bwc/"
String bwc_js_resource_location = bwcFilePath + "job-scheduler/" + bwcJobSchedulerVersion
String bwc_im_resource_location = bwcFilePath + "indexmanagement/" + bwcVersion

// Downloads the bwc job scheduler version
String bwc_js_download_url = "https://github.com/opendistro-for-elasticsearch/job-scheduler/releases/download/v" +
bwcJobSchedulerVersion + "/job-scheduler-artifacts.zip"
getPluginResource(bwc_js_resource_location, bwc_js_download_url)

// Downloads the bwc index management version
String bwc_im_download_url = "https://github.com/opendistro-for-elasticsearch/index-management/releases/download/v" +
bwcVersion + "/index-management-artifacts.zip"
getPluginResource(bwc_im_resource_location, bwc_im_download_url)

2.times {i ->
testClusters {
Expand All @@ -360,7 +389,7 @@ String bwcFilePath = "src/test/resources/bwc/"
return new RegularFile() {
@Override
File getAsFile() {
return fileTree(bwcFilePath + "job-scheduler/" + bwcJobSchedulerVersion).getSingleFile()
return fileTree(bwc_js_resource_location).getSingleFile()
}
}
}
Expand All @@ -372,7 +401,7 @@ String bwcFilePath = "src/test/resources/bwc/"
return new RegularFile() {
@Override
File getAsFile() {
return fileTree(bwcFilePath + "indexmanagement/" + bwcVersion).getSingleFile()
return fileTree(bwc_im_resource_location).getSingleFile()
}
}
}
Expand All @@ -397,7 +426,7 @@ task prepareBwcTests {
return new RegularFile() {
@Override
File getAsFile() {
return fileTree("src/test/resources/job-scheduler").getSingleFile()
return fileTree(job_scheduler_resource_folder).getSingleFile()
}
}
}
Expand Down Expand Up @@ -545,7 +574,7 @@ testClusters.mixedCluster {
node.plugin(provider({
new RegularFile() {
@Override
File getAsFile() { fileTree("src/test/resources/job-scheduler").getSingleFile() }
File getAsFile() { fileTree(job_scheduler_resource_folder).getSingleFile() }
}
}))

Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.