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 ...@@ -64,6 +64,7 @@ ci: &ci
- '.github/filters.yaml' - '.github/filters.yaml'
- '.github/actions/**' - '.github/actions/**'
- '.github/scripts/parse_buildkit_output.py' - '.github/scripts/parse_buildkit_output.py'
- '.github/scripts/route_buildkit.sh'
core: core:
# Exclude documentation files first, then include patterns override for specific paths # Exclude documentation files first, then include patterns override for specific paths
......
...@@ -274,16 +274,15 @@ for ARCH in "${ARCHS[@]}"; do ...@@ -274,16 +274,15 @@ for ARCH in "${ARCHS[@]}"; do
TARGET_INDICES=($(get_target_indices "$flavor" "$CUDA_VERSION" "${ACTIVE_INDICES[@]}")) TARGET_INDICES=($(get_target_indices "$flavor" "$CUDA_VERSION" "${ACTIVE_INDICES[@]}"))
ADDRS="" ADDRS=""
for idx in "${TARGET_INDICES[@]}"; do # 2. Get the number of elements in the array
POD_NAME="${POD_PREFIX}-${idx}" TARGET_INDICES_LENGTH=${#TARGET_INDICES[@]}
ADDR="tcp://${POD_NAME}.${SERVICE_NAME}.${NAMESPACE}.svc.cluster.local:${PORT}"
if [ -z "$ADDRS" ]; then # 3. Generate a random index between 0 and length-1
ADDRS="$ADDR" # The $RANDOM variable provides a number between 0 and 32767.
else RANDOM_INDEX=$(($RANDOM % $TARGET_INDICES_LENGTH))
ADDRS="${ADDRS},${ADDR}" RANDOM_VALUE="${TARGET_INDICES[$RANDOM_INDEX]}"
fi POD_NAME="${POD_PREFIX}-${RANDOM_VALUE}"
done ADDRS="tcp://${POD_NAME}.${SERVICE_NAME}.${NAMESPACE}.svc.cluster.local:${PORT}"
echo " -> Routing ${flavor}_${ARCH} to pod indices: ${TARGET_INDICES[*]}" echo " -> Routing ${flavor}_${ARCH} to pod indices: ${TARGET_INDICES[*]}"
# Write to GitHub Output # 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