Skip to content

Commit 6939dd8

Browse files
committed
Keep using BRANCH for snapshot DRA
Need to use BRANCH for snapshot DRA builds because full version is not available in artifacts-snapshot API.
1 parent f04cd9a commit 6939dd8

File tree

2 files changed

+21
-6
lines changed

2 files changed

+21
-6
lines changed

.buildkite/scripts/dra-workflow.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,10 @@ if [[ -n "${VERSION_QUALIFIER:-}" ]]; then
3535
echo "Version qualifier specified. ES_VERSION=${ES_VERSION}."
3636
fi
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")"
3939
echo "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")"
4242
echo "ML_CPP_BUILD_ID=$ML_CPP_BUILD_ID"
4343

4444
LICENSE_KEY_ARG=""

.ci/scripts/resolve-dra-manifest.sh

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,29 @@ fetch_build() {
1111
}
1212

1313
ARTIFACT="${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)
1827
LATEST_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.
2031
if [ "$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)
2237
fi
2338

2439
echo $LATEST_BUILD

0 commit comments

Comments
 (0)