"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "components/engine/hack/ci/windows.ps1" between
docker-ce-19.03.2.tar.gz and docker-ce-19.03.3.tar.gz

About: Docker CE is a project to pack, ship and run any application as a lightweight container. Docker containers can run anywhere, on a laptop or at scale, in production, on VMs, bare metal, OpenStack clusters, public clouds and more. Community edition.

windows.ps1  (docker-ce-19.03.2):windows.ps1  (docker-ce-19.03.3)
skipping to change at line 17 skipping to change at line 17
# By John Howard (@jhowardmsft) January 2016 - bash version; July 2016 Ported to PowerShell # By John Howard (@jhowardmsft) January 2016 - bash version; July 2016 Ported to PowerShell
$ErrorActionPreference = 'Stop' $ErrorActionPreference = 'Stop'
$StartTime=Get-Date $StartTime=Get-Date
# Put up top to be blindingly obvious. The production jenkins.dockerproject.org Linux-container # Put up top to be blindingly obvious. The production jenkins.dockerproject.org Linux-container
# CI job is "Docker-PRs-LoW-RS3". Force into LCOW mode for this run, or not. # CI job is "Docker-PRs-LoW-RS3". Force into LCOW mode for this run, or not.
if ($env:BUILD_TAG -match "-LoW") { $env:LCOW_MODE=1 } if ($env:BUILD_TAG -match "-LoW") { $env:LCOW_MODE=1 }
if ($env:BUILD_TAG -match "-WoW") { $env:LCOW_MODE="" } if ($env:BUILD_TAG -match "-WoW") { $env:LCOW_MODE="" }
Write-Host -ForegroundColor Red "DEBUG: print all environment variables to check
how Jenkins runs this script"
$allArgs = [Environment]::GetCommandLineArgs()
Write-Host -ForegroundColor Red $allArgs
Write-Host -ForegroundColor Red "-----------------------------------------------
-----------------------------"
# ------------------------------------------------------------------------------ ------------- # ------------------------------------------------------------------------------ -------------
# When executed, we rely on four variables being set in the environment: # When executed, we rely on four variables being set in the environment:
# #
# [The reason for being environment variables rather than parameters is historic al. No reason # [The reason for being environment variables rather than parameters is historic al. No reason
# why it couldn't be updated.] # why it couldn't be updated.]
# #
# SOURCES_DRIVE is the drive on which the sources being tested are clon ed from. # SOURCES_DRIVE is the drive on which the sources being tested are clon ed from.
# This should be a straight drive letter, no platform sem antics. # This should be a straight drive letter, no platform sem antics.
# For example 'c' # For example 'c'
# #
skipping to change at line 48 skipping to change at line 53
# to for the daemon under test. On an Azure D2 type host which has # to for the daemon under test. On an Azure D2 type host which has
# an SSD temporary storage D: drive, this is ideal for pe rformance. # an SSD temporary storage D: drive, this is ideal for pe rformance.
# For example 'd' # For example 'd'
# #
# TESTRUN_SUBDIR is the top level directory under TESTRUN_DRIVE where we redirect # TESTRUN_SUBDIR is the top level directory under TESTRUN_DRIVE where we redirect
# everything to for the daemon under test. For example 'C I'. # everything to for the daemon under test. For example 'C I'.
# Hence, the daemon under test is run under # Hence, the daemon under test is run under
# TESTRUN_DRIVE\TESTRUN_SUBDIR\CI-<CommitID> or # TESTRUN_DRIVE\TESTRUN_SUBDIR\CI-<CommitID> or
# d:\CI\CI-<CommitID> # d:\CI\CI-<CommitID>
# #
# Optional environment variables help in CI:
#
# BUILD_NUMBER + BRANCH_NAME are optional variables to be added to the dire
ctory below TESTRUN_SUBDIR
# to have individual folder per CI build. If some files c
ouldn't be
# cleaned up and we want to re-run the build in CI.
# Hence, the daemon under test is run under
# TESTRUN_DRIVE\TESTRUN_SUBDIR\PR-<PR-Number>\<BuildNumbe
r> or
# d:\CI\PR-<PR-Number>\<BuildNumber>
#
# In addition, the following variables can control the run configuration: # In addition, the following variables can control the run configuration:
# #
# DOCKER_DUT_DEBUG if defined starts the daemon under test in debug m ode. # DOCKER_DUT_DEBUG if defined starts the daemon under test in debug m ode.
# #
# DOCKER_STORAGE_OPTS comma-separated list of optional storage driver op
tions for the daemon under test
# examples:
# DOCKER_STORAGE_OPTS="size=40G"
# DOCKER_STORAGE_OPTS="lcow.globalmode=false,lcow.ke
rnel=kernel.efi"
#
# SKIP_VALIDATION_TESTS if defined skips the validation tests # SKIP_VALIDATION_TESTS if defined skips the validation tests
# #
# SKIP_UNIT_TESTS if defined skips the unit tests # SKIP_UNIT_TESTS if defined skips the unit tests
# #
# SKIP_INTEGRATION_TESTS if defined skips the integration tests # SKIP_INTEGRATION_TESTS if defined skips the integration tests
# #
# SKIP_COPY_GO if defined skips copy the go installer from the im age # SKIP_COPY_GO if defined skips copy the go installer from the im age
# #
# DOCKER_DUT_HYPERV if default daemon under test default isolation is hyperv # DOCKER_DUT_HYPERV if default daemon under test default isolation is hyperv
# #
skipping to change at line 80 skipping to change at line 99
# #
# INTEGRATION_IN_CONTAINER if defined, runs the integration tests from inside a container. # INTEGRATION_IN_CONTAINER if defined, runs the integration tests from inside a container.
# As of July 2016, there are known issues with this. # As of July 2016, there are known issues with this.
# #
# SKIP_ALL_CLEANUP if defined, skips any cleanup at the start or end of the run # SKIP_ALL_CLEANUP if defined, skips any cleanup at the start or end of the run
# #
# WINDOWS_BASE_IMAGE if defined, uses that as the base image. Note that the # WINDOWS_BASE_IMAGE if defined, uses that as the base image. Note that the
# docker integration tests are also coded to use the same # docker integration tests are also coded to use the same
# environment variable, and if no set, defaults to m icrosoft/windowsservercore # environment variable, and if no set, defaults to m icrosoft/windowsservercore
# #
# WINDOWS_BASE_IMAGE_TAG if defined, uses that as the tag name for the base
image.
# if no set, defaults to latest
#
# LCOW_BASIC_MODE if defined, does very basic LCOW verification. Ult imately we # LCOW_BASIC_MODE if defined, does very basic LCOW verification. Ult imately we
# want to run the entire CI suite from docker, but t hat's a way off. # want to run the entire CI suite from docker, but t hat's a way off.
# #
# LCOW_MODE if defined, runs the entire CI suite # LCOW_MODE if defined, runs the entire CI suite
# #
# ------------------------------------------------------------------------------ ------------- # ------------------------------------------------------------------------------ -------------
# #
# Jenkins Integration. Add a Windows Powershell build step as follows: # Jenkins Integration. Add a Windows Powershell build step as follows:
# #
# Write-Host -ForegroundColor green "INFO: Jenkins build step starting" # Write-Host -ForegroundColor green "INFO: Jenkins build step starting"
skipping to change at line 140 skipping to change at line 162
if (-not $LastExitCode -eq 0) { if (-not $LastExitCode -eq 0) {
Throw "ERROR: Failed to get container count from control daemon while nuking" Throw "ERROR: Failed to get container count from control daemon while nuking"
} }
Write-Host -ForegroundColor green "INFO: Container count on control daemon to delete is $containerCount" Write-Host -ForegroundColor green "INFO: Container count on control daemon to delete is $containerCount"
if ($(docker ps -aq | Measure-Object -line).Lines -gt 0) { if ($(docker ps -aq | Measure-Object -line).Lines -gt 0) {
docker rm -f $(docker ps -aq) docker rm -f $(docker ps -aq)
} }
$allImages = $(docker images --format "{{.Repository}}#{{.ID}}") $allImages = $(docker images --format "{{.Repository}}#{{.ID}}")
$toRemove = ($allImages | Select-String -NotMatch "windowsserverco re","nanoserver","docker") $toRemove = ($allImages | Select-String -NotMatch "servercore","na noserver","docker")
$imageCount = ($toRemove | Measure-Object -line).Lines $imageCount = ($toRemove | Measure-Object -line).Lines
if ($imageCount -gt 0) { if ($imageCount -gt 0) {
Write-Host -Foregroundcolor green "INFO: Non-base image count on control daemon to delete is $imageCount" Write-Host -Foregroundcolor green "INFO: Non-base image count on control daemon to delete is $imageCount"
docker rmi -f ($toRemove | Foreach-Object { $_.ToString().Split( "#")[1] }) docker rmi -f ($toRemove | Foreach-Object { $_.ToString().Split( "#")[1] })
} }
} else { } else {
Write-Host -ForegroundColor Magenta "WARN: Skipping cleanup of image s and containers" Write-Host -ForegroundColor Magenta "WARN: Skipping cleanup of image s and containers"
} }
skipping to change at line 201 skipping to change at line 223
} else { } else {
Write-Host -ForegroundColor Magenta "WARN: Skip nuking $env:TEST RUN_DRIVE`:\$env:TESTRUN_SUBDIR" Write-Host -ForegroundColor Magenta "WARN: Skip nuking $env:TEST RUN_DRIVE`:\$env:TESTRUN_SUBDIR"
} }
} }
# TODO: This should be able to be removed in August 2017 update. Only ne eded for RS1 Production Server workaround - Psched # TODO: This should be able to be removed in August 2017 update. Only ne eded for RS1 Production Server workaround - Psched
$reg = "HKLM:\System\CurrentControlSet\Services\Psched\Parameters\NdisAd apters" $reg = "HKLM:\System\CurrentControlSet\Services\Psched\Parameters\NdisAd apters"
$count=(Get-ChildItem $reg | Measure-Object).Count $count=(Get-ChildItem $reg | Measure-Object).Count
if ($count -gt 0) { if ($count -gt 0) {
Write-Warning "There are $count NdisAdapters leaked under Psched\Par ameters" Write-Warning "There are $count NdisAdapters leaked under Psched\Par ameters"
if ($env:COMPUTERNAME -match "jenkins-rs1-") { Write-Warning "Cleaning Psched..."
Write-Warning "Cleaning Psched..." Get-ChildItem $reg | Remove-Item -Recurse -Force -ErrorAction Silent
Get-ChildItem $reg | Remove-Item -Recurse -Force -ErrorAction Si lyContinue | Out-Null
lentlyContinue | Out-Null
} else {
Write-Warning "Not cleaning as not a production RS1 server"
}
} }
# TODO: This should be able to be removed in August 2017 update. Only ne eded for RS1 # TODO: This should be able to be removed in August 2017 update. Only ne eded for RS1
$reg = "HKLM:\System\CurrentControlSet\Services\WFPLWFS\Parameters\NdisA dapters" $reg = "HKLM:\System\CurrentControlSet\Services\WFPLWFS\Parameters\NdisA dapters"
$count=(Get-ChildItem $reg | Measure-Object).Count $count=(Get-ChildItem $reg | Measure-Object).Count
if ($count -gt 0) { if ($count -gt 0) {
Write-Warning "There are $count NdisAdapters leaked under WFPLWFS\Pa rameters" Write-Warning "There are $count NdisAdapters leaked under WFPLWFS\Pa rameters"
if ($env:COMPUTERNAME -match "jenkins-rs1-") { Write-Warning "Cleaning WFPLWFS..."
Write-Warning "Cleaning WFPLWFS..." Get-ChildItem $reg | Remove-Item -Recurse -Force -ErrorAction Silent
Get-ChildItem $reg | Remove-Item -Recurse -Force -ErrorAction Si lyContinue | Out-Null
lentlyContinue | Out-Null
} else {
Write-Warning "Not cleaning as not a production RS1 server"
}
} }
} catch { } catch {
# Don't throw any errors onwards Throw $_ # Don't throw any errors onwards Throw $_
} }
} }
Try { Try {
Write-Host -ForegroundColor Cyan "`nINFO: executeCI.ps1 starting at $(date)` n" Write-Host -ForegroundColor Cyan "`nINFO: executeCI.ps1 starting at $(date)` n"
Write-Host -ForegroundColor Green "INFO: Script version $SCRIPT_VER" Write-Host -ForegroundColor Green "INFO: Script version $SCRIPT_VER"
Set-PSDebug -Trace 0 # 1 to turn on Set-PSDebug -Trace 0 # 1 to turn on
skipping to change at line 262 skipping to change at line 276
# PR # PR
if (-not ($null -eq $env:PR)) { Write-Output "INFO: PR#$env:PR (https://gith ub.com/docker/docker/pull/$env:PR)" } if (-not ($null -eq $env:PR)) { Write-Output "INFO: PR#$env:PR (https://gith ub.com/docker/docker/pull/$env:PR)" }
# Make sure docker is installed # Make sure docker is installed
if ($null -eq (Get-Command "docker" -ErrorAction SilentlyContinue)) { Throw "ERROR: docker is not installed or not found on path" } if ($null -eq (Get-Command "docker" -ErrorAction SilentlyContinue)) { Throw "ERROR: docker is not installed or not found on path" }
# Make sure docker-ci-zap is installed # Make sure docker-ci-zap is installed
if ($null -eq (Get-Command "docker-ci-zap" -ErrorAction SilentlyContinue)) { Throw "ERROR: docker-ci-zap is not installed or not found on path" } if ($null -eq (Get-Command "docker-ci-zap" -ErrorAction SilentlyContinue)) { Throw "ERROR: docker-ci-zap is not installed or not found on path" }
# Make sure Windows Defender is disabled
$defender = $false
Try {
$status = Get-MpComputerStatus
if ($status) {
if ($status.RealTimeProtectionEnabled) {
$defender = $true
}
}
} Catch {}
if ($defender) { Write-Host -ForegroundColor Magenta "WARN: Windows Defender
real time protection is enabled, which may cause some integration tests to fail
" }
# Make sure SOURCES_DRIVE is set # Make sure SOURCES_DRIVE is set
if ($null -eq $env:SOURCES_DRIVE) { Throw "ERROR: Environment variable SOURC ES_DRIVE is not set" } if ($null -eq $env:SOURCES_DRIVE) { Throw "ERROR: Environment variable SOURC ES_DRIVE is not set" }
# Make sure TESTRUN_DRIVE is set # Make sure TESTRUN_DRIVE is set
if ($null -eq $env:TESTRUN_DRIVE) { Throw "ERROR: Environment variable TESTR UN_DRIVE is not set" } if ($null -eq $env:TESTRUN_DRIVE) { Throw "ERROR: Environment variable TESTR UN_DRIVE is not set" }
# Make sure SOURCES_SUBDIR is set # Make sure SOURCES_SUBDIR is set
if ($null -eq $env:SOURCES_SUBDIR) { Throw "ERROR: Environment variable SOUR CES_SUBDIR is not set" } if ($null -eq $env:SOURCES_SUBDIR) { Throw "ERROR: Environment variable SOUR CES_SUBDIR is not set" }
# Make sure TESTRUN_SUBDIR is set # Make sure TESTRUN_SUBDIR is set
skipping to change at line 346 skipping to change at line 372
Write-Host -ForegroundColor Green "INFO: Loading"$ControlDaemonBase Image".tar from disk. This may take some time..." Write-Host -ForegroundColor Green "INFO: Loading"$ControlDaemonBase Image".tar from disk. This may take some time..."
$ErrorActionPreference = "SilentlyContinue" $ErrorActionPreference = "SilentlyContinue"
docker load -i $("$readBaseFrom`:\baseimages\"+$ControlDaemonBaseIma ge+".tar") docker load -i $("$readBaseFrom`:\baseimages\"+$ControlDaemonBaseIma ge+".tar")
$ErrorActionPreference = "Stop" $ErrorActionPreference = "Stop"
if (-not $LastExitCode -eq 0) { if (-not $LastExitCode -eq 0) {
Throw $("ERROR: Failed to load $readBaseFrom`:\baseimages\"+$Con trolDaemonBaseImage+".tar") Throw $("ERROR: Failed to load $readBaseFrom`:\baseimages\"+$Con trolDaemonBaseImage+".tar")
} }
Write-Host -ForegroundColor Green "INFO: docker load of"$ControlDaem onBaseImage" completed successfully" Write-Host -ForegroundColor Green "INFO: docker load of"$ControlDaem onBaseImage" completed successfully"
} else { } else {
# We need to docker pull it instead. It will come in directly as mic rosoft/imagename:latest # We need to docker pull it instead. It will come in directly as mic rosoft/imagename:latest
Write-Host -ForegroundColor Green $("INFO: Pulling microsoft/"+$Cont rolDaemonBaseImage+":latest from docker hub. This may take some time...") Write-Host -ForegroundColor Green $("INFO: Pulling $($env:WINDOWS_BA SE_IMAGE):$env:WINDOWS_BASE_IMAGE_TAG from docker hub. This may take some time.. .")
$ErrorActionPreference = "SilentlyContinue" $ErrorActionPreference = "SilentlyContinue"
docker pull $("microsoft/"+$ControlDaemonBaseImage) docker pull "$($env:WINDOWS_BASE_IMAGE):$env:WINDOWS_BASE_IMAGE_TAG"
$ErrorActionPreference = "Stop" $ErrorActionPreference = "Stop"
if (-not $LastExitCode -eq 0) { if (-not $LastExitCode -eq 0) {
Throw $("ERROR: Failed to docker pull microsoft/"+$ControlDaemon BaseImage+":latest.") Throw $("ERROR: Failed to docker pull $($env:WINDOWS_BASE_IMAGE) :$env:WINDOWS_BASE_IMAGE_TAG.")
} }
Write-Host -ForegroundColor Green $("INFO: docker pull of microsoft/ Write-Host -ForegroundColor Green $("INFO: docker pull of $($env:WIN
"+$ControlDaemonBaseImage+":latest completed successfully") DOWS_BASE_IMAGE):$env:WINDOWS_BASE_IMAGE_TAG completed successfully")
Write-Host -ForegroundColor Green $("INFO: Tagging $($env:WINDOWS_BA
SE_IMAGE):$env:WINDOWS_BASE_IMAGE_TAG as microsoft/$ControlDaemonBaseImage")
docker tag "$($env:WINDOWS_BASE_IMAGE):$env:WINDOWS_BASE_IMAGE_TAG"
microsoft/$ControlDaemonBaseImage
} }
} else { } else {
Write-Host -ForegroundColor Green "INFO: Image"$("microsoft/"+$ControlDa emonBaseImage+":latest")"is already loaded in the control daemon" Write-Host -ForegroundColor Green "INFO: Image"$("microsoft/"+$ControlDa emonBaseImage+":latest")"is already loaded in the control daemon"
} }
# Inspect the pulled image to get the version directly # Inspect the pulled image to get the version directly
$ErrorActionPreference = "SilentlyContinue" $ErrorActionPreference = "SilentlyContinue"
$imgVersion = $(docker inspect $("microsoft/"+$ControlDaemonBaseImage) --fo rmat "{{.OsVersion}}") $imgVersion = $(docker inspect $("microsoft/"+$ControlDaemonBaseImage) --fo rmat "{{.OsVersion}}")
$ErrorActionPreference = "Stop" $ErrorActionPreference = "Stop"
Write-Host -ForegroundColor Green $("INFO: Version of microsoft/"+$ControlDa emonBaseImage+":latest is '"+$imgVersion+"'") Write-Host -ForegroundColor Green $("INFO: Version of microsoft/"+$ControlDa emonBaseImage+":latest is '"+$imgVersion+"'")
skipping to change at line 410 skipping to change at line 438
Throw "ERROR: Failed to get commit hash. Are you sure this is a docker r epository?" Throw "ERROR: Failed to get commit hash. Are you sure this is a docker r epository?"
} }
Write-Host -ForegroundColor Green "INFO: Commit hash is $COMMITHASH" Write-Host -ForegroundColor Green "INFO: Commit hash is $COMMITHASH"
# Nuke everything and go back to our sources after # Nuke everything and go back to our sources after
Nuke-Everything Nuke-Everything
cd "$env:SOURCES_DRIVE`:\$env:SOURCES_SUBDIR\src\github.com\docker\docker" cd "$env:SOURCES_DRIVE`:\$env:SOURCES_SUBDIR\src\github.com\docker\docker"
# Redirect to a temporary location. # Redirect to a temporary location.
$TEMPORIG=$env:TEMP $TEMPORIG=$env:TEMP
$env:TEMP="$env:TESTRUN_DRIVE`:\$env:TESTRUN_SUBDIR\CI-$COMMITHASH" if ($null -eq $env:BUILD_NUMBER) {
$env:TEMP="$env:TESTRUN_DRIVE`:\$env:TESTRUN_SUBDIR\CI-$COMMITHASH"
} else {
# individual temporary location per CI build that better matches the BUILD
_URL
$env:TEMP="$env:TESTRUN_DRIVE`:\$env:TESTRUN_SUBDIR\$env:BRANCH_NAME\$env:
BUILD_NUMBER"
}
$env:LOCALAPPDATA="$env:TEMP\localappdata" $env:LOCALAPPDATA="$env:TEMP\localappdata"
$errorActionPreference='Stop' $errorActionPreference='Stop'
New-Item -ItemType Directory "$env:TEMP" -ErrorAction SilentlyContinue | Out -Null New-Item -ItemType Directory "$env:TEMP" -ErrorAction SilentlyContinue | Out -Null
New-Item -ItemType Directory "$env:TEMP\userprofile" -ErrorAction SilentlyCo ntinue | Out-Null New-Item -ItemType Directory "$env:TEMP\userprofile" -ErrorAction SilentlyCo ntinue | Out-Null
New-Item -ItemType Directory "$env:TEMP\localappdata" -ErrorAction SilentlyC ontinue | Out-Null New-Item -ItemType Directory "$env:TEMP\localappdata" -ErrorAction SilentlyC ontinue | Out-Null
New-Item -ItemType Directory "$env:TEMP\binary" -ErrorAction SilentlyContinu e | Out-Null New-Item -ItemType Directory "$env:TEMP\binary" -ErrorAction SilentlyContinu e | Out-Null
New-Item -ItemType Directory "$env:TEMP\installer" -ErrorAction SilentlyCont inue | Out-Null New-Item -ItemType Directory "$env:TEMP\installer" -ErrorAction SilentlyCont inue | Out-Null
if ($null -eq $env:SKIP_COPY_GO) { if ($null -eq $env:SKIP_COPY_GO) {
# Wipe the previous version of GO - we're going to get it out of the ima ge # Wipe the previous version of GO - we're going to get it out of the ima ge
if (Test-Path "$env:TEMP\go") { Remove-Item "$env:TEMP\go" -Recurse -For ce -ErrorAction SilentlyContinue | Out-Null } if (Test-Path "$env:TEMP\go") { Remove-Item "$env:TEMP\go" -Recurse -For ce -ErrorAction SilentlyContinue | Out-Null }
skipping to change at line 572 skipping to change at line 605
Write-Host -ForegroundColor Green "INFO: Running the daemon under test i n debug mode" Write-Host -ForegroundColor Green "INFO: Running the daemon under test i n debug mode"
$dutArgs += "-D" $dutArgs += "-D"
} }
# Arguments: Are we starting the daemon under test with Hyper-V containers a s the default isolation? # Arguments: Are we starting the daemon under test with Hyper-V containers a s the default isolation?
if (-not ("$env:DOCKER_DUT_HYPERV" -eq "")) { if (-not ("$env:DOCKER_DUT_HYPERV" -eq "")) {
Write-Host -ForegroundColor Green "INFO: Running the daemon under test w ith Hyper-V containers as the default" Write-Host -ForegroundColor Green "INFO: Running the daemon under test w ith Hyper-V containers as the default"
$dutArgs += "--exec-opt isolation=hyperv" $dutArgs += "--exec-opt isolation=hyperv"
} }
# Arguments: Allow setting optional storage-driver options
# example usage: DOCKER_STORAGE_OPTS="lcow.globalmode=false,lcow.kernel=kern
el.efi"
if (-not ("$env:DOCKER_STORAGE_OPTS" -eq "")) {
Write-Host -ForegroundColor Green "INFO: Running the daemon under test w
ith storage-driver options ${env:DOCKER_STORAGE_OPTS}"
$env:DOCKER_STORAGE_OPTS.Split(",") | ForEach {
$dutArgs += "--storage-opt $_"
}
}
# Start the daemon under test, ensuring everything is redirected to folders under $TEMP. # Start the daemon under test, ensuring everything is redirected to folders under $TEMP.
# Important - we launch the -$COMMITHASH version so that we can kill it with out # Important - we launch the -$COMMITHASH version so that we can kill it with out
# killing the control daemon. # killing the control daemon.
Write-Host -ForegroundColor Green "INFO: Starting a daemon under test..." Write-Host -ForegroundColor Green "INFO: Starting a daemon under test..."
Write-Host -ForegroundColor Green "INFO: Args: $dutArgs" Write-Host -ForegroundColor Green "INFO: Args: $dutArgs"
New-Item -ItemType Directory $env:TEMP\daemon -ErrorAction SilentlyContinue | Out-Null New-Item -ItemType Directory $env:TEMP\daemon -ErrorAction SilentlyContinue | Out-Null
# In LCOW mode, for now we need to set an environment variable before starti ng the daemon under test # In LCOW mode, for now we need to set an environment variable before starti ng the daemon under test
if (($null -ne $env:LCOW_MODE) -or ($null -ne $env:LCOW_BASIC_MODE)) { if (($null -ne $env:LCOW_MODE) -or ($null -ne $env:LCOW_BASIC_MODE)) {
$env:LCOW_SUPPORTED=1 $env:LCOW_SUPPORTED=1
skipping to change at line 599 skipping to change at line 641
Write-Host -ForegroundColor Green "INFO: Process started successfully." Write-Host -ForegroundColor Green "INFO: Process started successfully."
$daemonStarted=1 $daemonStarted=1
# In LCOW mode, turn off that variable # In LCOW mode, turn off that variable
if (($null -ne $env:LCOW_MODE) -or ($null -ne $env:LCOW_BASIC_MODE)) { if (($null -ne $env:LCOW_MODE) -or ($null -ne $env:LCOW_BASIC_MODE)) {
$env:LCOW_SUPPORTED="" $env:LCOW_SUPPORTED=""
} }
# Start tailing the daemon under test if the command is installed # Start tailing the daemon under test if the command is installed
if ($null -ne (Get-Command "tail" -ErrorAction SilentlyContinue)) { if ($null -ne (Get-Command "tail" -ErrorAction SilentlyContinue)) {
$tail = start-process "tail" -ArgumentList "-f $env:TEMP\dut.out" -Error Write-Host -ForegroundColor green "INFO: Start tailing logs of the daemo
Action SilentlyContinue n under tests"
$tail = Start-Process "tail" -ArgumentList "-f $env:TEMP\dut.out" -PassT
hru -ErrorAction SilentlyContinue
} }
# Verify we can get the daemon under test to respond # Verify we can get the daemon under test to respond
$tries=20 $tries=20
Write-Host -ForegroundColor Green "INFO: Waiting for the daemon under test t o start..." Write-Host -ForegroundColor Green "INFO: Waiting for the daemon under test t o start..."
while ($true) { while ($true) {
$ErrorActionPreference = "SilentlyContinue" $ErrorActionPreference = "SilentlyContinue"
& "$env:TEMP\binary\docker-$COMMITHASH" "-H=$($DASHH_CUT)" version 2>&1 | Out-Null & "$env:TEMP\binary\docker-$COMMITHASH" "-H=$($DASHH_CUT)" version 2>&1 | Out-Null
$ErrorActionPreference = "Stop" $ErrorActionPreference = "Stop"
if ($LastExitCode -eq 0) { if ($LastExitCode -eq 0) {
skipping to change at line 663 skipping to change at line 706
Write-Host Write-Host
# Don't need Windows images when in LCOW mode. # Don't need Windows images when in LCOW mode.
if (($null -eq $env:LCOW_MODE) -and ($null -eq $env:LCOW_BASIC_MODE)) { if (($null -eq $env:LCOW_MODE) -and ($null -eq $env:LCOW_BASIC_MODE)) {
# Default to windowsservercore for the base image used for the tests. Th e "docker" image # Default to windowsservercore for the base image used for the tests. Th e "docker" image
# and the control daemon use microsoft/windowsservercore regardless. Thi s is *JUST* for the tests. # and the control daemon use microsoft/windowsservercore regardless. Thi s is *JUST* for the tests.
if ($null -eq $env:WINDOWS_BASE_IMAGE) { if ($null -eq $env:WINDOWS_BASE_IMAGE) {
$env:WINDOWS_BASE_IMAGE="microsoft/windowsservercore" $env:WINDOWS_BASE_IMAGE="microsoft/windowsservercore"
} }
if ($null -eq $env:WINDOWS_BASE_IMAGE_TAG) {
$env:WINDOWS_BASE_IMAGE_TAG="latest"
}
# Lowercase and make sure it has a microsoft/ prefix # Lowercase and make sure it has a microsoft/ prefix
$env:WINDOWS_BASE_IMAGE = $env:WINDOWS_BASE_IMAGE.ToLower() $env:WINDOWS_BASE_IMAGE = $env:WINDOWS_BASE_IMAGE.ToLower()
if ($($env:WINDOWS_BASE_IMAGE -Split "/")[0] -ne "microsoft") { if (! $($env:WINDOWS_BASE_IMAGE -Split "/")[0] -match "microsoft") {
Throw "ERROR: WINDOWS_BASE_IMAGE should start microsoft/" Throw "ERROR: WINDOWS_BASE_IMAGE should start microsoft/ or mcr.micr
osoft.com/"
} }
Write-Host -ForegroundColor Green "INFO: Base image for tests is $env:WI NDOWS_BASE_IMAGE" Write-Host -ForegroundColor Green "INFO: Base image for tests is $env:WI NDOWS_BASE_IMAGE"
$ErrorActionPreference = "SilentlyContinue" $ErrorActionPreference = "SilentlyContinue"
if ($((& "$env:TEMP\binary\docker-$COMMITHASH" "-H=$($DASHH_CUT)" images --format "{{.Repository}}:{{.Tag}}" | Select-String $($env:WINDOWS_BASE_IMAGE+" :latest") | Measure-Object -Line).Lines) -eq 0) { if ($((& "$env:TEMP\binary\docker-$COMMITHASH" "-H=$($DASHH_CUT)" images --format "{{.Repository}}:{{.Tag}}" | Select-String "$($env:WINDOWS_BASE_IMAGE) :$env:WINDOWS_BASE_IMAGE_TAG" | Measure-Object -Line).Lines) -eq 0) {
# Try the internal azure CI image version or Microsoft internal corp net where the base image is already pre-prepared on the disk, # Try the internal azure CI image version or Microsoft internal corp net where the base image is already pre-prepared on the disk,
# either through Invoke-DockerCI or, in the case of Azure CI servers , baked into the VHD at the same location. # either through Invoke-DockerCI or, in the case of Azure CI servers , baked into the VHD at the same location.
if (Test-Path $("c:\baseimages\"+$($env:WINDOWS_BASE_IMAGE -Split "/ ")[1]+".tar")) { if (Test-Path $("c:\baseimages\"+$($env:WINDOWS_BASE_IMAGE -Split "/ ")[1]+".tar")) {
Write-Host -ForegroundColor Green "INFO: Loading"$($env:WINDOWS _BASE_IMAGE -Split "/")[1]".tar from disk into the daemon under test. This may t ake some time..." Write-Host -ForegroundColor Green "INFO: Loading"$($env:WINDOWS _BASE_IMAGE -Split "/")[1]".tar from disk into the daemon under test. This may t ake some time..."
$ErrorActionPreference = "SilentlyContinue" $ErrorActionPreference = "SilentlyContinue"
& "$env:TEMP\binary\docker-$COMMITHASH" "-H=$($DASHH_CUT)" load -i $("$readBaseFrom`:\baseimages\"+$($env:WINDOWS_BASE_IMAGE -Split "/")[1]+".ta r") & "$env:TEMP\binary\docker-$COMMITHASH" "-H=$($DASHH_CUT)" load -i $("$readBaseFrom`:\baseimages\"+$($env:WINDOWS_BASE_IMAGE -Split "/")[1]+".ta r")
$ErrorActionPreference = "Stop" $ErrorActionPreference = "Stop"
if (-not $LastExitCode -eq 0) { if (-not $LastExitCode -eq 0) {
Throw $("ERROR: Failed to load $readBaseFrom`:\baseimages\"+ $($env:WINDOWS_BASE_IMAGE -Split "/")[1]+".tar into daemon under test") Throw $("ERROR: Failed to load $readBaseFrom`:\baseimages\"+ $($env:WINDOWS_BASE_IMAGE -Split "/")[1]+".tar into daemon under test")
} }
Write-Host -ForegroundColor Green "INFO: docker load of"$($env:W INDOWS_BASE_IMAGE -Split "/")[1]" into daemon under test completed successfully" Write-Host -ForegroundColor Green "INFO: docker load of"$($env:W INDOWS_BASE_IMAGE -Split "/")[1]" into daemon under test completed successfully"
} else { } else {
# We need to docker pull it instead. It will come in directly as # We need to docker pull it instead. It will come in directly as
microsoft/imagename:latest microsoft/imagename:tagname
Write-Host -ForegroundColor Green $("INFO: Pulling "+$env:WINDOW Write-Host -ForegroundColor Green $("INFO: Pulling "+$env:WINDOW
S_BASE_IMAGE+":latest from docker hub into daemon under test. This may take some S_BASE_IMAGE+":"+$env:WINDOWS_BASE_IMAGE_TAG+" from docker hub into daemon under
time...") test. This may take some time...")
$ErrorActionPreference = "SilentlyContinue" $ErrorActionPreference = "SilentlyContinue"
& "$env:TEMP\binary\docker-$COMMITHASH" "-H=$($DASHH_CUT)" pull $($env:WINDOWS_BASE_IMAGE) & "$env:TEMP\binary\docker-$COMMITHASH" "-H=$($DASHH_CUT)" pull "$($env:WINDOWS_BASE_IMAGE):$env:WINDOWS_BASE_IMAGE_TAG"
$ErrorActionPreference = "Stop" $ErrorActionPreference = "Stop"
if (-not $LastExitCode -eq 0) { if (-not $LastExitCode -eq 0) {
Throw $("ERROR: Failed to docker pull "+$env:WINDOWS_BASE_IM AGE+":latest into daemon under test.") Throw $("ERROR: Failed to docker pull $($env:WINDOWS_BASE_IM AGE):$env:WINDOWS_BASE_IMAGE_TAG into daemon under test.")
} }
Write-Host -ForegroundColor Green $("INFO: docker pull of "+$env Write-Host -ForegroundColor Green $("INFO: docker pull of $($env
:WINDOWS_BASE_IMAGE+":latest into daemon under test completed successfully") :WINDOWS_BASE_IMAGE):$env:WINDOWS_BASE_IMAGE_TAG into daemon under test complete
d successfully")
Write-Host -ForegroundColor Green $("INFO: Tagging $($env:WINDOW
S_BASE_IMAGE):$env:WINDOWS_BASE_IMAGE_TAG as microsoft/$ControlDaemonBaseImage i
n daemon under test")
& "$env:TEMP\binary\docker-$COMMITHASH" "-H=$($DASHH_CUT)" tag "
$($env:WINDOWS_BASE_IMAGE):$env:WINDOWS_BASE_IMAGE_TAG" microsoft/$ControlDaemon
BaseImage
} }
} else { } else {
Write-Host -ForegroundColor Green "INFO: Image"$($env:WINDOWS_BASE_I MAGE+":latest")"is already loaded in the daemon under test" Write-Host -ForegroundColor Green "INFO: Image $($env:WINDOWS_BASE_I MAGE):$env:WINDOWS_BASE_IMAGE_TAG is already loaded in the daemon under test"
} }
# Inspect the pulled or loaded image to get the version directly # Inspect the pulled or loaded image to get the version directly
$ErrorActionPreference = "SilentlyContinue" $ErrorActionPreference = "SilentlyContinue"
$dutimgVersion = $(&"$env:TEMP\binary\docker-$COMMITHASH" "-H=$($DASHH_C UT)" inspect $($env:WINDOWS_BASE_IMAGE) --format "{{.OsVersion}}") $dutimgVersion = $(&"$env:TEMP\binary\docker-$COMMITHASH" "-H=$($DASHH_C UT)" inspect "$($env:WINDOWS_BASE_IMAGE):$env:WINDOWS_BASE_IMAGE_TAG" --format " {{.OsVersion}}")
$ErrorActionPreference = "Stop" $ErrorActionPreference = "Stop"
Write-Host -ForegroundColor Green $("INFO: Version of "+$env:WINDOWS_BAS E_IMAGE+":latest is '"+$dutimgVersion+"'") Write-Host -ForegroundColor Green $("INFO: Version of $($env:WINDOWS_BAS E_IMAGE):$env:WINDOWS_BASE_IMAGE_TAG is '"+$dutimgVersion+"'")
} }
# Run the validation tests unless SKIP_VALIDATION_TESTS is defined. # Run the validation tests unless SKIP_VALIDATION_TESTS is defined.
if ($null -eq $env:SKIP_VALIDATION_TESTS) { if ($null -eq $env:SKIP_VALIDATION_TESTS) {
Write-Host -ForegroundColor Cyan "INFO: Running validation tests at $(Ge t-Date)..." Write-Host -ForegroundColor Cyan "INFO: Running validation tests at $(Ge t-Date)..."
$ErrorActionPreference = "SilentlyContinue" $ErrorActionPreference = "SilentlyContinue"
$Duration=$(Measure-Command { hack\make.ps1 -DCO -GoFormat -PkgImports | Out-Host }) $Duration=$(Measure-Command { hack\make.ps1 -DCO -GoFormat -PkgImports | Out-Host })
$ErrorActionPreference = "Stop" $ErrorActionPreference = "Stop"
if (-not($LastExitCode -eq 0)) { if (-not($LastExitCode -eq 0)) {
Throw "ERROR: Validation tests failed" Throw "ERROR: Validation tests failed"
skipping to change at line 751 skipping to change at line 799
$ErrorActionPreference = "SilentlyContinue" $ErrorActionPreference = "SilentlyContinue"
# Build it regardless while switching between nanoserver and windows servercore # Build it regardless while switching between nanoserver and windows servercore
#$bbCount = $(& "$env:TEMP\binary\docker-$COMMITHASH" "-H=$($DASHH_C UT)" images | Select-String "busybox" | Measure-Object -line).Lines #$bbCount = $(& "$env:TEMP\binary\docker-$COMMITHASH" "-H=$($DASHH_C UT)" images | Select-String "busybox" | Measure-Object -line).Lines
#$ErrorActionPreference = "Stop" #$ErrorActionPreference = "Stop"
#if (-not($LastExitCode -eq 0)) { #if (-not($LastExitCode -eq 0)) {
# Throw "ERROR: Could not determine if busybox image is present" # Throw "ERROR: Could not determine if busybox image is present"
#} #}
#if ($bbCount -eq 0) { #if ($bbCount -eq 0) {
Write-Host -ForegroundColor Green "INFO: Building busybox" Write-Host -ForegroundColor Green "INFO: Building busybox"
$ErrorActionPreference = "SilentlyContinue" $ErrorActionPreference = "SilentlyContinue"
$(& "$env:TEMP\binary\docker-$COMMITHASH" "-H=$($DASHH_CUT)" bui
# This is a temporary hack for nanoserver ld -t busybox https://raw.githubusercontent.com/jhowardmsft/busybox/v1.1/Dockerf
if ($env:WINDOWS_BASE_IMAGE -ne "microsoft/windowsservercore") { ile | Out-Host)
Write-Host -ForegroundColor Red "HACK HACK HACK - Building 6
4-bit nanoserver busybox image"
$(& "$env:TEMP\binary\docker-$COMMITHASH" "-H=$($DASHH_CUT)"
build -t busybox https://raw.githubusercontent.com/jhowardmsft/busybox64/v1.1/D
ockerfile | Out-Host)
} else {
$(& "$env:TEMP\binary\docker-$COMMITHASH" "-H=$($DASHH_CUT)"
build -t busybox https://raw.githubusercontent.com/jhowardmsft/busybox/v1.1/Doc
kerfile | Out-Host)
}
$ErrorActionPreference = "Stop" $ErrorActionPreference = "Stop"
if (-not($LastExitCode -eq 0)) { if (-not($LastExitCode -eq 0)) {
Throw "ERROR: Failed to build busybox image" Throw "ERROR: Failed to build busybox image"
} }
#} #}
Write-Host -ForegroundColor Green "INFO: Docker images of the daemon under test" Write-Host -ForegroundColor Green "INFO: Docker images of the daemon under test"
Write-Host Write-Host
$ErrorActionPreference = "SilentlyContinue" $ErrorActionPreference = "SilentlyContinue"
& "$env:TEMP\binary\docker-$COMMITHASH" "-H=$($DASHH_CUT)" images & "$env:TEMP\binary\docker-$COMMITHASH" "-H=$($DASHH_CUT)" images
skipping to change at line 788 skipping to change at line 829
if (($null -eq $env:LCOW_MODE) -and ($null -eq $env:LCOW_BASIC_MODE)) { if (($null -eq $env:LCOW_MODE) -and ($null -eq $env:LCOW_BASIC_MODE)) {
if ($null -eq $env:SKIP_INTEGRATION_TESTS) { if ($null -eq $env:SKIP_INTEGRATION_TESTS) {
Write-Host -ForegroundColor Cyan "INFO: Running integration tests at $(Get-Date)..." Write-Host -ForegroundColor Cyan "INFO: Running integration tests at $(Get-Date)..."
$ErrorActionPreference = "SilentlyContinue" $ErrorActionPreference = "SilentlyContinue"
# Location of the daemon under test. # Location of the daemon under test.
$env:OrigDOCKER_HOST="$env:DOCKER_HOST" $env:OrigDOCKER_HOST="$env:DOCKER_HOST"
#https://blogs.technet.microsoft.com/heyscriptingguy/2011/09/20/solv e-problems-with-external-command-lines-in-powershell/ is useful to see tokenisin g #https://blogs.technet.microsoft.com/heyscriptingguy/2011/09/20/solv e-problems-with-external-command-lines-in-powershell/ is useful to see tokenisin g
$c = "go test " $c = "go test "
$c += "`"-check.v`" " $c += "`"-test.v`" "
if ($null -ne $env:INTEGRATION_TEST_NAME) { # Makes is quicker for d ebugging to be able to run only a subset of the integration tests if ($null -ne $env:INTEGRATION_TEST_NAME) { # Makes is quicker for d ebugging to be able to run only a subset of the integration tests
$c += "`"-check.f`" " $c += "`"-test.run`" "
$c += "`"$env:INTEGRATION_TEST_NAME`" " $c += "`"$env:INTEGRATION_TEST_NAME`" "
Write-Host -ForegroundColor Magenta "WARN: Only running integrat ion tests matching $env:INTEGRATION_TEST_NAME" Write-Host -ForegroundColor Magenta "WARN: Only running integrat ion tests matching $env:INTEGRATION_TEST_NAME"
} }
$c += "`"-tags`" " + "`"autogen`" " $c += "`"-tags`" " + "`"autogen`" "
$c += "`"-check.timeout`" " + "`"10m`" "
$c += "`"-test.timeout`" " + "`"200m`" " $c += "`"-test.timeout`" " + "`"200m`" "
if ($null -ne $env:INTEGRATION_IN_CONTAINER) { if ($null -ne $env:INTEGRATION_IN_CONTAINER) {
Write-Host -ForegroundColor Green "INFO: Integration tests being run inside a container" Write-Host -ForegroundColor Green "INFO: Integration tests being run inside a container"
# Note we talk back through the containers gateway address # Note we talk back through the containers gateway address
# And the ridiculous lengths we have to go to get the default ga teway address... (GetNetIPConfiguration doesn't work in nanoserver) # And the ridiculous lengths we have to go to get the default ga teway address... (GetNetIPConfiguration doesn't work in nanoserver)
# I just could not get the escaping to work in a single command, so output $c to a file and run that in the container instead... # I just could not get the escaping to work in a single command, so output $c to a file and run that in the container instead...
# Not the prettiest, but it works. # Not the prettiest, but it works.
$c | Out-File -Force "$env:TEMP\binary\runIntegrationCLI.ps1" $c | Out-File -Force "$env:TEMP\binary\runIntegrationCLI.ps1"
$Duration= $(Measure-Command { & docker run ` $Duration= $(Measure-Command { & docker run `
skipping to change at line 883 skipping to change at line 923
$ErrorActionPreference = "Stop" $ErrorActionPreference = "Stop"
$start=(Get-Date); Invoke-Expression "powershell $env:TEMP\binar y\lcowbasicvalidation.ps1"; $lec=$lastExitCode; $Duration=New-Timespan -Start $s tart -End (Get-Date) $start=(Get-Date); Invoke-Expression "powershell $env:TEMP\binar y\lcowbasicvalidation.ps1"; $lec=$lastExitCode; $Duration=New-Timespan -Start $s tart -End (Get-Date)
$Duration=New-Timespan -Start $start -End (Get-Date) $Duration=New-Timespan -Start $start -End (Get-Date)
Write-Host -ForegroundColor Green "INFO: LCOW tests ended at $( Get-Date). Duration`:$Duration" Write-Host -ForegroundColor Green "INFO: LCOW tests ended at $( Get-Date). Duration`:$Duration"
if ($lec -ne 0) { if ($lec -ne 0) {
Throw "LCOW validation tests failed" Throw "LCOW validation tests failed"
} }
} else { } else {
#https://blogs.technet.microsoft.com/heyscriptingguy/2011/09/20/ solve-problems-with-external-command-lines-in-powershell/ is useful to see token ising #https://blogs.technet.microsoft.com/heyscriptingguy/2011/09/20/ solve-problems-with-external-command-lines-in-powershell/ is useful to see token ising
$c = "go test " $c = "go test "
$c += "`"-check.v`" " $c += "`"-test.v`" "
if ($null -ne $env:INTEGRATION_TEST_NAME) { # Makes is quicker f or debugging to be able to run only a subset of the integration tests if ($null -ne $env:INTEGRATION_TEST_NAME) { # Makes is quicker f or debugging to be able to run only a subset of the integration tests
$c += "`"-check.f`" " $c += "`"-test.run`" "
$c += "`"$env:INTEGRATION_TEST_NAME`" " $c += "`"$env:INTEGRATION_TEST_NAME`" "
Write-Host -ForegroundColor Magenta "WARN: Only running LCOW integration tests matching $env:INTEGRATION_TEST_NAME" Write-Host -ForegroundColor Magenta "WARN: Only running LCOW integration tests matching $env:INTEGRATION_TEST_NAME"
} }
$c += "`"-tags`" " + "`"autogen`" " $c += "`"-tags`" " + "`"autogen`" "
$c += "`"-check.timeout`" " + "`"10m`" "
$c += "`"-test.timeout`" " + "`"200m`" " $c += "`"-test.timeout`" " + "`"200m`" "
Write-Host -ForegroundColor Green "INFO: LCOW Integration tests being run from the host:" Write-Host -ForegroundColor Green "INFO: LCOW Integration tests being run from the host:"
Set-Location "$env:SOURCES_DRIVE`:\$env:SOURCES_SUBDIR\src\githu b.com\docker\docker\integration-cli" Set-Location "$env:SOURCES_DRIVE`:\$env:SOURCES_SUBDIR\src\githu b.com\docker\docker\integration-cli"
Write-Host -ForegroundColor Green "INFO: $c" Write-Host -ForegroundColor Green "INFO: $c"
Write-Host -ForegroundColor Green "INFO: DOCKER_HOST at $DASHH_C UT" Write-Host -ForegroundColor Green "INFO: DOCKER_HOST at $DASHH_C UT"
# Explicit to not use measure-command otherwise don't get output as it goes # Explicit to not use measure-command otherwise don't get output as it goes
$start=(Get-Date); Invoke-Expression $c; $Duration=New-Timespan -Start $start -End (Get-Date) $start=(Get-Date); Invoke-Expression $c; $Duration=New-Timespan -Start $start -End (Get-Date)
} }
skipping to change at line 935 skipping to change at line 974
if (Test-Path "$env:TEMP\docker.pid") { if (Test-Path "$env:TEMP\docker.pid") {
$p=Get-Content "$env:TEMP\docker.pid" -raw $p=Get-Content "$env:TEMP\docker.pid" -raw
if (($null -ne $p) -and ($daemonStarted -eq 1)) { if (($null -ne $p) -and ($daemonStarted -eq 1)) {
Write-Host -ForegroundColor green "INFO: Stopping daemon under test" Write-Host -ForegroundColor green "INFO: Stopping daemon under test"
taskkill -f -t -pid $p taskkill -f -t -pid $p
#sleep 5 #sleep 5
} }
Remove-Item "$env:TEMP\docker.pid" -force -ErrorAction SilentlyContinue Remove-Item "$env:TEMP\docker.pid" -force -ErrorAction SilentlyContinue
} }
# Stop the tail process (if started)
if ($null -ne $tail) {
Write-Host -ForegroundColor green "INFO: Stop tailing logs of the daemon
under tests"
Stop-Process -InputObject $tail -Force
}
Write-Host -ForegroundColor Green "INFO: executeCI.ps1 Completed successfull y at $(Get-Date)." Write-Host -ForegroundColor Green "INFO: executeCI.ps1 Completed successfull y at $(Get-Date)."
} }
Catch [Exception] { Catch [Exception] {
$FinallyColour="Red" $FinallyColour="Red"
Write-Host -ForegroundColor Red ("`r`n`r`nERROR: Failed '$_' at $(Get-Date)" ) Write-Host -ForegroundColor Red ("`r`n`r`nERROR: Failed '$_' at $(Get-Date)" )
Write-Host -ForegroundColor Red ($_.InvocationInfo.PositionMessage) Write-Host -ForegroundColor Red ($_.InvocationInfo.PositionMessage)
Write-Host "`n`n" Write-Host "`n`n"
# Exit to ensure Jenkins captures it. Don't do this in the ISE or interactiv e Powershell - they will catch the Throw onwards. # Exit to ensure Jenkins captures it. Don't do this in the ISE or interactiv e Powershell - they will catch the Throw onwards.
if ( ([bool]([Environment]::GetCommandLineArgs() -Like '*-NonInteractive*')) -and ` if ( ([bool]([Environment]::GetCommandLineArgs() -Like '*-NonInteractive*')) -and `
([bool]([Environment]::GetCommandLineArgs() -NotLike "*Powershell_ISE.e xe*"))) { ([bool]([Environment]::GetCommandLineArgs() -NotLike "*Powershell_ISE.e xe*"))) {
exit 1 exit 1
} }
Throw $_ Throw $_
} }
Finally { Finally {
# Preserve the LastExitCode of the tests
$tmpLastExitCode = $LastExitCode
$ErrorActionPreference="SilentlyContinue" $ErrorActionPreference="SilentlyContinue"
$global:ProgressPreference=$origProgressPreference $global:ProgressPreference=$origProgressPreference
Write-Host -ForegroundColor Green "INFO: Tidying up at end of run" Write-Host -ForegroundColor Green "INFO: Tidying up at end of run"
# Restore the path # Restore the path
if ($null -ne $origPath) { $env:PATH=$origPath } if ($null -ne $origPath) { $env:PATH=$origPath }
# Restore the DOCKER_HOST # Restore the DOCKER_HOST
if ($null -ne $origDOCKER_HOST) { $env:DOCKER_HOST=$origDOCKER_HOST } if ($null -ne $origDOCKER_HOST) { $env:DOCKER_HOST=$origDOCKER_HOST }
skipping to change at line 982 skipping to change at line 1030
# Save the daemon under test log # Save the daemon under test log
if ($daemonStarted -eq 1) { if ($daemonStarted -eq 1) {
Write-Host -ForegroundColor Green "INFO: Saving daemon under test log ($ env:TEMP\dut.out) to $TEMPORIG\CIDUT.out" Write-Host -ForegroundColor Green "INFO: Saving daemon under test log ($ env:TEMP\dut.out) to $TEMPORIG\CIDUT.out"
Copy-Item "$env:TEMP\dut.out" "$TEMPORIG\CIDUT.out" -Force -ErrorAction SilentlyContinue Copy-Item "$env:TEMP\dut.out" "$TEMPORIG\CIDUT.out" -Force -ErrorAction SilentlyContinue
Write-Host -ForegroundColor Green "INFO: Saving daemon under test log ($ env:TEMP\dut.err) to $TEMPORIG\CIDUT.err" Write-Host -ForegroundColor Green "INFO: Saving daemon under test log ($ env:TEMP\dut.err) to $TEMPORIG\CIDUT.err"
Copy-Item "$env:TEMP\dut.err" "$TEMPORIG\CIDUT.err" -Force -ErrorAction SilentlyContinue Copy-Item "$env:TEMP\dut.err" "$TEMPORIG\CIDUT.err" -Force -ErrorAction SilentlyContinue
} }
Set-Location "$env:SOURCES_DRIVE\$env:SOURCES_SUBDIR" -ErrorAction SilentlyC ontinue Set-Location "$env:SOURCES_DRIVE\$env:SOURCES_SUBDIR" -ErrorAction SilentlyC ontinue
Nuke-Everything Nuke-Everything
# Restore the TEMP path
if ($null -ne $TEMPORIG) { $env:TEMP="$TEMPORIG" }
$Dur=New-TimeSpan -Start $StartTime -End $(Get-Date) $Dur=New-TimeSpan -Start $StartTime -End $(Get-Date)
Write-Host -ForegroundColor $FinallyColour "`nINFO: executeCI.ps1 exiting at $(date). Duration $dur`n" Write-Host -ForegroundColor $FinallyColour "`nINFO: executeCI.ps1 exiting at $(date). Duration $dur`n"
exit $tmpLastExitCode
} }
 End of changes. 36 change blocks. 
57 lines changed or deleted 132 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)