diff --git a/hack/jenkins/minikube_set_pending.sh b/hack/jenkins/minikube_set_pending.sh index 7bcdd813c6..20f2b5f743 100755 --- a/hack/jenkins/minikube_set_pending.sh +++ b/hack/jenkins/minikube_set_pending.sh @@ -43,7 +43,7 @@ jobs=( 'Docker_Linux' 'Docker_Linux_containerd' # 'Docker_macOS' - # 'Docker_Windows' + 'Docker_Windows' # 'Podman_Linux' ) diff --git a/hack/jenkins/setup_docker_desktop_windows.ps1 b/hack/jenkins/setup_docker_desktop_windows.ps1 new file mode 100644 index 0000000000..14aba3d940 --- /dev/null +++ b/hack/jenkins/setup_docker_desktop_windows.ps1 @@ -0,0 +1,33 @@ +# Copyright 2021 The Kubernetes Authors All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +$attempt = 10 +while($attempt -ne 0) { + Write-Host "Attempt ", $attempt + Write-Host "Wait for 3 minutes" + & "C:\Program Files\Docker\Docker\Docker Desktop.exe" + Start-Sleep 180 + $dockerInfo = docker info + Write-Host "Docker Info ", $dockerInfo + $serverVersion = $dockerInfo | Where-Object {$_ -Match "Server Version"} + Write-Host "Server Version ", $serverVersion + if (![System.String]::IsNullOrEmpty($serverVersion)) { + Write-Host "Docker successfully started!" + exit 0 + } + Write-Host "Restarting Docker Desktop" + Get-Process "*Docker Desktop*" | Stop-Process + $attempt -= 1 +} diff --git a/hack/jenkins/windows_integration_test_docker.ps1 b/hack/jenkins/windows_integration_test_docker.ps1 index b30125c27d..8791fbee9e 100644 --- a/hack/jenkins/windows_integration_test_docker.ps1 +++ b/hack/jenkins/windows_integration_test_docker.ps1 @@ -16,19 +16,60 @@ mkdir -p out gsutil.cmd -m cp gs://minikube-builds/$env:MINIKUBE_LOCATION/minikube-windows-amd64.exe out/ gsutil.cmd -m cp gs://minikube-builds/$env:MINIKUBE_LOCATION/e2e-windows-amd64.exe out/ gsutil.cmd -m cp -r gs://minikube-builds/$env:MINIKUBE_LOCATION/testdata . +gsutil.cmd -m cp -r gs://minikube-builds/$env:MINIKUBE_LOCATION/setup_docker_desktop_windows.ps1 out/ + +./out/setup_docker_desktop_windows.ps1 ./out/minikube-windows-amd64.exe delete --all -out/e2e-windows-amd64.exe -minikube-start-args="--driver=docker" -binary=out/minikube-windows-amd64.exe -test.v -test.timeout=65m +docker ps -aq | ForEach -Process {docker rm -fv $_} + +$started=Get-Date -UFormat %s + +out/e2e-windows-amd64.exe --minikube-start-args="--driver=docker" --binary=out/minikube-windows-amd64.exe --test.v --test.timeout=180m | Tee-Object -FilePath testout.txt $env:result=$lastexitcode # If the last exit code was 0->success, x>0->error -If($env:result -eq 0){$env:status="success"} -Else {$env:status="failure"} +If($env:result -eq 0){ + $env:status="success" + echo "minikube: SUCCESS" +} Else { + $env:status="failure" + echo "minikube: FAIL" +} -# $env:SHORT_COMMIT=$env:COMMIT.substring(0, 7) -# to be used later to implement https://github.com/kubernetes/minikube/issues/6593 -$env:target_url="https://storage.googleapis.com/minikube-builds/logs/$env:MINIKUBE_LOCATION/Docker_Windows.txt" -$json = "{`"state`": `"$env:status`", `"description`": `"Jenkins`", `"target_url`": `"$env:target_url`", `"context`": `"Docker_Windows`"}" +$ended=Get-Date -UFormat %s +$elapsed=$ended-$started +$elapsed=$elapsed/60 +$elapsed=[math]::Round($elapsed, 2) + +Get-Content testout.txt -Encoding ASCII | go tool test2json -t | Out-File -FilePath testout.json -Encoding ASCII + +$gopogh_status=gopogh --in testout.json --out testout.html --name "Docker_Windows" -pr $env:MINIKUBE_LOCATION --repo github.com/kubernetes/minikube/ --details $env:COMMIT + +$failures=echo $gopogh_status | jq '.NumberOfFail' +$tests=echo $gopogh_status | jq '.NumberOfTests' +$bad_status="$failures / $tests failures" + +$description="$status in $elapsed minute(s)." +If($env:status -eq "failure") { + $description="completed with $bad_status in $elapsed minute(s)." +} +echo $description + +$env:SHORT_COMMIT=$env:COMMIT.substring(0, 7) +$gcs_bucket="minikube-builds/logs/$env:MINIKUBE_LOCATION/$env:SHORT_COMMIT" +$env:target_url="https://storage.googleapis.com/$gcs_bucket/Docker_Windows.html" + +#Upload logs to gcs +gsutil -qm cp testout.txt gs://$gcs_bucket/Docker_Windowsout.txt +gsutil -qm cp testout.json gs://$gcs_bucket/Docker_Windows.json +gsutil -qm cp testout.html gs://$gcs_bucket/Docker_Windows.html + +# Update the PR with the new info +$json = "{`"state`": `"$env:status`", `"description`": `"Jenkins: $description`", `"target_url`": `"$env:target_url`", `"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 -Exit $env:result \ No newline at end of file +# Just shutdown Docker, it's safer than anything else +Get-Process "*Docker Desktop*" | Stop-Process + +Exit $env:result