Skip to content

Commit 247d288

Browse files
authored
Use ES_VERSION to resolve manifest for ML and Beats (#130084) (#130094)
Previously BRANCH was used in all cases, but if there is a newer version of the dependency, the incorrect version could be used. BRANCH is still used for snapshot DRA builds because full version is not available in artifacts-snapshot API. Additionally, added log what URL is used to fetch manifest and make the curl command fail in case of error like 404 response.
1 parent b7a88a9 commit 247d288

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

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

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@ strip_version() {
66
}
77

88
fetch_build() {
9-
curl -sS https://artifacts-$1.elastic.co/$2/latest/$3.json \
9+
>&2 echo "Checking for build id: https://artifacts-$1.elastic.co/$2/latest/$3.json"
10+
curl -sSf https://artifacts-$1.elastic.co/$2/latest/$3.json \
1011
| jq -r '.build_id'
1112
}
1213

@@ -15,7 +16,15 @@ BRANCH="${BRANCH:-$2}"
1516
ES_VERSION="${ES_VERSION:-$3}"
1617
WORKFLOW=${WORKFLOW:-$4}
1718

18-
LATEST_BUILD=$(fetch_build $WORKFLOW $ARTIFACT $BRANCH)
19+
if [[ "$WORKFLOW" == "staging" ]]; then
20+
LATEST_BUILD=$(fetch_build $WORKFLOW $ARTIFACT $ES_VERSION)
21+
elif [[ "$WORKFLOW" == "snapshot" ]]; then
22+
LATEST_BUILD=$(fetch_build $WORKFLOW $ARTIFACT $BRANCH)
23+
else
24+
echo "Unknown workflow: $WORKFLOW"
25+
exit 1
26+
fi
27+
1928
LATEST_VERSION=$(strip_version $LATEST_BUILD)
2029

2130
# If the latest artifact version doesn't match what we expect, try the corresponding version branch.

0 commit comments

Comments
 (0)