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
…#367)

Signed-off-by: Zelin Hao <[email protected]>
  • Loading branch information
zelinh authored Jan 25, 2024
1 parent 8b7df12 commit ae6bcad
Show file tree
Hide file tree
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
Expand Up @@ -121,7 +121,7 @@ jacocoTestReport {
}
}

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

task updateVersion {
doLast {
Expand Down
22 changes: 17 additions & 5 deletions vars/retrievePreviousBuild.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down

0 comments on commit ae6bcad

Please sign in to comment.