File tree Expand file tree Collapse file tree 2 files changed +21
-6
lines changed Expand file tree Collapse file tree 2 files changed +21
-6
lines changed Original file line number Diff line number Diff line change @@ -35,10 +35,10 @@ if [[ -n "${VERSION_QUALIFIER:-}" ]]; then
3535 echo " Version qualifier specified. ES_VERSION=${ES_VERSION} ."
3636fi
3737
38- BEATS_BUILD_ID=" $( ./.ci/scripts/resolve-dra-manifest.sh beats " $ES_VERSION " " $WORKFLOW " ) "
38+ BEATS_BUILD_ID=" $( ./.ci/scripts/resolve-dra-manifest.sh beats " $RM_BRANCH " " $ ES_VERSION" " $WORKFLOW " ) "
3939echo " BEATS_BUILD_ID=$BEATS_BUILD_ID "
4040
41- ML_CPP_BUILD_ID=" $( ./.ci/scripts/resolve-dra-manifest.sh ml-cpp " $ES_VERSION " " $WORKFLOW " ) "
41+ ML_CPP_BUILD_ID=" $( ./.ci/scripts/resolve-dra-manifest.sh ml-cpp " $RM_BRANCH " " $ ES_VERSION" " $WORKFLOW " ) "
4242echo " ML_CPP_BUILD_ID=$ML_CPP_BUILD_ID "
4343
4444LICENSE_KEY_ARG=" "
Original file line number Diff line number Diff line change @@ -11,14 +11,29 @@ fetch_build() {
1111}
1212
1313ARTIFACT=" ${ARTIFACT:- $1 } "
14- ES_VERSION=" ${ES_VERSION:- $2 } "
15- WORKFLOW=${WORKFLOW:- $3 }
14+ BRANCH=" ${BRANCH:- $2 } "
15+ ES_VERSION=" ${ES_VERSION:- $3 } "
16+ WORKFLOW=${WORKFLOW:- $4 }
17+
18+ if [[ " $WORKFLOW " == " staging" ]]
19+ LATEST_BUILD=$( fetch_build $WORKFLOW $ARTIFACT $ES_VERSION )
20+ elif [[ " $WORKFLOW " == " snapshot" ]]
21+ LATEST_BUILD=$( fetch_build $WORKFLOW $ARTIFACT $BRANCH )
22+ else
23+ echo " Unknown workflow: $WORKFLOW "
24+ exit 1
25+ fi
1626
17- LATEST_BUILD=$( fetch_build $WORKFLOW $ARTIFACT $ES_VERSION )
1827LATEST_VERSION=$( strip_version $LATEST_BUILD )
1928
29+ # If the latest artifact version doesn't match what we expect, try the corresponding version branch.
30+ # This can happen when the version of artifact has been bumped on the master branch.
2031if [ " $LATEST_VERSION " != " $ES_VERSION " ]; then
21- echo " warning: Latest build for '$ARTIFACT ' is version $LATEST_VERSION but expected version $ES_VERSION ."
32+ echo " Latest build for '$ARTIFACT ' is version $LATEST_VERSION but expected version $ES_VERSION ." 1>&2
33+ NEW_BRANCH=$( echo $ES_VERSION | sed -E " s/([0-9]+\.[0-9]+)\.[0-9]/\1/g" )
34+
35+ echo " Using branch $NEW_BRANCH instead of $BRANCH ." 1>&2
36+ LATEST_BUILD=$( fetch_build $WORKFLOW $ARTIFACT $NEW_BRANCH )
2237fi
2338
2439echo $LATEST_BUILD
You can’t perform that action at this time.
0 commit comments