Unverified Commit 40355b32 authored by Dillon Cullinan's avatar Dillon Cullinan Committed by GitHub
Browse files

ci: Route buildkit picks a random address if multiple are available (#6284)


Signed-off-by: default avatarDillon Cullinan <dcullinan@nvidia.com>
parent e30696e5
......@@ -64,6 +64,7 @@ ci: &ci
- '.github/filters.yaml'
- '.github/actions/**'
- '.github/scripts/parse_buildkit_output.py'
- '.github/scripts/route_buildkit.sh'
core:
# Exclude documentation files first, then include patterns override for specific paths
......
......@@ -274,16 +274,15 @@ for ARCH in "${ARCHS[@]}"; do
TARGET_INDICES=($(get_target_indices "$flavor" "$CUDA_VERSION" "${ACTIVE_INDICES[@]}"))
ADDRS=""
for idx in "${TARGET_INDICES[@]}"; do
POD_NAME="${POD_PREFIX}-${idx}"
ADDR="tcp://${POD_NAME}.${SERVICE_NAME}.${NAMESPACE}.svc.cluster.local:${PORT}"
if [ -z "$ADDRS" ]; then
ADDRS="$ADDR"
else
ADDRS="${ADDRS},${ADDR}"
fi
done
# 2. Get the number of elements in the array
TARGET_INDICES_LENGTH=${#TARGET_INDICES[@]}
# 3. Generate a random index between 0 and length-1
# The $RANDOM variable provides a number between 0 and 32767.
RANDOM_INDEX=$(($RANDOM % $TARGET_INDICES_LENGTH))
RANDOM_VALUE="${TARGET_INDICES[$RANDOM_INDEX]}"
POD_NAME="${POD_PREFIX}-${RANDOM_VALUE}"
ADDRS="tcp://${POD_NAME}.${SERVICE_NAME}.${NAMESPACE}.svc.cluster.local:${PORT}"
echo " -> Routing ${flavor}_${ARCH} to pod indices: ${TARGET_INDICES[*]}"
# Write to GitHub Output
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment