add min-runners test
This commit is contained in:
parent
c2f699eb1b
commit
0a288b09f3
|
|
@ -162,7 +162,7 @@ jobs:
|
|||
application_private_key: ${{ secrets.E2E_TESTS_ACCESS_PK }}
|
||||
organization: ${{ env.TARGET_ORG }}
|
||||
|
||||
- name: Run default setup test
|
||||
- name: Run single namespace setup test
|
||||
run: hack/e2e-test.sh single-namespace-setup
|
||||
shell: bash
|
||||
|
||||
|
|
@ -280,7 +280,7 @@ jobs:
|
|||
application_private_key: ${{ secrets.E2E_TESTS_ACCESS_PK }}
|
||||
organization: ${{ env.TARGET_ORG }}
|
||||
|
||||
- name: Run default setup test
|
||||
- name: Run dind mode setup test
|
||||
run: hack/e2e-test.sh dind-mode-setup
|
||||
shell: bash
|
||||
|
||||
|
|
@ -397,7 +397,7 @@ jobs:
|
|||
application_private_key: ${{ secrets.E2E_TESTS_ACCESS_PK }}
|
||||
organization: ${{ env.TARGET_ORG }}
|
||||
|
||||
- name: Run default setup test
|
||||
- name: Run kubernetes mode setup test
|
||||
run: hack/e2e-test.sh kubernetes-mode-setup
|
||||
shell: bash
|
||||
|
||||
|
|
@ -523,7 +523,7 @@ jobs:
|
|||
application_private_key: ${{ secrets.E2E_TESTS_ACCESS_PK }}
|
||||
organization: ${{ env.TARGET_ORG }}
|
||||
|
||||
- name: Run default setup test
|
||||
- name: Run single namespace setup test
|
||||
run: hack/e2e-test.sh single-namespace-setup
|
||||
shell: bash
|
||||
|
||||
|
|
@ -651,7 +651,7 @@ jobs:
|
|||
application_private_key: ${{ secrets.E2E_TESTS_ACCESS_PK }}
|
||||
organization: ${{ env.TARGET_ORG }}
|
||||
|
||||
- name: Run default setup test
|
||||
- name: Run anonymous proxy setup test
|
||||
run: hack/e2e-test.sh anonymous-proxy-setup
|
||||
shell: bash
|
||||
|
||||
|
|
@ -773,7 +773,7 @@ jobs:
|
|||
application_private_key: ${{ secrets.E2E_TESTS_ACCESS_PK }}
|
||||
organization: ${{ env.TARGET_ORG }}
|
||||
|
||||
- name: Run default setup test
|
||||
- name: Run self signed CA setup test
|
||||
run: hack/e2e-test.sh self-signed-ca-setup
|
||||
shell: bash
|
||||
|
||||
|
|
@ -920,7 +920,7 @@ jobs:
|
|||
application_private_key: ${{ secrets.E2E_TESTS_ACCESS_PK }}
|
||||
organization: ${{ env.TARGET_ORG }}
|
||||
|
||||
- name: Run default setup test
|
||||
- name: Run update strategy test
|
||||
run: hack/e2e-test.sh update-strategy
|
||||
shell: bash
|
||||
|
||||
|
|
@ -1096,6 +1096,31 @@ jobs:
|
|||
kubectl wait --timeout=10s --for=delete AutoScalingRunnerSet -n "${{ steps.install_arc.outputs.ARC_NAME }}" -l app.kubernetes.io/instance="${{ steps.install_arc.outputs.ARC_NAME }}"
|
||||
kubectl logs deployment/arc-gha-rs-controller -n "arc-systems"
|
||||
|
||||
init-with-min-runners-v2:
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 20
|
||||
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.id == github.repository_id
|
||||
env:
|
||||
TARGET_ORG: ${{ env.TARGET_ORG }}
|
||||
TARGET_REPO: ${{ env.TARGET_REPO }}
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v5
|
||||
with:
|
||||
ref: ${{github.head_ref}}
|
||||
|
||||
- name: Get configure token
|
||||
id: config-token
|
||||
uses: peter-murray/workflow-application-token-action@dc0413987a085fa17d19df9e47d4677cf81ffef3
|
||||
with:
|
||||
application_id: ${{ secrets.E2E_TESTS_ACCESS_APP_ID }}
|
||||
application_private_key: ${{ secrets.E2E_TESTS_ACCESS_PK }}
|
||||
organization: ${{ env.TARGET_ORG }}
|
||||
|
||||
- name: Run init with min runners test
|
||||
run: hack/e2e-test.sh init-with-min-runners
|
||||
shell: bash
|
||||
|
||||
init-with-min-runners:
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 20
|
||||
|
|
|
|||
|
|
@ -67,7 +67,6 @@ function install_scale_set() {
|
|||
}
|
||||
|
||||
function main() {
|
||||
echo "[*] Running anonymous proxy setup"
|
||||
local failed=()
|
||||
|
||||
build_image
|
||||
|
|
|
|||
|
|
@ -76,7 +76,6 @@ function install_scale_set() {
|
|||
}
|
||||
|
||||
function main() {
|
||||
echo "[*] Running auth proxy setup"
|
||||
local failed=()
|
||||
|
||||
build_image
|
||||
|
|
|
|||
|
|
@ -51,7 +51,6 @@ function install_scale_set() {
|
|||
}
|
||||
|
||||
function main() {
|
||||
echo "[*] Running default setup"
|
||||
local failed=()
|
||||
|
||||
build_image
|
||||
|
|
|
|||
|
|
@ -52,7 +52,6 @@ function install_scale_set() {
|
|||
}
|
||||
|
||||
function main() {
|
||||
echo "[*] Running dind mode setup"
|
||||
local failed=()
|
||||
|
||||
build_image
|
||||
|
|
|
|||
|
|
@ -0,0 +1,91 @@
|
|||
#!/bin/bash
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
DIR="$(realpath "$(dirname "${BASH_SOURCE[0]}")")"
|
||||
|
||||
ROOT_DIR="$(realpath "${DIR}/../..")"
|
||||
|
||||
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_NAMESPACE="arc-runners"
|
||||
WORKFLOW_FILE="arc-test-workflow.yaml"
|
||||
ARC_NAME="arc"
|
||||
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_VERSION}" \
|
||||
--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
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
function install_scale_set() {
|
||||
echo "Installing scale set ${SCALE_SET_NAMESPACE}/${SCALE_SET_NAME}"
|
||||
helm install "$ARC_NAME" \
|
||||
--namespace "arc-runners" \
|
||||
--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
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
function assert_5_runners() {
|
||||
echo "[*] Asserting 5 runners are created"
|
||||
local count=0
|
||||
while true; do
|
||||
pod_count=$(kubectl get runners -n "${SCALE_SET_NAMESPACE}" --selector="gha-runner-scale-set=${SCALE_SET_NAME}" --no-headers | wc -l)
|
||||
|
||||
if [[ "${pod_count}" = 5 ]]; then
|
||||
echo "[*] Found 5 runners as expected"
|
||||
break
|
||||
fi
|
||||
|
||||
if [[ "$count" -ge 30 ]]; then
|
||||
echo "Timeout waiting for 5 pods to be created"
|
||||
exit 1
|
||||
fi
|
||||
sleep 1
|
||||
count=$((count+1))
|
||||
done
|
||||
}
|
||||
|
||||
function main() {
|
||||
local failed=()
|
||||
|
||||
build_image
|
||||
create_cluster
|
||||
|
||||
install_arc
|
||||
install_scale_set
|
||||
|
||||
assert_5_runners || failed+=("assert_5_runners")
|
||||
|
||||
INSTALLATION_NAME="${SCALE_SET_NAME}" NAMESPACE="${SCALE_SET_NAMESPACE}" cleanup_scale_set || failed+=("cleanup_scale_set")
|
||||
|
||||
NAMESPACE="${ARC_NAMESPACE}" log_arc || failed+=("log_arc")
|
||||
|
||||
delete_cluster
|
||||
|
||||
print_results "${failed[@]}"
|
||||
}
|
||||
|
||||
main
|
||||
|
|
@ -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="kubernetes-mode-$(date +'%M%S')$((($RANDOM + 100) % 100 + 1))"
|
||||
SCALE_SET_NAMESPACE="arc-runners"
|
||||
WORKFLOW_FILE="arc-test-kubernetes-workflow.yaml"
|
||||
ARC_NAME="arc"
|
||||
|
|
@ -60,7 +60,6 @@ function install_scale_set() {
|
|||
}
|
||||
|
||||
function main() {
|
||||
echo "[*] Running kubernetes mode setup"
|
||||
local failed=()
|
||||
|
||||
build_image
|
||||
|
|
|
|||
|
|
@ -14,6 +14,8 @@ WORKFLOW_FILE="arc-test-workflow.yaml"
|
|||
ARC_NAME="arc"
|
||||
ARC_NAMESPACE="arc-systems"
|
||||
|
||||
HOST_MITM_CONFIG="/tmp/mitmproxy"
|
||||
|
||||
function install_arc() {
|
||||
echo "Creating namespace ${ARC_NAMESPACE}"
|
||||
kubectl create namespace "${SCALE_SET_NAMESPACE}"
|
||||
|
|
@ -68,10 +70,10 @@ function wait_for_mitmproxy_cert() {
|
|||
echo "Waiting for mitmproxy generated CA certificate"
|
||||
local count=0
|
||||
while true; do
|
||||
if [ -f "./mitmproxy/mitmproxy-ca-cert.pem" ]; then
|
||||
if [ -f "$HOST_MITM_CONFIG/mitmproxy-ca-cert.pem" ]; then
|
||||
echo "CA certificate is generated"
|
||||
echo "CA certificate:"
|
||||
cat "./mitmproxy/mitmproxy-ca-cert.pem"
|
||||
cat "$HOST_MITM_CONFIG/mitmproxy-ca-cert.pem"
|
||||
return 0
|
||||
fi
|
||||
|
||||
|
|
@ -87,15 +89,14 @@ function wait_for_mitmproxy_cert() {
|
|||
|
||||
function run_mitmproxy() {
|
||||
echo "Running mitmproxy"
|
||||
mkdir -p
|
||||
docker run -d \
|
||||
--rm \
|
||||
--name mitmproxy \
|
||||
--publish 8080:8080 \
|
||||
-b ./mitmproxy:/home/mitmproxy/.mitmproxy \
|
||||
-v "$HOST_MITM_CONFIG:/home/mitmproxy/.mitmproxy" \
|
||||
mitmproxy/mitmproxy:latest \
|
||||
|
||||
echo "Mitm dump:"
|
||||
mitmdump
|
||||
mitmdump
|
||||
|
||||
if ! wait_for_mitmproxy_cert; then
|
||||
return 1
|
||||
|
|
@ -103,8 +104,8 @@ function run_mitmproxy() {
|
|||
|
||||
echo "CA certificate is generated"
|
||||
|
||||
sudo cp ./mitmproxy/mitmproxy-ca-cert.pem /usr/local/share/ca-certificates/mitmproxy-ca-cert.crt
|
||||
sudo chown runner ./mitmproxy/mitmproxy-ca-cert.crt
|
||||
sudo cp "$HOST_MITM_CONFIG/mitmproxy-ca-cert.pem" /usr/local/share/ca-certificates/mitmproxy-ca-cert.crt
|
||||
sudo chown runner /usr/local/share/ca-certificates/mitmproxy-ca-cert.crt
|
||||
}
|
||||
|
||||
function main() {
|
||||
|
|
@ -113,6 +114,8 @@ function main() {
|
|||
return 1
|
||||
fi
|
||||
|
||||
mkdir -p "$HOST_MITM_CONFIG" || { echo "Failed to create mitmproxy config dir"; return 1; }
|
||||
|
||||
local failed=()
|
||||
|
||||
build_image
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ function install_arc() {
|
|||
--create-namespace \
|
||||
--set image.repository="${IMAGE_NAME}" \
|
||||
--set image.tag="${IMAGE_TAG}" \
|
||||
--set flags.watchSingleNamespace="${ARC_NAMESPACE}"
|
||||
--set flags.watchSingleNamespace="${ARC_NAMESPACE}" \
|
||||
"${ROOT_DIR}/charts/gha-runner-scale-set-controller" \
|
||||
--debug
|
||||
|
||||
|
|
@ -52,7 +52,6 @@ function install_scale_set() {
|
|||
}
|
||||
|
||||
function main() {
|
||||
echo "[*] Running single namespace setup"
|
||||
local failed=()
|
||||
|
||||
build_image
|
||||
|
|
|
|||
|
|
@ -101,12 +101,12 @@ function assert_listener_recreated() {
|
|||
if [ "${LISTENER_COUNT}" -eq 1 ]; then
|
||||
echo "Listener is up!"
|
||||
echo "${RESOURCES}"
|
||||
exit 0
|
||||
return 0
|
||||
fi
|
||||
if [ "${count}" -ge 120 ]; then
|
||||
echo "Timeout waiting for listener to be recreated"
|
||||
echo "${RESOURCES}"
|
||||
exit 1
|
||||
return 1
|
||||
fi
|
||||
|
||||
echo "Waiting for listener to be recreated"
|
||||
|
|
|
|||
Loading…
Reference in New Issue