From 268ac0e9a446a53550c87f07c1d9db2fa1819022 Mon Sep 17 00:00:00 2001 From: Sharif Elgamal Date: Thu, 30 Sep 2021 15:23:48 -0700 Subject: [PATCH] make sure docker is running no matter what --- .../windows_integration_test_docker.ps1 | 8 +++++- .../windows_integration_test_hyperv.ps1 | 25 +++++++++++++++++++ 2 files changed, 32 insertions(+), 1 deletion(-) diff --git a/hack/jenkins/windows_integration_test_docker.ps1 b/hack/jenkins/windows_integration_test_docker.ps1 index 40729fb7d5..de73ef29ce 100644 --- a/hack/jenkins/windows_integration_test_docker.ps1 +++ b/hack/jenkins/windows_integration_test_docker.ps1 @@ -29,7 +29,13 @@ If ($lastexitcode -gt 0) { $json = "{`"state`": `"failure`", `"description`": `"Jenkins: docker failed to start`", `"target_url`": `"https://storage.googleapis.com/$gcs_bucket/Docker_Windows.txt`", `"context`": `"Docker_Windows`"}" - Invoke-WebRequest -Uri "https://api.github.com/repos/kubernetes/minikube/statuses/$env:COMMIT`?access_token=$env:access_token" -Body $json -ContentType "application/json" -Method Post -usebasicparsing + $creds = "minikube-bot:$($env:access_token)" + $encoded = [System.Convert]::ToBase64String([System.Text.Encoding]::ASCII.GetBytes($crds)) + $auth = "Basic $encoded" + $headers = @{ + Authorization = $auth + } + Invoke-WebRequest -Uri "https://api.github.com/repos/kubernetes/minikube/statuses/$env:COMMIT`" -Headers $headers -Body $json -ContentType "application/json" -Method Post -usebasicparsing docker system prune --all --force Exit $lastexitcode diff --git a/hack/jenkins/windows_integration_test_hyperv.ps1 b/hack/jenkins/windows_integration_test_hyperv.ps1 index 69b768f039..ee3a97d0ec 100644 --- a/hack/jenkins/windows_integration_test_hyperv.ps1 +++ b/hack/jenkins/windows_integration_test_hyperv.ps1 @@ -14,8 +14,33 @@ mkdir -p out +# Docker's kubectl breaks things, and comes earlier in the path than the regular kubectl. So download the expected kubectl and replace Docker's version. +(New-Object Net.WebClient).DownloadFile("https://dl.k8s.io/release/v1.20.0/bin/windows/amd64/kubectl.exe", "C:\Program Files\Docker\Docker\resources\bin\kubectl.exe") + +gsutil.cmd -m cp -r gs://minikube-builds/$env:MINIKUBE_LOCATION/setup_docker_desktop_windows.ps1 out/ gsutil.cmd -m cp -r gs://minikube-builds/$env:MINIKUBE_LOCATION/common.ps1 out/ +$env:SHORT_COMMIT=$env:COMMIT.substring(0, 7) +$gcs_bucket="minikube-builds/logs/$env:MINIKUBE_LOCATION/$env:ROOT_JOB_ID" + +./out/setup_docker_desktop_windows.ps1 +If ($lastexitcode -gt 0) { + echo "Docker failed to start, exiting." + + $json = "{`"state`": `"failure`", `"description`": `"Jenkins: docker failed to start`", `"target_url`": `"https://storage.googleapis.com/$gcs_bucket/Hyper-V_Windows.txt`", `"context`": `"Hyper-V_Windows`"}" + + $creds = "minikube-bot:$($env:access_token)" + $encoded = [System.Convert]::ToBase64String([System.Text.Encoding]::ASCII.GetBytes($crds)) + $auth = "Basic $encoded" + $headers = @{ + Authorization = $auth + } + Invoke-WebRequest -Uri "https://api.github.com/repos/kubernetes/minikube/statuses/$env:COMMIT`" -Headers $headers -Body $json -ContentType "application/json" -Method Post -usebasicparsing + + docker system prune --all --force + Exit $lastexitcode +} + $driver="hyperv" $timeout="180m" $env:JOB_NAME="Hyper-V_Windows"