Skip to content

Commit 1874718

Browse files
authored
Integrate latest eng/common changes (dotnet#176)
1 parent 994fe27 commit 1874718

7 files changed

+52
-19
lines changed

eng/common/Invoke-CleanupDocker.ps1

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,17 @@ docker ps -a -q | ForEach-Object { docker rm -f $_ }
55

66
docker volume prune -f
77

8-
# Windows base images are large, preserve them to avoid the overhead of pulling each time.
9-
docker images |
8+
# Preserve the Windows base images and the common eng infra images (e.g. ImageBuilder)
9+
# to avoid the expense of having to repull continuously.
10+
$engInfraImages = Get-Content ./eng/common/templates/variables/docker-images.yml |
11+
Where-Object { $_.Trim() -notlike 'variables:' } |
12+
ForEach-Object { $_.Split(' ', [System.StringSplitOptions]::RemoveEmptyEntries)[1] }
13+
14+
docker images --format "{{.Repository}}:{{.Tag}} {{.ID}}"|
1015
Where-Object {
11-
-Not ($_.StartsWith("mcr.microsoft.com/windows")`
12-
-Or $_.StartsWith("REPOSITORY ")) } |
13-
ForEach-Object { $_.Split(' ', [System.StringSplitOptions]::RemoveEmptyEntries)[2] } |
16+
$localImage = $_
17+
-Not ($localImage.StartsWith("mcr.microsoft.com/windows")`
18+
-Or ($engInfraImages.Where({ $localImage.StartsWith($_) }, 'First').Count -gt 0)) } |
19+
ForEach-Object { $_.Split(' ', [System.StringSplitOptions]::RemoveEmptyEntries)[1] } |
1420
Select-Object -Unique |
1521
ForEach-Object { docker rmi -f $_ }

eng/common/Invoke-ReadmeGeneration.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ param (
33
[string] $Repo,
44
[string] $ReadmePath,
55
[string] $Manifest,
6-
[string] $Branch,
76
[string] $GitRepo,
7+
[string] $Branch = "master",
88
[switch] $ReuseImageBuilderImage
99
)
1010

eng/common/build-and-test.ps1

Lines changed: 31 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,23 +4,47 @@ param(
44
[string]$VersionFilter = "*",
55
[string]$OSFilter = "*",
66
[string]$ArchitectureFilter = "amd64",
7-
[string]$ImageBuilderCustomArgs,
8-
[switch]$SkipTesting = $false
7+
[string]$OptionalImageBuilderArgs,
8+
[string]$OptionalTestArgs,
9+
[switch]$SkipTesting = $false,
10+
[switch]$ExcludeArchitecture = $false
911
)
1012

1113
Set-StrictMode -Version Latest
1214
$ErrorActionPreference = 'Stop'
1315

16+
function Log {
17+
param ([string] $Message)
18+
19+
Write-Output $Message
20+
}
21+
22+
function Exec {
23+
param ([string] $Cmd)
24+
25+
Log "Executing: '$Cmd'"
26+
Invoke-Expression $Cmd
27+
if ($LASTEXITCODE -ne 0) {
28+
throw "Failed: '$Cmd'"
29+
}
30+
}
31+
1432
pushd $PSScriptRoot/../..
1533
try {
16-
./eng/common/Invoke-ImageBuilder.ps1 "build --path '$VersionFilter/*/$OSFilter/$ArchitectureFilter' $ImageBuilderCustomArgs"
34+
$pathFilter = "$VersionFilter/*/$OSFilter"
35+
if (-not $ExcludeArchitecture) {
36+
$pathFilter += "/$ArchitectureFilter"
37+
}
38+
39+
./eng/common/Invoke-ImageBuilder.ps1 "build --path '$pathFilter' $OptionalImageBuilderArgs"
1740

1841
if (-not $SkipTesting) {
1942
if (Test-Path ./tests/run-tests.ps1) {
20-
./tests/run-tests.ps1 `
21-
-VersionFilter $VersionFilter `
22-
-ArchitectureFilter $ArchitectureFilter `
23-
-OSFilter $OSFilter -IsLocalRun
43+
if (-not $ExcludeArchitecture) {
44+
$OptionalTestArgs += " -ArchitectureFilter $ArchitectureFilter"
45+
}
46+
47+
Exec "./tests/run-tests.ps1 -VersionFilter $VersionFilter -OSFilter $OSFilter $OptionalTestArgs"
2448
} else {
2549
Write-Warning "Test script file './tests/run-tests.ps1' not found."
2650
}

eng/common/readme.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,4 +25,4 @@
2525

2626
!!! Changes made in this directory are subject to being overwritten by automation !!!
2727

28-
The files in this directory are shared by all .NET Docker repos. If you need to make changes to these files, open an issue.
28+
The files in this directory are shared by all .NET Docker repos. If you need to make changes to these files, open an issue or submit a pull request in https://github.com/dotnet/docker-tools.

eng/common/templates/steps/test-images-linux-client.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ steps:
7070
searchFolder: $(Common.TestResultsDirectory)
7171
mergeTestResults: true
7272
publishRunAttachments: true
73-
testRunTitle: Linux $(dotnetVersion) $(osVariant) $(architecture)
73+
testRunTitle: $(dotnetVersion) $(osVariant) $(architecture)
7474
- script: docker rm -f $(testRunner.container)
7575
displayName: Cleanup TestRunner Container
7676
condition: always()

eng/common/templates/steps/test-images-windows-client.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@ steps:
1111
} else {
1212
$optionalTestArgs="-IsLocalRun"
1313
}
14+
if ($env:REPOTESTARGS) {
15+
$optionalTestArgs += " $env:REPOTESTARGS"
16+
}
1417
echo "##vso[task.setvariable variable=optionalTestArgs]$optionalTestArgs"
1518
displayName: Set Test Variables
1619
- powershell: Get-ChildItem -Path tests -r | Where {$_.Extension -match "trx"} | Remove-Item
@@ -39,6 +42,6 @@ steps:
3942
testResultsFiles: 'tests/**/*.trx'
4043
mergeTestResults: true
4144
publishRunAttachments: true
42-
testRunTitle: Windows $(dotnetVersion) $(osVariant) amd64
45+
testRunTitle: $(dotnetVersion) $(osVariant) amd64
4346
- ${{ if eq(variables['System.TeamProject'], 'internal') }}:
4447
- template: cleanup-docker-windows.yml
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
variables:
2-
imageNames.imageBuilder.linux: mcr.microsoft.com/dotnet-buildtools/image-builder:debian-20190807123248
3-
imageNames.imageBuilder.windows: mcr.microsoft.com/dotnet-buildtools/image-builder:nanoserver-20190807123248
2+
imageNames.imageBuilder.linux: mcr.microsoft.com/dotnet-buildtools/image-builder:debian-20190809195217
3+
imageNames.imageBuilder.windows: mcr.microsoft.com/dotnet-buildtools/image-builder:nanoserver-20190809195217
44
imageNames.imageBuilder.withrepo: imagebuilder-withrepo:$(Build.BuildId)-$(System.JobId)
5-
imageNames.testRunner: mcr.microsoft.com/dotnet-buildtools/prereqs:debian-stretch-docker-testrunner-63f2145-20184325094343
5+
imageNames.testRunner: mcr.microsoft.com/dotnet-buildtools/prereqs:debian-stretch-slim-docker-testrunner-d61254f-20190807161111
66
imageNames.testRunner.withrepo: testrunner-withrepo:$(Build.BuildId)-$(System.JobId)

0 commit comments

Comments
 (0)