Skip to content

Commit

Permalink
Default previous build id
Browse files Browse the repository at this point in the history
Signed-off-by: Zelin Hao <[email protected]>
  • Loading branch information
zelinh committed Jan 18, 2024
1 parent d9b1d36 commit 0275f2b
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions vars/retrievePreviousBuild.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,17 @@ void call(Map args = [:]) {
def DISTRIBUTION_ARCHITECTURE = args.architecture
def distribution = args.distribution
def prefixPath = "${WORKSPACE}/download"
def previousBuildId = args.previousBuildId ? args.previousBuildId : "latest"
def DISTRIBUTION_BUILD_NUMBER

if (args.previousBuildId.equalsIgnoreCase("latest")) {
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
} else {
DISTRIBUTION_BUILD_NUMBER = args.previousBuildId
DISTRIBUTION_BUILD_NUMBER = previousBuildId
}

def artifactPath = "${DISTRIBUTION_JOB_NAME}/${version}/${DISTRIBUTION_BUILD_NUMBER}/${DISTRIBUTION_PLATFORM}/${DISTRIBUTION_ARCHITECTURE}/${distribution}"
Expand Down

0 comments on commit 0275f2b

Please sign in to comment.