diff --git a/build-and-test.ps1 b/build-and-test.ps1 index 5829051..04a98e7 100644 --- a/build-and-test.ps1 +++ b/build-and-test.ps1 @@ -27,7 +27,7 @@ $manifestRepo.Images | $images = $_ $_.Platforms | Where-Object { $_.os -eq "$activeOS" } | - Where-Object { [string]::IsNullOrEmpty($Filter) -or $_.dockerfile -like "$Filter*" } | + Where-Object { [string]::IsNullOrEmpty($Filter) -or $_.dockerfile -like "$Filter" } | Where-Object { ( [string]::IsNullOrEmpty($Architecture) -and -not [bool]($_.PSobject.Properties.name -match "architecture"))` -or ( [bool]($_.PSobject.Properties.name -match "architecture") -and $_.architecture -eq "$Architecture" ) } | ForEach-Object { diff --git a/build-pipeline/dotnet-docker-linux-amd64-images.json b/build-pipeline/dotnet-docker-linux-amd64-images.json index 4c9f146..7168f14 100644 --- a/build-pipeline/dotnet-docker-linux-amd64-images.json +++ b/build-pipeline/dotnet-docker-linux-amd64-images.json @@ -122,7 +122,7 @@ "allowOverride": true }, "image-builder.imageName": { - "value": "microsoft/dotnet-buildtools-prereqs:image-builder-jessie-20170817154316" + "value": "microsoft/dotnet-buildtools-prereqs:image-builder-jessie-20171005132855" }, "image-builder.args": { "value": "build --manifest manifest.json --repo microsoft/dotnet-nightly --path $(PB.image-builder.path) --test-var Filter=$(PB.image-builder.path) --test-var Architecture=amd64 --push --username $(PB.docker.username) --password $(PB.docker.password) $(PB.image-builder.customCommonArgs)", diff --git a/build-pipeline/dotnet-docker-linux-arm32v7-images.json b/build-pipeline/dotnet-docker-linux-arm32v7-images.json index a51f1f5..6311ee4 100644 --- a/build-pipeline/dotnet-docker-linux-arm32v7-images.json +++ b/build-pipeline/dotnet-docker-linux-arm32v7-images.json @@ -84,7 +84,7 @@ "enabled": true, "continueOnError": false, "alwaysRun": false, - "displayName": "Run image-builder", + "displayName": "Build SDK images (needed for testing)", "timeoutInMinutes": 0, "condition": "succeeded()", "task": { @@ -94,7 +94,26 @@ }, "inputs": { "filename": "docker", - "arguments": "run $(docker.commonRunArgs) -v /var/run/docker.sock:/var/run/docker.sock $(image-builder.imageName) $(image-builder.args)", + "arguments": "$(docker.runImageBuilder) $(image-builder.sdkBuildArgs)", + "workingFolder": "", + "failOnStandardError": "false" + } + }, + { + "enabled": true, + "continueOnError": false, + "alwaysRun": false, + "displayName": "Build ARM images", + "timeoutInMinutes": 0, + "condition": "succeeded()", + "task": { + "id": "d9bafed4-0b18-4f58-968d-86655b4d2ce9", + "versionSpec": "1.*", + "definitionType": "task" + }, + "inputs": { + "filename": "docker", + "arguments": "$(docker.runImageBuilder) $(image-builder.armBuildArgs)", "workingFolder": "", "failOnStandardError": "false" } @@ -166,6 +185,9 @@ "docker.commonRunArgs": { "value": "--rm -v $(docker.volumeName):/repo -w /repo --name $(docker.containerName)" }, + "docker.runImageBuilder": { + "value": "run $(docker.commonRunArgs) -v /var/run/docker.sock:/var/run/docker.sock $(image-builder.imageName)" + }, "docker.containerName": { "value": "$(Build.DefinitionName)-$(Build.BuildId)" }, @@ -176,10 +198,18 @@ "value": "$(Build.DefinitionName)-$(Build.BuildId)" }, "image-builder.imageName": { - "value": "microsoft/dotnet-buildtools-prereqs:image-builder-jessie-20170817154316" + "value": "microsoft/dotnet-buildtools-prereqs:image-builder-jessie-20171005132855" }, - "image-builder.args": { - "value": "build --manifest manifest.json --repo microsoft/dotnet-nightly --path $(PB.image-builder.path) --architecture arm --skip-test --test-var Filter=$(PB.image-builder.path) --test-var Architecture=arm --push --username $(PB.docker.username) --password $(PB.docker.password) $(PB.image-builder.customCommonArgs)", + "image-builder.commonArgs": { + "value": "build --manifest manifest.json --repo microsoft/dotnet-nightly $(PB.image-builder.customCommonArgs)", + "allowOverride": true + }, + "image-builder.armBuildArgs": { + "value": "$(image-builder.commonArgs) --path $(PB.image-builder.path) --architecture arm --test-var Filter=$(PB.image-builder.path) --test-var Architecture=arm --push --username $(PB.docker.username) --password $(PB.docker.password)", + "allowOverride": true + }, + "image-builder.sdkBuildArgs": { + "value": "$(image-builder.commonArgs) --path $(PB.image-builder.path)/sdk/stretch/amd64 --architecture amd64 --skip-test", "allowOverride": true }, "PB.docker.password": { diff --git a/build-pipeline/dotnet-docker-post-image-build.json b/build-pipeline/dotnet-docker-post-image-build.json index b4e52eb..4576f5c 100644 --- a/build-pipeline/dotnet-docker-post-image-build.json +++ b/build-pipeline/dotnet-docker-post-image-build.json @@ -141,7 +141,7 @@ "allowOverride": true }, "image-builder.imageName": { - "value": "microsoft/dotnet-buildtools-prereqs:image-builder-jessie-20170817154316" + "value": "microsoft/dotnet-buildtools-prereqs:image-builder-jessie-20171005132855" }, "image-builder.common.args": { "value": "--manifest manifest.json --repo microsoft/dotnet-nightly --username $(PB.docker.username) --password $(PB.docker.password) $(PB.image-builder.customCommonArgs)", diff --git a/build-pipeline/dotnet-docker-windows-amd64-images.json b/build-pipeline/dotnet-docker-windows-amd64-images.json index aa4fcde..4630912 100644 --- a/build-pipeline/dotnet-docker-windows-amd64-images.json +++ b/build-pipeline/dotnet-docker-windows-amd64-images.json @@ -183,7 +183,7 @@ "allowOverride": true }, "image-builder.imageName": { - "value": "microsoft/dotnet-buildtools-prereqs:image-builder-nanoserver-20170818060355" + "value": "microsoft/dotnet-buildtools-prereqs:image-builder-nanoserver-20171005132824" }, "image-builder.args": { "value": "build --manifest manifest.json --repo microsoft/dotnet-nightly --path $(PB.image-builder.path) --test-var Filter=$(PB.image-builder.path) --test-var Architecture=amd64 --push --username $(PB.docker.username) --password $(PB.docker.password) $(PB.image-builder.customCommonArgs)", diff --git a/build-pipeline/pipeline.json b/build-pipeline/pipeline.json index 8555d3d..2b37ff4 100644 --- a/build-pipeline/pipeline.json +++ b/build-pipeline/pipeline.json @@ -16,13 +16,13 @@ { "Name": "dotnet-docker-linux-amd64-images", "Parameters": { - "PB.image-builder.path": "1." + "PB.image-builder.path": "1.*" } }, { "Name": "dotnet-docker-linux-amd64-images", "Parameters": { - "PB.image-builder.path": "2." + "PB.image-builder.path": "2.*" } } ] @@ -36,7 +36,7 @@ { "Name": "dotnet-docker-linux-arm32v7-images", "Parameters": { - "PB.image-builder.path": "2." + "PB.image-builder.path": "2.*" } } ] @@ -50,19 +50,19 @@ { "Name": "dotnet-docker-windows-amd64-images", "Parameters": { - "PB.image-builder.path": "1." + "PB.image-builder.path": "1.*" } }, { "Name": "dotnet-docker-windows-amd64-images", "Parameters": { - "PB.image-builder.path": "2.0" + "PB.image-builder.path": "2.0*" } }, { "Name": "dotnet-docker-windows-amd64-images", "Parameters": { - "PB.image-builder.path": "2.1" + "PB.image-builder.path": "2.1*" } } ] diff --git a/netci.groovy b/netci.groovy index b3cda32..626ec9b 100644 --- a/netci.groovy +++ b/netci.groovy @@ -12,14 +12,15 @@ platformList.each { platform -> versionList.each { version -> def newJobName = Utilities.getFullJobName(project, "${containerOS}_${version}", isPR) + def versionFilter = "${version}*" def newJob = job(newJobName) { steps { if (hostOS == 'Windows_2016') { - batchFile("powershell -NoProfile -Command .\\build-and-test.ps1 -Filter ${version}") + batchFile("powershell -NoProfile -Command .\\build-and-test.ps1 -Filter ${versionFilter}") } else { - shell("docker build --rm -t testrunner -f ./test/Dockerfile.linux.testrunner . && docker run -v /var/run/docker.sock:/var/run/docker.sock testrunner powershell -File build-and-test.ps1 -Filter ${version}") + shell("docker build --rm -t testrunner -f ./test/Dockerfile.linux.testrunner . && docker run -v /var/run/docker.sock:/var/run/docker.sock testrunner powershell -File build-and-test.ps1 -Filter ${versionFilter}") } } } diff --git a/test/Microsoft.DotNet.Docker.Tests/ImageTests.cs b/test/Microsoft.DotNet.Docker.Tests/ImageTests.cs index 3abe553..46a2afa 100644 --- a/test/Microsoft.DotNet.Docker.Tests/ImageTests.cs +++ b/test/Microsoft.DotNet.Docker.Tests/ImageTests.cs @@ -5,6 +5,7 @@ using System; using System.Collections.Generic; using System.Linq; +using System.Text.RegularExpressions; using Xunit; using Xunit.Abstractions; @@ -61,12 +62,18 @@ namespace Microsoft.DotNet.Docker.Tests }); } + string versionFilterPattern = null; + if (VersionFilter != null) + { + versionFilterPattern = "^" + Regex.Escape(VersionFilter).Replace(@"\*", ".*").Replace(@"\?", ".") + "$"; + } + // Filter out test data that does not match the active architecture and version filters. return testData .Where(imageDescriptor => ArchFilter == null || string.Equals(imageDescriptor.Architecture, ArchFilter, StringComparison.OrdinalIgnoreCase)) .Where(imageDescriptor => VersionFilter == null - || imageDescriptor.DotNetCoreVersion.StartsWith(VersionFilter)) + || Regex.IsMatch(imageDescriptor.DotNetCoreVersion, versionFilterPattern, RegexOptions.IgnoreCase)) .Select(imageDescriptor => new object[] { imageDescriptor }); }