From 1ed291a81528d43a683910dd6e8eb13e882c026d Mon Sep 17 00:00:00 2001 From: Nikola Jokic Date: Wed, 19 Nov 2025 15:43:28 +0100 Subject: [PATCH] reformat --- .../auth-proxy-setup.test.sh | 2 +- test/actions.github.com/default-setup.test.sh | 2 +- .../dind-mode-setup.test.sh | 2 +- .../init-with-min-runners.test.sh | 37 ++++++------ .../kubernetes-mode-setup.test.sh | 2 +- .../single-namespace-setup.test.sh | 2 +- .../update-strategy.test.sh | 57 ++++++++++--------- 7 files changed, 55 insertions(+), 49 deletions(-) diff --git a/test/actions.github.com/auth-proxy-setup.test.sh b/test/actions.github.com/auth-proxy-setup.test.sh index a6879fbc..d13054fd 100755 --- a/test/actions.github.com/auth-proxy-setup.test.sh +++ b/test/actions.github.com/auth-proxy-setup.test.sh @@ -8,7 +8,7 @@ ROOT_DIR="$(realpath "${DIR}/../..")" source "${DIR}/helper.sh" -SCALE_SET_NAME="default-$(date +'%M%S')$(((${RANDOM} + 100) % 100 + 1))" +SCALE_SET_NAME="default-$(date +'%M%S')$(((RANDOM + 100) % 100 + 1))" SCALE_SET_NAMESPACE="arc-runners" WORKFLOW_FILE="arc-test-workflow.yaml" ARC_NAME="arc" diff --git a/test/actions.github.com/default-setup.test.sh b/test/actions.github.com/default-setup.test.sh index da4f10a3..2669320b 100755 --- a/test/actions.github.com/default-setup.test.sh +++ b/test/actions.github.com/default-setup.test.sh @@ -8,7 +8,7 @@ ROOT_DIR="$(realpath "${DIR}/../..")" source "${DIR}/helper.sh" -SCALE_SET_NAME="default-$(date +'%M%S')$(((${RANDOM} + 100) % 100 + 1))" +SCALE_SET_NAME="default-$(date +'%M%S')$(((RANDOM + 100) % 100 + 1))" SCALE_SET_NAMESPACE="arc-runners" WORKFLOW_FILE="arc-test-workflow.yaml" ARC_NAME="arc" diff --git a/test/actions.github.com/dind-mode-setup.test.sh b/test/actions.github.com/dind-mode-setup.test.sh index dc43cfa9..2c70af76 100755 --- a/test/actions.github.com/dind-mode-setup.test.sh +++ b/test/actions.github.com/dind-mode-setup.test.sh @@ -8,7 +8,7 @@ ROOT_DIR="$(realpath "${DIR}/../..")" source "${DIR}/helper.sh" -SCALE_SET_NAME="default-$(date +'%M%S')$(((${RANDOM} + 100) % 100 + 1))" +SCALE_SET_NAME="default-$(date +'%M%S')$(((RANDOM + 100) % 100 + 1))" SCALE_SET_NAMESPACE="arc-runners" WORKFLOW_FILE="arc-test-dind-workflow.yaml" ARC_NAME="arc" diff --git a/test/actions.github.com/init-with-min-runners.test.sh b/test/actions.github.com/init-with-min-runners.test.sh index 763df35e..8ca08ab9 100755 --- a/test/actions.github.com/init-with-min-runners.test.sh +++ b/test/actions.github.com/init-with-min-runners.test.sh @@ -6,9 +6,12 @@ DIR="$(realpath "$(dirname "${BASH_SOURCE[0]}")")" ROOT_DIR="$(realpath "${DIR}/../..")" -source "${DIR}/helper.sh" || { echo "Failed to source helper.sh"; exit 1; } +source "${DIR}/helper.sh" || { + echo "Failed to source helper.sh" + exit 1 +} -SCALE_SET_NAME="init-min-runners-$(date +'%M%S')$((($RANDOM + 100) % 100 + 1))" +SCALE_SET_NAME="init-min-runners-$(date +'%M%S')$(((RANDOM + 100) % 100 + 1))" SCALE_SET_NAMESPACE="arc-runners" WORKFLOW_FILE="arc-test-workflow.yaml" ARC_NAME="arc" @@ -17,13 +20,13 @@ ARC_NAMESPACE="arc-systems" function install_arc() { echo "Installing ARC" helm install arc \ - --namespace "arc-systems" \ - --create-namespace \ - --set image.repository="${IMAGE_NAME}" \ - --set image.tag="${IMAGE_TAG}" \ - --set flags.updateStrategy="eventual" \ - "${ROOT_DIR}/charts/gha-runner-scale-set-controller" \ - --debug + --namespace "arc-systems" \ + --create-namespace \ + --set image.repository="${IMAGE_NAME}" \ + --set image.tag="${IMAGE_TAG}" \ + --set flags.updateStrategy="eventual" \ + "${ROOT_DIR}/charts/gha-runner-scale-set-controller" \ + --debug if ! NAME="${ARC_NAME}" NAMESPACE="${ARC_NAMESPACE}" wait_for_arc; then NAMESPACE="${ARC_NAMESPACE}" log_arc @@ -34,13 +37,13 @@ function install_arc() { function install_scale_set() { echo "Installing scale set ${SCALE_SET_NAMESPACE}/${SCALE_SET_NAME}" helm install "${SCALE_SET_NAME}" \ - --namespace "${SCALE_SET_NAMESPACE}" \ - --create-namespace \ - --set githubConfigUrl="https://github.com/${TARGET_ORG}/${TARGET_REPO}" \ - --set githubConfigSecret.github_token="${GITHUB_TOKEN}" \ - --set minRunners=5 \ - "${ROOT_DIR}/charts/gha-runner-scale-set" \ - --debug + --namespace "${SCALE_SET_NAMESPACE}" \ + --create-namespace \ + --set githubConfigUrl="https://github.com/${TARGET_ORG}/${TARGET_REPO}" \ + --set githubConfigSecret.github_token="${GITHUB_TOKEN}" \ + --set minRunners=5 \ + "${ROOT_DIR}/charts/gha-runner-scale-set" \ + --debug if ! NAME="${SCALE_SET_NAME}" NAMESPACE="${ARC_NAMESPACE}" wait_for_scale_set; then NAMESPACE="${ARC_NAMESPACE}" log_arc @@ -64,7 +67,7 @@ function assert_5_runners() { exit 1 fi sleep 1 - count=$((count+1)) + count=$((count + 1)) done } diff --git a/test/actions.github.com/kubernetes-mode-setup.test.sh b/test/actions.github.com/kubernetes-mode-setup.test.sh index e09203c7..8a2dd1fe 100755 --- a/test/actions.github.com/kubernetes-mode-setup.test.sh +++ b/test/actions.github.com/kubernetes-mode-setup.test.sh @@ -8,7 +8,7 @@ ROOT_DIR="$(realpath "${DIR}/../..")" source "${DIR}/helper.sh" -SCALE_SET_NAME="kubernetes-mode-$(date +'%M%S')$((($RANDOM + 100) % 100 + 1))" +SCALE_SET_NAME="kubernetes-mode-$(date +'%M%S')$(((RANDOM + 100) % 100 + 1))" SCALE_SET_NAMESPACE="arc-runners" WORKFLOW_FILE="arc-test-kubernetes-workflow.yaml" ARC_NAME="arc" diff --git a/test/actions.github.com/single-namespace-setup.test.sh b/test/actions.github.com/single-namespace-setup.test.sh index de72d013..f6462944 100755 --- a/test/actions.github.com/single-namespace-setup.test.sh +++ b/test/actions.github.com/single-namespace-setup.test.sh @@ -8,7 +8,7 @@ ROOT_DIR="$(realpath "${DIR}/../..")" source "${DIR}/helper.sh" -SCALE_SET_NAME="default-$(date +'%M%S')$(((${RANDOM} + 100) % 100 + 1))" +SCALE_SET_NAME="default-$(date +'%M%S')$(((RANDOM + 100) % 100 + 1))" SCALE_SET_NAMESPACE="arc-runners" WORKFLOW_FILE="arc-test-workflow.yaml" ARC_NAME="arc" diff --git a/test/actions.github.com/update-strategy.test.sh b/test/actions.github.com/update-strategy.test.sh index 3aed70f9..f7fce53b 100755 --- a/test/actions.github.com/update-strategy.test.sh +++ b/test/actions.github.com/update-strategy.test.sh @@ -6,9 +6,12 @@ DIR="$(realpath "$(dirname "${BASH_SOURCE[0]}")")" ROOT_DIR="$(realpath "${DIR}/../..")" -source "${DIR}/helper.sh" || { echo "Failed to source helper.sh"; exit 1; } +source "${DIR}/helper.sh" || { + echo "Failed to source helper.sh" + exit 1 +} -SCALE_SET_NAME="update-strategy-$(date '+%M%S')$((($RANDOM + 100) % 100 + 1))" +SCALE_SET_NAME="update-strategy-$(date '+%M%S')$(((RANDOM + 100) % 100 + 1))" SCALE_SET_NAMESPACE="arc-runners" WORKFLOW_FILE="arc-test-sleepy-matrix.yaml" ARC_NAME="arc" @@ -73,47 +76,47 @@ function assert_listener_deleted() { RESOURCES="$(kubectl get pods -A)" if [ "${LISTENER_COUNT}" -eq 0 ]; then - echo "Listener has been deleted" - echo "${RESOURCES}" - return 0 + echo "Listener has been deleted" + echo "${RESOURCES}" + return 0 fi if [ "${count}" -ge 60 ]; then - echo "Timeout waiting for listener to be deleted" - echo "${RESOURCES}" - return 1 + echo "Timeout waiting for listener to be deleted" + echo "${RESOURCES}" + return 1 fi echo "Waiting for listener to be deleted" echo "Listener count: ${LISTENER_COUNT} target: 0 | Runners count: ${RUNNERS_COUNT} target: 3" sleep 1 - count=$((count+1)) - done + count=$((count + 1)) + done } function assert_listener_recreated() { count=0 while true; do - LISTENER_COUNT="$(kubectl get pods -l actions.github.com/scale-set-name="${SCALE_SET_NAME}" -n "${ARC_NAMESPACE}" --field-selector=status.phase=Running -o=jsonpath='{.items}' | jq 'length')" - RUNNERS_COUNT="$(kubectl get pods -l app.kubernetes.io/component=runner -n "${SCALE_SET_NAMESPACE}" --field-selector=status.phase=Running -o=jsonpath='{.items}' | jq 'length')" - RESOURCES="$(kubectl get pods -A)" + LISTENER_COUNT="$(kubectl get pods -l actions.github.com/scale-set-name="${SCALE_SET_NAME}" -n "${ARC_NAMESPACE}" --field-selector=status.phase=Running -o=jsonpath='{.items}' | jq 'length')" + RUNNERS_COUNT="$(kubectl get pods -l app.kubernetes.io/component=runner -n "${SCALE_SET_NAMESPACE}" --field-selector=status.phase=Running -o=jsonpath='{.items}' | jq 'length')" + RESOURCES="$(kubectl get pods -A)" - if [ "${LISTENER_COUNT}" -eq 1 ]; then - echo "Listener is up!" - echo "${RESOURCES}" - return 0 - fi - if [ "${count}" -ge 120 ]; then - echo "Timeout waiting for listener to be recreated" - echo "${RESOURCES}" - return 1 - fi + if [ "${LISTENER_COUNT}" -eq 1 ]; then + echo "Listener is up!" + echo "${RESOURCES}" + return 0 + fi + if [ "${count}" -ge 120 ]; then + echo "Timeout waiting for listener to be recreated" + echo "${RESOURCES}" + return 1 + fi - echo "Waiting for listener to be recreated" - echo "Listener count: ${LISTENER_COUNT} target: 1 | Runners count: ${RUNNERS_COUNT} target: 0" + echo "Waiting for listener to be recreated" + echo "Listener count: ${LISTENER_COUNT} target: 1 | Runners count: ${RUNNERS_COUNT} target: 0" - sleep 1 - count=$((count+1)) + sleep 1 + count=$((count + 1)) done }