diff --git a/.github/workflows/nfr.yml b/.github/workflows/nfr.yml index cf21801b90..8c078f5ab4 100644 --- a/.github/workflows/nfr.yml +++ b/.github/workflows/nfr.yml @@ -101,7 +101,6 @@ jobs: echo "GKE_PROJECT=${{ secrets.GCP_PROJECT_ID }}" >> vars.env echo "GKE_SVC_ACCOUNT=${{ secrets.GCP_SERVICE_ACCOUNT }}" >> vars.env echo "GKE_NODES_SERVICE_ACCOUNT=${{ secrets.GKE_NODES_SERVICE_ACCOUNT }}" >> vars.env - echo "IMAGE=projects/debian-cloud/global/images/debian-11-bullseye-v20240213" >> vars.env echo "NETWORK_TAGS=nfr-tests-${{ github.run_id }}-${{ matrix.type }}" >> vars.env echo "NGF_REPO=nginxinc" >> vars.env echo "NGF_BRANCH=${{ github.ref_name }}" >> vars.env diff --git a/tests/scripts/create-and-setup-gcp-vm.sh b/tests/scripts/create-and-setup-gcp-vm.sh index 05b43a8306..00a9aecec2 100644 --- a/tests/scripts/create-and-setup-gcp-vm.sh +++ b/tests/scripts/create-and-setup-gcp-vm.sh @@ -14,11 +14,11 @@ gcloud compute firewall-rules create ${RESOURCE_NAME} \ --source-ranges=${SOURCE_IP_RANGE} \ --target-tags=${NETWORK_TAGS} -gcloud compute instances create ${RESOURCE_NAME} --project=${GKE_PROJECT} --zone=${GKE_CLUSTER_ZONE} --machine-type=e2-medium \ +gcloud compute instances create ${RESOURCE_NAME} --project=${GKE_PROJECT} --zone=${GKE_CLUSTER_ZONE} --machine-type=n2-standard-2 \ --network-interface=network-tier=PREMIUM,stack-type=IPV4_ONLY,subnet=default --maintenance-policy=MIGRATE \ --provisioning-model=STANDARD --service-account=${GKE_SVC_ACCOUNT} \ --scopes=https://www.googleapis.com/auth/devstorage.read_only,https://www.googleapis.com/auth/logging.write,https://www.googleapis.com/auth/monitoring.write,https://www.googleapis.com/auth/servicecontrol,https://www.googleapis.com/auth/service.management.readonly,https://www.googleapis.com/auth/trace.append,https://www.googleapis.com/auth/cloud-platform \ - --tags=${NETWORK_TAGS} --create-disk=auto-delete=yes,boot=yes,device-name=${RESOURCE_NAME},image=${IMAGE},mode=rw,size=10 --no-shielded-secure-boot --shielded-vtpm --shielded-integrity-monitoring --labels=goog-ec-src=vm_add-gcloud --reservation-affinity=any + --tags=${NETWORK_TAGS} --create-disk=auto-delete=yes,boot=yes,device-name=${RESOURCE_NAME},image-family=projects/${GKE_PROJECT}/global/images/ngf-debian,mode=rw,size=20 --no-shielded-secure-boot --shielded-vtpm --shielded-integrity-monitoring --labels=goog-ec-src=vm_add-gcloud --reservation-affinity=any # Add VM IP to GKE master control node access, if required if [ "${ADD_VM_IP_AUTH_NETWORKS}" = "true" ]; then @@ -44,5 +44,5 @@ for ((i=1; i<=MAX_RETRIES; i++)); do done gcloud compute scp --zone ${GKE_CLUSTER_ZONE} --project=${GKE_PROJECT} ${SCRIPT_DIR}/vars.env username@${RESOURCE_NAME}:~ - -gcloud compute ssh --zone ${GKE_CLUSTER_ZONE} --project=${GKE_PROJECT} username@${RESOURCE_NAME} --command="bash -s" < ${SCRIPT_DIR}/remote-scripts/install-deps.sh +gcloud compute ssh --zone ${GKE_CLUSTER_ZONE} --project=${GKE_PROJECT} username@${RESOURCE_NAME} \ + --command="git clone https://github.com/${NGF_REPO}/nginx-gateway-fabric.git && cd nginx-gateway-fabric/tests && git checkout ${NGF_BRANCH} && gcloud container clusters get-credentials ${GKE_CLUSTER_NAME} --zone ${GKE_CLUSTER_ZONE} --project=${GKE_PROJECT} --quiet" diff --git a/tests/scripts/remote-scripts/install-deps.sh b/tests/scripts/remote-scripts/install-deps.sh deleted file mode 100644 index 1196a1f21c..0000000000 --- a/tests/scripts/remote-scripts/install-deps.sh +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/bash - -set -e - -source ~/vars.env - -sudo apt-get -y update && sudo apt-get -y install git make kubectl google-cloud-sdk-gke-gcloud-auth-plugin jq gnuplot rsync wrk && \ -curl https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3 | bash && \ -export GO_VERSION=$(curl -sSL "https://golang.org/dl/?mode=json" | jq -r '.[0].version') && \ -wget https://go.dev/dl/${GO_VERSION}.linux-amd64.tar.gz && \ -sudo rm -rf /usr/local/go && sudo tar -C /usr/local -xzf ${GO_VERSION}.linux-amd64.tar.gz && \ -rm -rf ${GO_VERSION}.linux-amd64.tar.gz && \ -gcloud container clusters get-credentials ${GKE_CLUSTER_NAME} --zone ${GKE_CLUSTER_ZONE} --project=${GKE_PROJECT} - -git clone https://github.com/${NGF_REPO}/nginx-gateway-fabric.git && cd nginx-gateway-fabric/tests && git checkout ${NGF_BRANCH} diff --git a/tests/scripts/remote-scripts/run-nfr-tests.sh b/tests/scripts/remote-scripts/run-nfr-tests.sh index 10b4c1ea06..b93d2a9127 100644 --- a/tests/scripts/remote-scripts/run-nfr-tests.sh +++ b/tests/scripts/remote-scripts/run-nfr-tests.sh @@ -4,8 +4,6 @@ set -e source ~/vars.env -echo "export PATH=$PATH:/usr/local/go/bin" >> $HOME/.profile && . $HOME/.profile - if [ "$START_LONGEVITY" == "true" ]; then GINKGO_LABEL="longevity-setup" elif [ "$STOP_LONGEVITY" == "true" ]; then diff --git a/tests/scripts/remote-scripts/run-tests.sh b/tests/scripts/remote-scripts/run-tests.sh index 67024ef56d..96f68299a6 100644 --- a/tests/scripts/remote-scripts/run-tests.sh +++ b/tests/scripts/remote-scripts/run-tests.sh @@ -4,6 +4,4 @@ set -e source ~/vars.env -echo "export PATH=$PATH:/usr/local/go/bin" >> $HOME/.profile && . $HOME/.profile - cd nginx-gateway-fabric/tests && make test TAG=${TAG} PREFIX=${PREFIX} NGINX_PREFIX=${NGINX_PREFIX} NGINX_PLUS_PREFIX=${NGINX_PLUS_PREFIX} PLUS_ENABLED=${PLUS_ENABLED} GINKGO_LABEL=${GINKGO_LABEL} GINKGO_FLAGS=${GINKGO_FLAGS} PULL_POLICY=Always GW_SERVICE_TYPE=LoadBalancer GW_SVC_GKE_INTERNAL=true NGF_VERSION=${NGF_VERSION} diff --git a/tests/scripts/run-tests-gcp-vm.sh b/tests/scripts/run-tests-gcp-vm.sh index 4c9a8478e3..0719eb3c9e 100644 --- a/tests/scripts/run-tests-gcp-vm.sh +++ b/tests/scripts/run-tests-gcp-vm.sh @@ -14,7 +14,13 @@ gcloud compute scp --zone ${GKE_CLUSTER_ZONE} --project=${GKE_PROJECT} ${SCRIPT_ gcloud compute ssh --zone ${GKE_CLUSTER_ZONE} --project=${GKE_PROJECT} username@${RESOURCE_NAME} \ --command="export START_LONGEVITY=${START_LONGEVITY} &&\ export STOP_LONGEVITY=${STOP_LONGEVITY} &&\ - bash -s" < ${SCRIPT_DIR}/remote-scripts/${SCRIPT} + source /etc/profile &&\ + bash -s" < ${SCRIPT_DIR}/remote-scripts/${SCRIPT}; retcode=$? + +if [ $retcode -ne 0 ]; then + echo "Error running tests on VM" + exit 1 +fi if [ "${NFR}" = "true" ]; then gcloud compute scp --zone ${GKE_CLUSTER_ZONE} --project=${GKE_PROJECT} --recurse username@${RESOURCE_NAME}:~/nginx-gateway-fabric/tests/results . diff --git a/tests/scripts/vars.env-example b/tests/scripts/vars.env-example index 52138f113f..02f976023d 100644 --- a/tests/scripts/vars.env-example +++ b/tests/scripts/vars.env-example @@ -10,7 +10,6 @@ GKE_CLUSTER_REGION= GKE_PROJECT= GKE_SVC_ACCOUNT= GKE_NODES_SERVICE_ACCOUNT= -IMAGE=projects/debian-cloud/global/images/debian-11-bullseye-v20240213 NETWORK_TAGS= NGF_REPO=nginxinc NGF_BRANCH=main