This repository has been archived by the owner on Mar 24, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 42
/
RunTests.ps1
73 lines (63 loc) · 2.85 KB
/
RunTests.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
# Script to tests.
# Handle kernel/initrd
# If no buildnumber is supplied then it uses the locally build kernel+initrd
if ( Test-Path "$env:ProgramFiles\Linux Containers") {
Remove-Item "$env:ProgramFiles\Linux Containers" -Force -Recurse
}
if ( $args.Count -eq 1 ) {
$BuildNumber = $args[0]
Write-Output "Downloading artefacts for build $BuildNumber"
Invoke-WebRequest -UseBasicParsing -OutFile release.zip "https://$BuildNumber-111085629-gh.circle-artifacts.com/0/release.zip"
Expand-Archive release.zip -DestinationPath "$Env:ProgramFiles\Linux Containers\."
Remove-Item release.zip
} else {
if ( !(Test-Path ..\lcow-kernel) -and !(Test-Path ..\kernel) ) {
Write-Output "Could not find kernel"
exit 1
}
if ( !(Test-Path ..\lcow-initrd.img) -and !(Test-Path ..\initrd.img) ) {
Write-Output "Could not find initial ram disk image"
exit 1
}
mkdir "$env:ProgramFiles\Linux Containers"
if ( Test-Path ..\lcow-kernel ) {
Copy-Item ..\lcow-kernel "$env:ProgramFiles\Linux Containers\kernel"
} else {
Copy-Item ..\kernel "$env:ProgramFiles\Linux Containers\kernel"
}
if ( Test-Path ..\lcow-initrd.img ) {
Copy-Item ..\lcow-initrd.img "$env:ProgramFiles\Linux Containers\initrd.img"
} else {
Copy-Item ..\initrd.img "$env:ProgramFiles\Linux Containers\initrd.img"
}
}
if ( !(Test-Path .\bin) ) {
New-Item -itemtype directory .\bin
}
if ( !(Test-Path .\bin\dockerd.exe) ) {
Write-Output "Downloading latest docker"
Invoke-WebRequest -UseBasicParsing -OutFile bin\dockerd.exe https://master.dockerproject.org/windows/x86_64/dockerd.exe
Invoke-WebRequest -UseBasicParsing -OutFile bin\docker.exe https://master.dockerproject.org/windows/x86_64/docker.exe
}
$composeRelease = "1.21.0-rc1"
if ( !(Test-Path .\bin\docker-compose.exe) ) {
Write-Output "Downloading latest docker-compose"
# Force to TLS 1.2
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
Invoke-WebRequest -UseBasicParsing -OutFile bin\docker-compose.exe "https://github.com/docker/compose/releases/download/$composeRelease/docker-compose-Windows-x86_64.exe"
}
$rtfBuildNumber = 69
if ( !(Test-Path .\bin\rtf.exe) ) {
Invoke-WebRequest -UseBasicParsing -OutFile bin\rtf.exe "https://$rtfBuildNumber-89472225-gh.circle-artifacts.com/0/rtf-windows-amd64.exe"
}
$p = [string]$pwd.Path
$env:PATH="$env:PATH;$p\bin"
# Start the docker daemon in the background. Use a separate data-root to have a clean slate
if ( Test-Path C:\lcow-test ) {
Remove-Item C:\lcow-test -Force -Recurse
}
Start-Process dockerd.exe -ArgumentList '-D', '--experimental', '--data-root', 'C:\lcow-test' `
-NoNewWindow -RedirectStandardOutput '.\bin\dockerd.out' -RedirectStandardError '.\bin\dockerd.err'
Start-Sleep -Seconds 5
rtf.exe run
Stop-Process -Name dockerd