diff --git a/cloudbuild/run-presubmit-on-k8s.sh b/cloudbuild/run-presubmit-on-k8s.sh index 5fd613e4a..29c3a3d7d 100644 --- a/cloudbuild/run-presubmit-on-k8s.sh +++ b/cloudbuild/run-presubmit-on-k8s.sh @@ -13,23 +13,29 @@ gcloud container clusters get-credentials "${CLOUDSDK_CONTAINER_CLUSTER}" kubectl run "${POD_NAME}" \ --image="${IMAGE}" \ --pod-running-timeout=15m \ + --overrides='[{ + "op": "add", + "path": "/spec/containers/0/resources/requests", + "value": { "cpu": "750m", "memory": "2Gi", "ephemeral-storage": "2Gi" } + }]' \ + --override-type=json \ --restart=Never \ --env="COMMIT_SHA=${COMMIT_SHA}" \ --env="IMAGE_VERSION=${DATAPROC_IMAGE_VERSION}" \ --command -- bash /init-actions/cloudbuild/presubmit.sh -# Delete POD on exit and desribe it before deletion if exit was unsuccessful +# Delete POD on exit and describe it before deletion if exit was unsuccessful trap '[[ $? != 0 ]] && kubectl describe "pod/${POD_NAME}"; kubectl delete pods "${POD_NAME}"' EXIT -kubectl wait --for=condition=Ready "pod/${POD_NAME}" --timeout=600s +kubectl wait --for=condition=Ready "pod/${POD_NAME}" --timeout=15m kubectl logs -f "${POD_NAME}" # Wait until POD will be terminated -wait_secs=200 +wait_secs=300 while ((wait_secs > 0)) && ! kubectl describe "pod/${POD_NAME}" | grep -q Terminated; do - sleep 5 - ((wait_secs-=5)) + sleep 10 + ((wait_secs-=10)) done readonly EXIT_CODE=$(kubectl get pod "${POD_NAME}" \