feat(ci): use remote arm64 builder (#9468)
* feat(ci): multi-platform remote build * set arm runner secret, update runner hosts * select one builder and persist it * select one builder and persist it * find the least busy arm builder * chore: update ci configs post rebase * enable remote build in every workflow --------- Co-authored-by: aagaev <alik@agaev.me>pull/10216/head
parent
b8730cdfe0
commit
d0ec50eb95
@ -1,23 +0,0 @@ |
||||
name: 'Setup repo and calc short SHA commit' |
||||
description: 'Setup repo: checkout/login/extract metadata, Set up Docker Buildx and calculate short SHA commit' |
||||
inputs: |
||||
docker-username: |
||||
description: 'Docker username' |
||||
required: true |
||||
docker-password: |
||||
description: 'Docker password' |
||||
required: true |
||||
runs: |
||||
using: "composite" |
||||
|
||||
steps: |
||||
- uses: actions/checkout@v4 |
||||
- name: Setup repo |
||||
uses: ./.github/actions/setup-repo |
||||
with: |
||||
docker-username: ${{ inputs.docker-username }} |
||||
docker-password: ${{ inputs.docker-password }} |
||||
|
||||
- name: Add SHORT_SHA env property with commit short sha |
||||
shell: bash |
||||
run: echo "SHORT_SHA=`echo ${GITHUB_SHA} | cut -c1-8`" >> $GITHUB_ENV |
@ -0,0 +1,46 @@ |
||||
#!/bin/bash |
||||
|
||||
# Check if a domain is provided as an argument |
||||
if [ -z "$1" ]; then |
||||
echo "Usage: $0 <domain>" |
||||
exit 1 |
||||
fi |
||||
|
||||
DOMAIN=$1 |
||||
SSH_USER=$2 |
||||
SSH_KEY=$3 |
||||
|
||||
# Resolve A records |
||||
IP_LIST=$(dig +short A $DOMAIN) |
||||
if [ -z "$IP_LIST" ]; then |
||||
echo "No IPs found for domain $DOMAIN" |
||||
exit 1 |
||||
fi |
||||
|
||||
MIN_LA=1000000 |
||||
BEST_BUILDER="" |
||||
|
||||
for IP in $IP_LIST; do |
||||
# Check if the host is reachable via SSH |
||||
ssh -o StrictHostKeychecking=no -o ConnectTimeout=5 -o BatchMode=yes -i $SSH_KEY $SSH_USER@$IP "exit" 2>/dev/null |
||||
if [ $? -eq 0 ]; then |
||||
# Get the load average |
||||
LA=$(ssh -o StrictHostKeychecking=no -i $SSH_KEY $SSH_USER@$IP "uptime | awk -F'load average:' '{ print \$2 }' | cut -d, -f1" 2>/dev/null) |
||||
if [ $? -eq 0 ]; then |
||||
# Compare and find the minimum load average |
||||
LA=$(echo $LA | xargs) # Trim whitespace |
||||
if (( $(echo "$LA < $MIN_LA" | bc -l) )); then |
||||
MIN_LA=$LA |
||||
BEST_BUILDER=$IP |
||||
fi |
||||
fi |
||||
else |
||||
echo "Host $IP is unreachable, skipping." |
||||
fi |
||||
done |
||||
|
||||
if [ -n "$BEST_BUILDER" ]; then |
||||
echo "$BEST_BUILDER" |
||||
else |
||||
echo "No reachable hosts found." |
||||
fi |
Loading…
Reference in new issue