diff --git a/build.gradle b/build.gradle index 861029a4d..e319350b0 100644 --- a/build.gradle +++ b/build.gradle @@ -121,7 +121,7 @@ jacocoTestReport { } } -String version = '6.1.0' +String version = '6.1.1' task updateVersion { doLast { diff --git a/vars/retrievePreviousBuild.groovy b/vars/retrievePreviousBuild.groovy index 29572d8fd..c72a73f6d 100644 --- a/vars/retrievePreviousBuild.groovy +++ b/vars/retrievePreviousBuild.groovy @@ -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 }