PowerShell: various cleanups / fixes
| ... | ... |
@@ -125,7 +125,7 @@ Function Nuke-Everything {
|
| 125 | 125 |
|
| 126 | 126 |
try {
|
| 127 | 127 |
|
| 128 |
- if ($env:SKIP_ALL_CLEANUP -eq $null) {
|
|
| 128 |
+ if ($null -eq $env:SKIP_ALL_CLEANUP) {
|
|
| 129 | 129 |
Write-Host -ForegroundColor green "INFO: Nuke-Everything..." |
| 130 | 130 |
$containerCount = ($(docker ps -aq | Measure-Object -line).Lines) |
| 131 | 131 |
if (-not $LastExitCode -eq 0) {
|
| ... | ... |
@@ -156,11 +156,11 @@ Function Nuke-Everything {
|
| 156 | 156 |
Stop-Process -Id $p -Force -ErrorAction SilentlyContinue |
| 157 | 157 |
} |
| 158 | 158 |
|
| 159 |
- if ($pidFile -ne $Null) {
|
|
| 159 |
+ if ($null -ne $pidFile) {
|
|
| 160 | 160 |
Write-Host "INFO: Tidying pidfile $pidfile" |
| 161 | 161 |
if (Test-Path $pidFile) {
|
| 162 | 162 |
$p=Get-Content $pidFile -raw |
| 163 |
- if ($p -ne $null){
|
|
| 163 |
+ if ($null -ne $p){
|
|
| 164 | 164 |
Write-Host -ForegroundColor green "INFO: Stopping possible daemon pid $p" |
| 165 | 165 |
taskkill -f -t -pid $p |
| 166 | 166 |
} |
| ... | ... |
@@ -186,7 +186,7 @@ Function Nuke-Everything {
|
| 186 | 186 |
|
| 187 | 187 |
# Delete the directory using our dangerous utility unless told not to |
| 188 | 188 |
if (Test-Path "$env:TESTRUN_DRIVE`:\$env:TESTRUN_SUBDIR") {
|
| 189 |
- if (($env:SKIP_ZAP_DUT -ne $null) -or ($env:SKIP_ALL_CLEANUP -eq $null)) {
|
|
| 189 |
+ if (($null -ne $env:SKIP_ZAP_DUT) -or ($null -eq $env:SKIP_ALL_CLEANUP)) {
|
|
| 190 | 190 |
Write-Host -ForegroundColor Green "INFO: Nuking $env:TESTRUN_DRIVE`:\$env:TESTRUN_SUBDIR" |
| 191 | 191 |
docker-ci-zap "-folder=$env:TESTRUN_DRIVE`:\$env:TESTRUN_SUBDIR" |
| 192 | 192 |
} else {
|
| ... | ... |
@@ -252,25 +252,25 @@ Try {
|
| 252 | 252 |
Get-ChildItem Env: | Out-String |
| 253 | 253 |
|
| 254 | 254 |
# PR |
| 255 |
- if (-not ($env:PR -eq $Null)) { echo "INFO: PR#$env:PR (https://github.com/docker/docker/pull/$env:PR)" }
|
|
| 255 |
+ if (-not ($null -eq $env:PR)) { Write-Output "INFO: PR#$env:PR (https://github.com/docker/docker/pull/$env:PR)" }
|
|
| 256 | 256 |
|
| 257 | 257 |
# Make sure docker is installed |
| 258 |
- if ((Get-Command "docker" -ErrorAction SilentlyContinue) -eq $null) { Throw "ERROR: docker is not installed or not found on path" }
|
|
| 258 |
+ if ($null -eq (Get-Command "docker" -ErrorAction SilentlyContinue)) { Throw "ERROR: docker is not installed or not found on path" }
|
|
| 259 | 259 |
|
| 260 | 260 |
# Make sure docker-ci-zap is installed |
| 261 |
- if ((Get-Command "docker-ci-zap" -ErrorAction SilentlyContinue) -eq $null) { Throw "ERROR: docker-ci-zap is not installed or not found on path" }
|
|
| 261 |
+ if ($null -eq (Get-Command "docker-ci-zap" -ErrorAction SilentlyContinue)) { Throw "ERROR: docker-ci-zap is not installed or not found on path" }
|
|
| 262 | 262 |
|
| 263 | 263 |
# Make sure SOURCES_DRIVE is set |
| 264 |
- if ($env:SOURCES_DRIVE -eq $Null) { Throw "ERROR: Environment variable SOURCES_DRIVE is not set" }
|
|
| 264 |
+ if ($null -eq $env:SOURCES_DRIVE) { Throw "ERROR: Environment variable SOURCES_DRIVE is not set" }
|
|
| 265 | 265 |
|
| 266 | 266 |
# Make sure TESTRUN_DRIVE is set |
| 267 |
- if ($env:TESTRUN_DRIVE -eq $Null) { Throw "ERROR: Environment variable TESTRUN_DRIVE is not set" }
|
|
| 267 |
+ if ($null -eq $env:TESTRUN_DRIVE) { Throw "ERROR: Environment variable TESTRUN_DRIVE is not set" }
|
|
| 268 | 268 |
|
| 269 | 269 |
# Make sure SOURCES_SUBDIR is set |
| 270 |
- if ($env:SOURCES_SUBDIR -eq $Null) { Throw "ERROR: Environment variable SOURCES_SUBDIR is not set" }
|
|
| 270 |
+ if ($null -eq $env:SOURCES_SUBDIR) { Throw "ERROR: Environment variable SOURCES_SUBDIR is not set" }
|
|
| 271 | 271 |
|
| 272 | 272 |
# Make sure TESTRUN_SUBDIR is set |
| 273 |
- if ($env:TESTRUN_SUBDIR -eq $Null) { Throw "ERROR: Environment variable TESTRUN_SUBDIR is not set" }
|
|
| 273 |
+ if ($null -eq $env:TESTRUN_SUBDIR) { Throw "ERROR: Environment variable TESTRUN_SUBDIR is not set" }
|
|
| 274 | 274 |
|
| 275 | 275 |
# SOURCES_DRIVE\SOURCES_SUBDIR must be a directory and exist |
| 276 | 276 |
if (-not (Test-Path -PathType Container "$env:SOURCES_DRIVE`:\$env:SOURCES_SUBDIR")) { Throw "ERROR: $env:SOURCES_DRIVE`:\$env:SOURCES_SUBDIR must be an existing directory" }
|
| ... | ... |
@@ -287,12 +287,12 @@ Try {
|
| 287 | 287 |
} |
| 288 | 288 |
|
| 289 | 289 |
# Make sure we start at the root of the sources |
| 290 |
- cd "$env:SOURCES_DRIVE`:\$env:SOURCES_SUBDIR\src\github.com\docker\docker" |
|
| 291 |
- Write-Host -ForegroundColor Green "INFO: Running in $(pwd)" |
|
| 290 |
+ Set-Location "$env:SOURCES_DRIVE`:\$env:SOURCES_SUBDIR\src\github.com\docker\docker" |
|
| 291 |
+ Write-Host -ForegroundColor Green "INFO: Running in $(Get-Location)" |
|
| 292 | 292 |
|
| 293 | 293 |
# Make sure we are in repo |
| 294 | 294 |
if (-not (Test-Path -PathType Leaf -Path ".\Dockerfile.windows")) {
|
| 295 |
- Throw "$(pwd) does not contain Dockerfile.windows!" |
|
| 295 |
+ Throw "$(Get-Location) does not contain Dockerfile.windows!" |
|
| 296 | 296 |
} |
| 297 | 297 |
Write-Host -ForegroundColor Green "INFO: docker/docker repository was found" |
| 298 | 298 |
|
| ... | ... |
@@ -314,28 +314,26 @@ Try {
|
| 314 | 314 |
# Try the internal azure CI image version or Microsoft internal corpnet where the base image is already pre-prepared on the disk, |
| 315 | 315 |
# either through Invoke-DockerCI or, in the case of Azure CI servers, baked into the VHD at the same location. |
| 316 | 316 |
if (Test-Path $("$env:SOURCES_DRIVE`:\baseimages\"+$ControlDaemonBaseImage+".tar")) {
|
| 317 |
- |
|
| 318 |
- # An optimization for CI servers to copy it to the D: drive which is an SSD. |
|
| 319 |
- if ($env:SOURCES_DRIVE -ne $env:TESTRUN_DRIVE) {
|
|
| 320 |
- $readBaseFrom=$env:TESTRUN_DRIVE |
|
| 321 |
- if (!(Test-Path "$env:TESTRUN_DRIVE`:\baseimages")) {
|
|
| 322 |
- New-Item "$env:TESTRUN_DRIVE`:\baseimages" -type directory | Out-Null |
|
| 323 |
- } |
|
| 324 |
- if (!(Test-Path "$env:TESTRUN_DRIVE`:\baseimages\windowsservercore.tar")) {
|
|
| 325 |
- if (Test-Path "$env:SOURCES_DRIVE`:\baseimages\windowsservercore.tar") {
|
|
| 326 |
- Write-Host -ForegroundColor Green "INFO: Optimisation - copying $env:SOURCES_DRIVE`:\baseimages\windowsservercore.tar to $env:TESTRUN_DRIVE`:\baseimages" |
|
| 327 |
- Copy-Item "$env:SOURCES_DRIVE`:\baseimages\windowsservercore.tar" "$env:TESTRUN_DRIVE`:\baseimages" |
|
| 328 |
- } |
|
| 329 |
- } |
|
| 330 |
- if (!(Test-Path "$env:TESTRUN_DRIVE`:\baseimages\nanoserver.tar")) {
|
|
| 331 |
- if (Test-Path "$env:SOURCES_DRIVE`:\baseimages\nanoserver.tar") {
|
|
| 332 |
- Write-Host -ForegroundColor Green "INFO: Optimisation - copying $env:SOURCES_DRIVE`:\baseimages\nanoserver.tar to $env:TESTRUN_DRIVE`:\baseimages" |
|
| 333 |
- Copy-Item "$env:SOURCES_DRIVE`:\baseimages\nanoserver.tar" "$env:TESTRUN_DRIVE`:\baseimages" |
|
| 334 |
- } |
|
| 335 |
- } |
|
| 336 |
- $readBaseFrom=$env:TESTRUN_DRIVE |
|
| 337 |
- } |
|
| 338 |
- |
|
| 317 |
+ # An optimization for CI servers to copy it to the D: drive which is an SSD. |
|
| 318 |
+ if ($env:SOURCES_DRIVE -ne $env:TESTRUN_DRIVE) {
|
|
| 319 |
+ $readBaseFrom=$env:TESTRUN_DRIVE |
|
| 320 |
+ if (!(Test-Path "$env:TESTRUN_DRIVE`:\baseimages")) {
|
|
| 321 |
+ New-Item "$env:TESTRUN_DRIVE`:\baseimages" -type directory | Out-Null |
|
| 322 |
+ } |
|
| 323 |
+ if (!(Test-Path "$env:TESTRUN_DRIVE`:\baseimages\windowsservercore.tar")) {
|
|
| 324 |
+ if (Test-Path "$env:SOURCES_DRIVE`:\baseimages\windowsservercore.tar") {
|
|
| 325 |
+ Write-Host -ForegroundColor Green "INFO: Optimisation - copying $env:SOURCES_DRIVE`:\baseimages\windowsservercore.tar to $env:TESTRUN_DRIVE`:\baseimages" |
|
| 326 |
+ Copy-Item "$env:SOURCES_DRIVE`:\baseimages\windowsservercore.tar" "$env:TESTRUN_DRIVE`:\baseimages" |
|
| 327 |
+ } |
|
| 328 |
+ } |
|
| 329 |
+ if (!(Test-Path "$env:TESTRUN_DRIVE`:\baseimages\nanoserver.tar")) {
|
|
| 330 |
+ if (Test-Path "$env:SOURCES_DRIVE`:\baseimages\nanoserver.tar") {
|
|
| 331 |
+ Write-Host -ForegroundColor Green "INFO: Optimisation - copying $env:SOURCES_DRIVE`:\baseimages\nanoserver.tar to $env:TESTRUN_DRIVE`:\baseimages" |
|
| 332 |
+ Copy-Item "$env:SOURCES_DRIVE`:\baseimages\nanoserver.tar" "$env:TESTRUN_DRIVE`:\baseimages" |
|
| 333 |
+ } |
|
| 334 |
+ } |
|
| 335 |
+ $readBaseFrom=$env:TESTRUN_DRIVE |
|
| 336 |
+ } |
|
| 339 | 337 |
Write-Host -ForegroundColor Green "INFO: Loading"$ControlDaemonBaseImage".tar from disk. This may take some time..." |
| 340 | 338 |
$ErrorActionPreference = "SilentlyContinue" |
| 341 | 339 |
docker load -i $("$readBaseFrom`:\baseimages\"+$ControlDaemonBaseImage+".tar")
|
| ... | ... |
@@ -418,7 +416,7 @@ Try {
|
| 418 | 418 |
New-Item -ItemType Directory "$env:TEMP\localappdata" -ErrorAction SilentlyContinue | Out-Null |
| 419 | 419 |
New-Item -ItemType Directory "$env:TEMP\binary" -ErrorAction SilentlyContinue | Out-Null |
| 420 | 420 |
New-Item -ItemType Directory "$env:TEMP\installer" -ErrorAction SilentlyContinue | Out-Null |
| 421 |
- if ($env:SKIP_COPY_GO -eq $null) {
|
|
| 421 |
+ if ($null -eq $env:SKIP_COPY_GO) {
|
|
| 422 | 422 |
# Wipe the previous version of GO - we're going to get it out of the image |
| 423 | 423 |
if (Test-Path "$env:TEMP\go") { Remove-Item "$env:TEMP\go" -Recurse -Force -ErrorAction SilentlyContinue | Out-Null }
|
| 424 | 424 |
New-Item -ItemType Directory "$env:TEMP\go" -ErrorAction SilentlyContinue | Out-Null |
| ... | ... |
@@ -427,21 +425,21 @@ Try {
|
| 427 | 427 |
Write-Host -ForegroundColor Green "INFO: Location for testing is $env:TEMP" |
| 428 | 428 |
|
| 429 | 429 |
# CI Integrity check - ensure Dockerfile.windows and Dockerfile go versions match |
| 430 |
- $goVersionDockerfileWindows=$(Get-Content ".\Dockerfile.windows" | Select-String "^ENV GO_VERSION").ToString().Replace("ENV GO_VERSION=","").Replace("\","").Replace("``","").Trim()
|
|
| 431 |
- $goVersionDockerfile=$(Get-Content ".\Dockerfile" | Select-String "^ENV GO_VERSION") |
|
| 430 |
+ $goVersionDockerfileWindows=$(Get-Content ".\Dockerfile.windows" | Select-String "^ENV GO_VERSION" | Select-object -First 1).ToString().Replace("ENV GO_VERSION=","").Replace("\","").Replace("``","").Trim()
|
|
| 431 |
+ $goVersionDockerfile=$(Get-Content ".\Dockerfile" | Select-String "^ENV GO_VERSION" | Select-object -First 1) |
|
| 432 | 432 |
|
| 433 | 433 |
# As of go 1.11, Dockerfile changed to be in the format like "FROM golang:1.11.0 AS base". |
| 434 | 434 |
# If a version number ends with .0 (as in 1.11.0, a convention used in golang docker |
| 435 | 435 |
# image versions), it needs to be removed (i.e. "1.11.0" becomes "1.11"). |
| 436 |
- if ($goVersionDockerfile -eq $Null) {
|
|
| 437 |
- $goVersionDockerfile=$(Get-Content ".\Dockerfile" | Select-String "^FROM golang:") |
|
| 438 |
- if ($goVersionDockerfile -ne $Null) {
|
|
| 436 |
+ if ($null -eq $goVersionDockerfile) {
|
|
| 437 |
+ $goVersionDockerfile=$(Get-Content ".\Dockerfile" | Select-String "^FROM golang:" | Select-object -First 1) |
|
| 438 |
+ if ($null -ne $goVersionDockerfile) {
|
|
| 439 | 439 |
$goVersionDockerfile = $goVersionDockerfile.ToString().Split(" ")[1].Split(":")[1] -replace '\.0$',''
|
| 440 | 440 |
} |
| 441 | 441 |
} else {
|
| 442 | 442 |
$goVersionDockerfile = $goVersionDockerfile.ToString().Split(" ")[2]
|
| 443 | 443 |
} |
| 444 |
- if ($goVersionDockerfile -eq $Null) {
|
|
| 444 |
+ if ($null -eq $goVersionDockerfile) {
|
|
| 445 | 445 |
Throw "ERROR: Failed to extract golang version from Dockerfile" |
| 446 | 446 |
} |
| 447 | 447 |
Write-Host -ForegroundColor Green "INFO: Validating GOLang consistency in Dockerfile.windows..." |
| ... | ... |
@@ -450,7 +448,7 @@ Try {
|
| 450 | 450 |
} |
| 451 | 451 |
|
| 452 | 452 |
# Build the image |
| 453 |
- if ($env:SKIP_IMAGE_BUILD -eq $null) {
|
|
| 453 |
+ if ($null -eq $env:SKIP_IMAGE_BUILD) {
|
|
| 454 | 454 |
Write-Host -ForegroundColor Cyan "`n`nINFO: Building the image from Dockerfile.windows at $(Get-Date)..." |
| 455 | 455 |
Write-Host |
| 456 | 456 |
$ErrorActionPreference = "SilentlyContinue" |
| ... | ... |
@@ -476,7 +474,7 @@ Try {
|
| 476 | 476 |
} |
| 477 | 477 |
|
| 478 | 478 |
# Build the binary in a container unless asked to skip it. |
| 479 |
- if ($env:SKIP_BINARY_BUILD -eq $null) {
|
|
| 479 |
+ if ($null -eq $env:SKIP_BINARY_BUILD) {
|
|
| 480 | 480 |
Write-Host -ForegroundColor Cyan "`n`nINFO: Building the test binaries at $(Get-Date)..." |
| 481 | 481 |
$ErrorActionPreference = "SilentlyContinue" |
| 482 | 482 |
docker rm -f $COMMITHASH 2>&1 | Out-Null |
| ... | ... |
@@ -528,7 +526,7 @@ Try {
|
| 528 | 528 |
|
| 529 | 529 |
# Grab the golang installer out of the built image. That way, we know we are consistent once extracted and paths set, |
| 530 | 530 |
# so there's no need to re-deploy on account of an upgrade to the version of GO being used in docker. |
| 531 |
- if ($env:SKIP_COPY_GO -eq $null) {
|
|
| 531 |
+ if ($null -eq $env:SKIP_COPY_GO) {
|
|
| 532 | 532 |
Write-Host -ForegroundColor Green "INFO: Copying the golang package from the container to $env:TEMP\installer\go.zip..." |
| 533 | 533 |
docker cp "$COMMITHASH`:c`:\go.zip" $env:TEMP\installer\ |
| 534 | 534 |
if (-not($LastExitCode -eq 0)) {
|
| ... | ... |
@@ -591,7 +589,7 @@ Try {
|
| 591 | 591 |
New-Item -ItemType Directory $env:TEMP\daemon -ErrorAction SilentlyContinue | Out-Null |
| 592 | 592 |
|
| 593 | 593 |
# In LCOW mode, for now we need to set an environment variable before starting the daemon under test |
| 594 |
- if (($env:LCOW_MODE -ne $Null) -or ($env:LCOW_BASIC_MODE -ne $Null)) {
|
|
| 594 |
+ if (($null -ne $env:LCOW_MODE) -or ($null -ne $env:LCOW_BASIC_MODE)) {
|
|
| 595 | 595 |
$env:LCOW_SUPPORTED=1 |
| 596 | 596 |
} |
| 597 | 597 |
|
| ... | ... |
@@ -604,13 +602,13 @@ Try {
|
| 604 | 604 |
$daemonStarted=1 |
| 605 | 605 |
|
| 606 | 606 |
# In LCOW mode, turn off that variable |
| 607 |
- if (($env:LCOW_MODE -ne $Null) -or ($env:LCOW_BASIC_MODE -ne $Null)) {
|
|
| 607 |
+ if (($null -ne $env:LCOW_MODE) -or ($null -ne $env:LCOW_BASIC_MODE)) {
|
|
| 608 | 608 |
$env:LCOW_SUPPORTED="" |
| 609 | 609 |
} |
| 610 | 610 |
|
| 611 | 611 |
|
| 612 | 612 |
# Start tailing the daemon under test if the command is installed |
| 613 |
- if ((Get-Command "tail" -ErrorAction SilentlyContinue) -ne $null) {
|
|
| 613 |
+ if ($null -ne (Get-Command "tail" -ErrorAction SilentlyContinue)) {
|
|
| 614 | 614 |
$tail = start-process "tail" -ArgumentList "-f $env:TEMP\dut.out" -ErrorAction SilentlyContinue |
| 615 | 615 |
} |
| 616 | 616 |
|
| ... | ... |
@@ -672,11 +670,11 @@ Try {
|
| 672 | 672 |
Write-Host |
| 673 | 673 |
|
| 674 | 674 |
# Don't need Windows images when in LCOW mode. |
| 675 |
- if (($env:LCOW_MODE -eq $Null) -and ($env:LCOW_BASIC_MODE -eq $Null)) {
|
|
| 675 |
+ if (($null -eq $env:LCOW_MODE) -and ($null -eq $env:LCOW_BASIC_MODE)) {
|
|
| 676 | 676 |
|
| 677 | 677 |
# Default to windowsservercore for the base image used for the tests. The "docker" image |
| 678 | 678 |
# and the control daemon use microsoft/windowsservercore regardless. This is *JUST* for the tests. |
| 679 |
- if ($env:WINDOWS_BASE_IMAGE -eq $Null) {
|
|
| 679 |
+ if ($null -eq $env:WINDOWS_BASE_IMAGE) {
|
|
| 680 | 680 |
$env:WINDOWS_BASE_IMAGE="microsoft/windowsservercore" |
| 681 | 681 |
} |
| 682 | 682 |
|
| ... | ... |
@@ -725,7 +723,7 @@ Try {
|
| 725 | 725 |
} |
| 726 | 726 |
|
| 727 | 727 |
# Run the validation tests unless SKIP_VALIDATION_TESTS is defined. |
| 728 |
- if ($env:SKIP_VALIDATION_TESTS -eq $null) {
|
|
| 728 |
+ if ($null -eq $env:SKIP_VALIDATION_TESTS) {
|
|
| 729 | 729 |
Write-Host -ForegroundColor Cyan "INFO: Running validation tests at $(Get-Date)..." |
| 730 | 730 |
$ErrorActionPreference = "SilentlyContinue" |
| 731 | 731 |
$Duration=$(Measure-Command { hack\make.ps1 -DCO -GoFormat -PkgImports | Out-Host })
|
| ... | ... |
@@ -740,8 +738,8 @@ Try {
|
| 740 | 740 |
|
| 741 | 741 |
# Note the unit tests won't work in LCOW mode as I turned off loading the base images above. |
| 742 | 742 |
# Run the unit tests inside a container unless SKIP_UNIT_TESTS is defined |
| 743 |
- if (($env:LCOW_MODE -eq $Null) -and ($env:LCOW_BASIC_MODE -eq $Null)) {
|
|
| 744 |
- if ($env:SKIP_UNIT_TESTS -eq $null) {
|
|
| 743 |
+ if (($null -eq $env:LCOW_MODE) -and ($null -eq $env:LCOW_BASIC_MODE)) {
|
|
| 744 |
+ if ($null -eq $env:SKIP_UNIT_TESTS) {
|
|
| 745 | 745 |
Write-Host -ForegroundColor Cyan "INFO: Running unit tests at $(Get-Date)..." |
| 746 | 746 |
$ErrorActionPreference = "SilentlyContinue" |
| 747 | 747 |
$Duration=$(Measure-Command {docker run -e DOCKER_GITCOMMIT=$COMMITHASH$CommitUnsupported docker hack\make.ps1 -TestUnit | Out-Host })
|
| ... | ... |
@@ -756,8 +754,8 @@ Try {
|
| 756 | 756 |
} |
| 757 | 757 |
|
| 758 | 758 |
# Add the Windows busybox image. Needed for WCOW integration tests |
| 759 |
- if (($env:LCOW_MODE -eq $Null) -and ($env:LCOW_BASIC_MODE -eq $Null)) {
|
|
| 760 |
- if ($env:SKIP_INTEGRATION_TESTS -eq $null) {
|
|
| 759 |
+ if (($null -eq $env:LCOW_MODE) -and ($null -eq $env:LCOW_BASIC_MODE)) {
|
|
| 760 |
+ if ($null -eq $env:SKIP_INTEGRATION_TESTS) {
|
|
| 761 | 761 |
$ErrorActionPreference = "SilentlyContinue" |
| 762 | 762 |
# Build it regardless while switching between nanoserver and windowsservercore |
| 763 | 763 |
#$bbCount = $(& "$env:TEMP\binary\docker-$COMMITHASH" "-H=$($DASHH_CUT)" images | Select-String "busybox" | Measure-Object -line).Lines |
| ... | ... |
@@ -797,8 +795,8 @@ Try {
|
| 797 | 797 |
} |
| 798 | 798 |
|
| 799 | 799 |
# Run the WCOW integration tests unless SKIP_INTEGRATION_TESTS is defined |
| 800 |
- if (($env:LCOW_MODE -eq $Null) -and ($env:LCOW_BASIC_MODE -eq $Null)) {
|
|
| 801 |
- if ($env:SKIP_INTEGRATION_TESTS -eq $null) {
|
|
| 800 |
+ if (($null -eq $env:LCOW_MODE) -and ($null -eq $env:LCOW_BASIC_MODE)) {
|
|
| 801 |
+ if ($null -eq $env:SKIP_INTEGRATION_TESTS) {
|
|
| 802 | 802 |
Write-Host -ForegroundColor Cyan "INFO: Running integration tests at $(Get-Date)..." |
| 803 | 803 |
$ErrorActionPreference = "SilentlyContinue" |
| 804 | 804 |
|
| ... | ... |
@@ -808,7 +806,7 @@ Try {
|
| 808 | 808 |
#https://blogs.technet.microsoft.com/heyscriptingguy/2011/09/20/solve-problems-with-external-command-lines-in-powershell/ is useful to see tokenising |
| 809 | 809 |
$c = "go test " |
| 810 | 810 |
$c += "`"-check.v`" " |
| 811 |
- if ($env:INTEGRATION_TEST_NAME -ne $null) { # Makes is quicker for debugging to be able to run only a subset of the integration tests
|
|
| 811 |
+ if ($null -ne $env:INTEGRATION_TEST_NAME) { # Makes is quicker for debugging to be able to run only a subset of the integration tests
|
|
| 812 | 812 |
$c += "`"-check.f`" " |
| 813 | 813 |
$c += "`"$env:INTEGRATION_TEST_NAME`" " |
| 814 | 814 |
Write-Host -ForegroundColor Magenta "WARN: Only running integration tests matching $env:INTEGRATION_TEST_NAME" |
| ... | ... |
@@ -817,7 +815,7 @@ Try {
|
| 817 | 817 |
$c += "`"-check.timeout`" " + "`"10m`" " |
| 818 | 818 |
$c += "`"-test.timeout`" " + "`"200m`" " |
| 819 | 819 |
|
| 820 |
- if ($env:INTEGRATION_IN_CONTAINER -ne $null) {
|
|
| 820 |
+ if ($null -ne $env:INTEGRATION_IN_CONTAINER) {
|
|
| 821 | 821 |
Write-Host -ForegroundColor Green "INFO: Integration tests being run inside a container" |
| 822 | 822 |
# Note we talk back through the containers gateway address |
| 823 | 823 |
# And the ridiculous lengths we have to go to to get the default gateway address... (GetNetIPConfiguration doesn't work in nanoserver) |
| ... | ... |
@@ -833,7 +831,7 @@ Try {
|
| 833 | 833 |
"`$env`:PATH`='c`:\target;'+`$env:PATH`; `$env:DOCKER_HOST`='tcp`://'+(ipconfig | select -last 1).Substring(39)+'`:2357'; c:\target\runIntegrationCLI.ps1" | Out-Host } ) |
| 834 | 834 |
} else {
|
| 835 | 835 |
Write-Host -ForegroundColor Green "INFO: Integration tests being run from the host:" |
| 836 |
- cd "$env:SOURCES_DRIVE`:\$env:SOURCES_SUBDIR\src\github.com\docker\docker\integration-cli" |
|
| 836 |
+ Set-Location "$env:SOURCES_DRIVE`:\$env:SOURCES_SUBDIR\src\github.com\docker\docker\integration-cli" |
|
| 837 | 837 |
$env:DOCKER_HOST=$DASHH_CUT |
| 838 | 838 |
$env:PATH="$env:TEMP\binary;$env:PATH;" # Force to use the test binaries, not the host ones. |
| 839 | 839 |
Write-Host -ForegroundColor Green "INFO: $c" |
| ... | ... |
@@ -851,7 +849,7 @@ Try {
|
| 851 | 851 |
} |
| 852 | 852 |
} else {
|
| 853 | 853 |
# The LCOW version of the tests here |
| 854 |
- if ($env:SKIP_INTEGRATION_TESTS -eq $null) {
|
|
| 854 |
+ if ($null -eq $env:SKIP_INTEGRATION_TESTS) {
|
|
| 855 | 855 |
Write-Host -ForegroundColor Cyan "INFO: Running LCOW tests at $(Get-Date)..." |
| 856 | 856 |
|
| 857 | 857 |
$ErrorActionPreference = "SilentlyContinue" |
| ... | ... |
@@ -866,7 +864,7 @@ Try {
|
| 866 | 866 |
# Force to use the test binaries, not the host ones. |
| 867 | 867 |
$env:PATH="$env:TEMP\binary;$env:PATH;" |
| 868 | 868 |
|
| 869 |
- if ($env:LCOW_BASIC_MODE -ne $null) {
|
|
| 869 |
+ if ($null -ne $env:LCOW_BASIC_MODE) {
|
|
| 870 | 870 |
$wc = New-Object net.webclient |
| 871 | 871 |
try {
|
| 872 | 872 |
Write-Host -ForegroundColor green "INFO: Downloading latest execution script..." |
| ... | ... |
@@ -889,7 +887,7 @@ Try {
|
| 889 | 889 |
#https://blogs.technet.microsoft.com/heyscriptingguy/2011/09/20/solve-problems-with-external-command-lines-in-powershell/ is useful to see tokenising |
| 890 | 890 |
$c = "go test " |
| 891 | 891 |
$c += "`"-check.v`" " |
| 892 |
- if ($env:INTEGRATION_TEST_NAME -ne $null) { # Makes is quicker for debugging to be able to run only a subset of the integration tests
|
|
| 892 |
+ if ($null -ne $env:INTEGRATION_TEST_NAME) { # Makes is quicker for debugging to be able to run only a subset of the integration tests
|
|
| 893 | 893 |
$c += "`"-check.f`" " |
| 894 | 894 |
$c += "`"$env:INTEGRATION_TEST_NAME`" " |
| 895 | 895 |
Write-Host -ForegroundColor Magenta "WARN: Only running LCOW integration tests matching $env:INTEGRATION_TEST_NAME" |
| ... | ... |
@@ -899,7 +897,7 @@ Try {
|
| 899 | 899 |
$c += "`"-test.timeout`" " + "`"200m`" " |
| 900 | 900 |
|
| 901 | 901 |
Write-Host -ForegroundColor Green "INFO: LCOW Integration tests being run from the host:" |
| 902 |
- cd "$env:SOURCES_DRIVE`:\$env:SOURCES_SUBDIR\src\github.com\docker\docker\integration-cli" |
|
| 902 |
+ Set-Location "$env:SOURCES_DRIVE`:\$env:SOURCES_SUBDIR\src\github.com\docker\docker\integration-cli" |
|
| 903 | 903 |
Write-Host -ForegroundColor Green "INFO: $c" |
| 904 | 904 |
Write-Host -ForegroundColor Green "INFO: DOCKER_HOST at $DASHH_CUT" |
| 905 | 905 |
# Explicit to not use measure-command otherwise don't get output as it goes |
| ... | ... |
@@ -933,7 +931,7 @@ Try {
|
| 933 | 933 |
# Stop the daemon under test |
| 934 | 934 |
if (Test-Path "$env:TEMP\docker.pid") {
|
| 935 | 935 |
$p=Get-Content "$env:TEMP\docker.pid" -raw |
| 936 |
- if (($p -ne $null) -and ($daemonStarted -eq 1)) {
|
|
| 936 |
+ if (($null -ne $p) -and ($daemonStarted -eq 1)) {
|
|
| 937 | 937 |
Write-Host -ForegroundColor green "INFO: Stopping daemon under test" |
| 938 | 938 |
taskkill -f -t -pid $p |
| 939 | 939 |
#sleep 5 |
| ... | ... |
@@ -958,18 +956,18 @@ Catch [Exception] {
|
| 958 | 958 |
} |
| 959 | 959 |
Finally {
|
| 960 | 960 |
$ErrorActionPreference="SilentlyContinue" |
| 961 |
- $global:ProgressPreference=$origProgressPreference |
|
| 961 |
+ $global:ProgressPreference=$origProgressPreference |
|
| 962 | 962 |
Write-Host -ForegroundColor Green "INFO: Tidying up at end of run" |
| 963 | 963 |
|
| 964 | 964 |
# Restore the path |
| 965 |
- if ($origPath -ne $null) { $env:PATH=$origPath }
|
|
| 965 |
+ if ($null -ne $origPath) { $env:PATH=$origPath }
|
|
| 966 | 966 |
|
| 967 | 967 |
# Restore the DOCKER_HOST |
| 968 |
- if ($origDOCKER_HOST -ne $null) { $env:DOCKER_HOST=$origDOCKER_HOST }
|
|
| 968 |
+ if ($null -ne $origDOCKER_HOST) { $env:DOCKER_HOST=$origDOCKER_HOST }
|
|
| 969 | 969 |
|
| 970 | 970 |
# Restore the GOROOT and GOPATH variables |
| 971 |
- if ($origGOROOT -ne $null) { $env:GOROOT=$origGOROOT }
|
|
| 972 |
- if ($origGOPATH -ne $null) { $env:GOPATH=$origGOPATH }
|
|
| 971 |
+ if ($null -ne $origGOROOT) { $env:GOROOT=$origGOROOT }
|
|
| 972 |
+ if ($null -ne $origGOPATH) { $env:GOPATH=$origGOPATH }
|
|
| 973 | 973 |
|
| 974 | 974 |
# Dump the daemon log if asked to |
| 975 | 975 |
if ($daemonStarted -eq 1) {
|
| ... | ... |
@@ -986,7 +984,7 @@ Finally {
|
| 986 | 986 |
Copy-Item "$env:TEMP\dut.err" "$TEMPORIG\CIDUT.log" -Force -ErrorAction SilentlyContinue |
| 987 | 987 |
} |
| 988 | 988 |
|
| 989 |
- cd "$env:SOURCES_DRIVE\$env:SOURCES_SUBDIR" -ErrorAction SilentlyContinue |
|
| 989 |
+ Set-Location "$env:SOURCES_DRIVE\$env:SOURCES_SUBDIR" -ErrorAction SilentlyContinue |
|
| 990 | 990 |
Nuke-Everything |
| 991 | 991 |
$Dur=New-TimeSpan -Start $StartTime -End $(Get-Date) |
| 992 | 992 |
Write-Host -ForegroundColor $FinallyColour "`nINFO: executeCI.ps1 exiting at $(date). Duration $dur`n" |
| ... | ... |
@@ -218,7 +218,7 @@ Function Validate-DCO($headCommit, $upstreamCommit) {
|
| 218 | 218 |
if ($LASTEXITCODE -ne 0) { Throw "Failed git log --format" }
|
| 219 | 219 |
$commits = $($commits -split '\s+' -match '\S') |
| 220 | 220 |
$badCommits=@() |
| 221 |
- $commits | %{
|
|
| 221 |
+ $commits | ForEach-Object{
|
|
| 222 | 222 |
# Skip commits with no content such as merge commits etc |
| 223 | 223 |
if ($(git log -1 --format=format: --name-status $_).Length -gt 0) {
|
| 224 | 224 |
# Ignore exit code on next call - always process regardless |
| ... | ... |
@@ -244,7 +244,7 @@ Function Validate-PkgImports($headCommit, $upstreamCommit) {
|
| 244 | 244 |
|
| 245 | 245 |
# Get a list of go source-code files which have changed under pkg\. Ignore exit code on next call - always process regardless |
| 246 | 246 |
$files=@(); $files = Invoke-Expression "git diff $upstreamCommit...$headCommit --diff-filter=ACMR --name-only -- `'pkg\*.go`'" |
| 247 |
- $badFiles=@(); $files | %{
|
|
| 247 |
+ $badFiles=@(); $files | ForEach-Object{
|
|
| 248 | 248 |
$file=$_ |
| 249 | 249 |
# For the current changed file, get its list of dependencies, sorted and uniqued. |
| 250 | 250 |
$imports = Invoke-Expression "go list -e -f `'{{ .Deps }}`' $file"
|
| ... | ... |
@@ -255,13 +255,13 @@ Function Validate-PkgImports($headCommit, $upstreamCommit) {
|
| 255 | 255 |
-NotMatch "^github.com/docker/docker/vendor" ` |
| 256 | 256 |
-Match "^github.com/docker/docker" ` |
| 257 | 257 |
-Replace "`n", "" |
| 258 |
- $imports | % { $badFiles+="$file imports $_`n" }
|
|
| 258 |
+ $imports | ForEach-Object{ $badFiles+="$file imports $_`n" }
|
|
| 259 | 259 |
} |
| 260 | 260 |
if ($badFiles.Length -eq 0) {
|
| 261 | 261 |
Write-Host 'Congratulations! ".\pkg\*.go" is safely isolated from internal code.' |
| 262 | 262 |
} else {
|
| 263 | 263 |
$e = "`nThese files import internal code: (either directly or indirectly)`n" |
| 264 |
- $badFiles | %{ $e+=" - $_"}
|
|
| 264 |
+ $badFiles | ForEach-Object{ $e+=" - $_"}
|
|
| 265 | 265 |
Throw $e |
| 266 | 266 |
} |
| 267 | 267 |
} |
| ... | ... |
@@ -297,7 +297,7 @@ Function Validate-GoFormat($headCommit, $upstreamCommit) {
|
| 297 | 297 |
Write-Host 'Congratulations! All Go source files are properly formatted.' |
| 298 | 298 |
} else {
|
| 299 | 299 |
$e = "`nThese files are not properly gofmt`'d:`n" |
| 300 |
- $badFiles | %{ $e+=" - $_`n"}
|
|
| 300 |
+ $badFiles | ForEach-Object{ $e+=" - $_`n"}
|
|
| 301 | 301 |
$e+= "`nPlease reformat the above files using `"gofmt -s -w`" and commit the result." |
| 302 | 302 |
Throw $e |
| 303 | 303 |
} |
| ... | ... |
@@ -43,19 +43,19 @@ package dockerversion |
| 43 | 43 |
// Default build-time variable for library-import. |
| 44 | 44 |
// This file is overridden on build with build-time information. |
| 45 | 45 |
const ( |
| 46 |
- GitCommit string = "'+$CommitString+'" |
|
| 47 |
- Version string = "'+$DockerVersion+'" |
|
| 48 |
- BuildTime string = "'+$buildDateTime+'" |
|
| 49 |
- PlatformName string = "'+$Platform+'" |
|
| 50 |
- ProductName string = "'+$Product+'" |
|
| 51 |
- DefaultProductLicense string = "'+$DefaultProductLicense+'" |
|
| 46 |
+ GitCommit string = "'+$CommitString+'" |
|
| 47 |
+ Version string = "'+$DockerVersion+'" |
|
| 48 |
+ BuildTime string = "'+$buildDateTime+'" |
|
| 49 |
+ PlatformName string = "'+$Platform+'" |
|
| 50 |
+ ProductName string = "'+$Product+'" |
|
| 51 |
+ DefaultProductLicense string = "'+$DefaultProductLicense+'" |
|
| 52 | 52 |
) |
| 53 | 53 |
|
| 54 | 54 |
// AUTOGENERATED FILE; see hack\make\.go-autogen.ps1 |
| 55 | 55 |
' |
| 56 | 56 |
|
| 57 | 57 |
# Write the file without BOM |
| 58 |
- $outputFile="$(pwd)\dockerversion\version_autogen.go" |
|
| 58 |
+ $outputFile="$(Get-Location)\dockerversion\version_autogen.go" |
|
| 59 | 59 |
if (Test-Path $outputFile) { Remove-Item $outputFile }
|
| 60 | 60 |
[System.IO.File]::WriteAllText($outputFile, $fileContents, (New-Object System.Text.UTF8Encoding($False))) |
| 61 | 61 |
|