From d594cdbc99e5e3b53410c1e22e0f4f0e032ed965 Mon Sep 17 00:00:00 2001 From: Nikola Jokic Date: Fri, 14 Nov 2025 15:07:20 +0100 Subject: [PATCH] anonymous proxy and auth proxy fixed --- .../anonymous-proxy-setup.squid.yaml | 31 ++++++++++++++++++ .../anonymous-proxy-setup.test.sh | 32 ++++++++----------- .../auth-proxy-setup.squid.yaml | 31 ++++++++++++++++++ .../auth-proxy-setup.test.sh | 28 +++++++--------- test/actions.github.com/helper.sh | 2 +- 5 files changed, 89 insertions(+), 35 deletions(-) create mode 100644 test/actions.github.com/anonymous-proxy-setup.squid.yaml create mode 100644 test/actions.github.com/auth-proxy-setup.squid.yaml diff --git a/test/actions.github.com/anonymous-proxy-setup.squid.yaml b/test/actions.github.com/anonymous-proxy-setup.squid.yaml new file mode 100644 index 00000000..b56bd181 --- /dev/null +++ b/test/actions.github.com/anonymous-proxy-setup.squid.yaml @@ -0,0 +1,31 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: squid +spec: + replicas: 1 + selector: + matchLabels: + app: squid + template: + metadata: + labels: + app: squid + spec: + containers: + - name: squid + image: ubuntu/squid:latest + ports: + - containerPort: 3128 +--- +apiVersion: v1 +kind: Service +metadata: + name: squid +spec: + selector: + app: squid + ports: + - protocol: TCP + port: 3128 + targetPort: 3128 diff --git a/test/actions.github.com/anonymous-proxy-setup.test.sh b/test/actions.github.com/anonymous-proxy-setup.test.sh index 7da1b493..fb79fb10 100755 --- a/test/actions.github.com/anonymous-proxy-setup.test.sh +++ b/test/actions.github.com/anonymous-proxy-setup.test.sh @@ -8,7 +8,7 @@ ROOT_DIR="$(realpath "${DIR}/../..")" source "${DIR}/helper.sh" -SCALE_SET_NAME="anonymous-proxy-$(date +'%M%S')$(((${RANDOM} + 100) % 100 + 1))" +SCALE_SET_NAME="anonymous-proxy-$(date +'%M%S')$(((RANDOM + 100) % 100 + 1))" SCALE_SET_NAMESPACE="arc-runners" WORKFLOW_FILE="arc-test-workflow.yaml" ARC_NAME="arc" @@ -33,31 +33,22 @@ function install_arc() { fi } -function start_squid_proxy() { +function install_squid() { echo "Starting squid-proxy" - docker run -d \ - --rm \ - --name squid \ - --publish 3128:3128 \ - ubuntu/squid:latest -} - -function stop_squid_proxy() { - echo "Stopping squid-proxy" - docker stop squid + kubectl apply -f "${DIR}/anonymous-proxy-setup.squid.yaml" } function install_scale_set() { echo "Installing scale set ${SCALE_SET_NAMESPACE}/${SCALE_SET_NAME}" - helm install "${SCALE_SET_NAME}" \ + + echo 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 proxy.https.url="http://host.minikube.internal:3128" \ + --set proxy.https.url="http://squid.default.svc.cluster.local:3128" \ --set "proxy.noProxy[0]=10.96.0.1:443" \ "${ROOT_DIR}/charts/gha-runner-scale-set" \ - --version="${VERSION}" \ --debug if ! NAME="${SCALE_SET_NAME}" NAMESPACE="${ARC_NAMESPACE}" wait_for_scale_set; then @@ -73,8 +64,14 @@ function main() { create_cluster install_arc - start_squid_proxy - install_scale_set + install_squid + + install_scale_set || { + echo "Scale set installation failed" + NAMESPACE="${ARC_NAMESPACE}" log_arc + delete_cluster + exit 1 + } WORKFLOW_FILE="${WORKFLOW_FILE}" SCALE_SET_NAME="${SCALE_SET_NAME}" run_workflow || failed+=("run_workflow") @@ -83,7 +80,6 @@ function main() { NAMESPACE="${ARC_NAMESPACE}" log_arc || failed+=("log_arc") delete_cluster - stop_squid_proxy print_results "${failed[@]}" } diff --git a/test/actions.github.com/auth-proxy-setup.squid.yaml b/test/actions.github.com/auth-proxy-setup.squid.yaml new file mode 100644 index 00000000..7ba99495 --- /dev/null +++ b/test/actions.github.com/auth-proxy-setup.squid.yaml @@ -0,0 +1,31 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: squid +spec: + replicas: 1 + selector: + matchLabels: + app: squid + template: + metadata: + labels: + app: squid + spec: + containers: + - name: squid + image: huangtingluo/squid-proxy:latest + ports: + - containerPort: 3128 +--- +apiVersion: v1 +kind: Service +metadata: + name: squid +spec: + selector: + app: squid + ports: + - protocol: TCP + port: 3128 + targetPort: 3128 diff --git a/test/actions.github.com/auth-proxy-setup.test.sh b/test/actions.github.com/auth-proxy-setup.test.sh index 34df1524..a6879fbc 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" @@ -38,12 +38,9 @@ function install_arc() { fi } -function start_squid_proxy() { +function install_squid() { echo "Starting squid-proxy" - docker run -d \ - --name squid \ - --publish 3128:3128 \ - huangtingluo/squid-proxy:latest + kubectl apply -f "${DIR}/auth-proxy-setup.squid.yaml" echo "Creating scale set namespace" kubectl create namespace "${SCALE_SET_NAMESPACE}" || true @@ -55,12 +52,6 @@ function start_squid_proxy() { --from-literal=password='actions' } -function stop_squid_proxy() { - echo "Stopping squid-proxy" - docker stop squid - docker rm squid -} - function install_scale_set() { echo "Installing scale set ${SCALE_SET_NAMESPACE}/${SCALE_SET_NAME}" helm install "${SCALE_SET_NAME}" \ @@ -68,7 +59,7 @@ function install_scale_set() { --create-namespace \ --set githubConfigUrl="https://github.com/${TARGET_ORG}/${TARGET_REPO}" \ --set githubConfigSecret.github_token="${GITHUB_TOKEN}" \ - --set proxy.https.url="http://host.minikube.internal:3128" \ + --set proxy.https.url="http://squid.default.svc.cluster.local:3128" \ --set proxy.https.credentialSecretRef="proxy-auth" \ --set "proxy.noProxy[0]=10.96.0.1:443" \ "${ROOT_DIR}/charts/gha-runner-scale-set" \ @@ -88,8 +79,14 @@ function main() { create_cluster install_arc - start_squid_proxy - install_scale_set + install_squid + + install_scale_set || { + echo "Scale set installation failed" + NAMESPACE="${ARC_NAMESPACE}" log_arc + delete_cluster + exit 1 + } WORKFLOW_FILE="${WORKFLOW_FILE}" SCALE_SET_NAME="${SCALE_SET_NAME}" run_workflow || failed+=("run_workflow") @@ -98,7 +95,6 @@ function main() { NAMESPACE="${ARC_NAMESPACE}" log_arc || failed+=("log_arc") delete_cluster - stop_squid_proxy print_results "${failed[@]}" } diff --git a/test/actions.github.com/helper.sh b/test/actions.github.com/helper.sh index 8e37eb53..a1429d3c 100644 --- a/test/actions.github.com/helper.sh +++ b/test/actions.github.com/helper.sh @@ -103,7 +103,7 @@ function wait_for_scale_set() { count=$((count+1)) done kubectl wait --timeout=30s --for=condition=ready pod -n "${NAMESPACE}" -l "actions.github.com/scale-set-name=${NAME}" - kubectl get pod -n "${NAMESPACE}" + kubectl get pod -n "${NAMESPACE}" -l "actions.github.com/scale-set-name=${NAME}" } function cleanup_scale_set() {