Skip to content

Commit

Permalink
Update the URL for latest index.json in retrievePreviousBuild library (
Browse files Browse the repository at this point in the history
…opensearch-project#367)

Signed-off-by: Zelin Hao <zelinhao@amazon.com>
  • Loading branch information
zelinh authored Jan 25, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
1 parent 8b7df12 commit ae6bcad
Showing 2 changed files with 18 additions and 6 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
@@ -121,7 +121,7 @@ jacocoTestReport {
}
}

String version = '6.1.0'
String version = '6.1.1'

task updateVersion {
doLast {
22 changes: 17 additions & 5 deletions vars/retrievePreviousBuild.groovy
Original file line number Diff line number Diff line change
@@ -30,11 +30,23 @@ void call(Map args = [:]) {
def DISTRIBUTION_BUILD_NUMBER

if (previousBuildId.equalsIgnoreCase("latest")) {
DISTRIBUTION_BUILD_NUMBER = sh(
script: "curl -sL https://ci.opensearch.org/ci/dbc/${DISTRIBUTION_JOB_NAME}/${version}/index.json | jq -r \".latest\"",
returnStdout: true
).trim()
//Once we have new index.json, URL will be changed to: https://ci.opensearch.org/ci/dbc/${DISTRIBUTION_JOB_NAME}/${version}/index/${platform}/${architecture}/${distribution}/index.json
def latestIndexStatus = sh (
script: "curl -sL ${PUBLIC_ARTIFACT_URL}/${DISTRIBUTION_JOB_NAME}/${version}/index/${DISTRIBUTION_PLATFORM}/${DISTRIBUTION_ARCHITECTURE}/${distribution}/index.json | jq -r \".latest\" > /dev/null 2>&1",
returnStatus: true
)
if (latestIndexStatus == 0) {
echo("Use new URL path for the latest index.")
DISTRIBUTION_BUILD_NUMBER = sh(
script: "curl -sL ${PUBLIC_ARTIFACT_URL}/${DISTRIBUTION_JOB_NAME}/${version}/index/${DISTRIBUTION_PLATFORM}/${DISTRIBUTION_ARCHITECTURE}/${distribution}/index.json | jq -r \".latest\"",
returnStdout: true
).trim()
} else {
echo("Use old URL path for the latest index.")
DISTRIBUTION_BUILD_NUMBER = sh(
script: "curl -sL ${PUBLIC_ARTIFACT_URL}/${DISTRIBUTION_JOB_NAME}/${version}/index.json | jq -r \".latest\"",
returnStdout: true
).trim()
}
} else {
DISTRIBUTION_BUILD_NUMBER = previousBuildId
}

0 comments on commit ae6bcad

Please sign in to comment.