Currently, it's possible to run stress tests on privately built CoreCLR and libraries by executing load-corefx-testhost.ps1 -b followed by run-docker-compose.ps1 -b. However, it was not possible to run the stress server on a private Asp.Net Core package which is used for private libraries build.
This PR adds a new -pa parameter to run-docker-compose.ps1 which builds a server container with a private Asp.Net Core package version.
Param(
[string][Alias('t')]$imageName = "dotnet-sdk-libs-current",
[string][Alias('c')]$configuration = "Release",
- [switch][Alias('w')]$buildWindowsContainers
+ [switch][Alias('w')]$buildWindowsContainers,
+ [switch][Alias('pa')]$privateAspNetCore
)
$ErrorActionPreference = "Stop"
& "$REPO_ROOT_DIR/libraries.cmd" -ci -c $configuration -runtimeConfiguration release
# Dockerize the build artifacts
- docker build --tag $imageName `
+ if($privateAspNetCore)
+ {
+ docker build --tag $imageName `
+ --build-arg CONFIGURATION=$configuration `
+ --build-arg TESTHOST_LOCATION=. `
+ --file "$PSScriptRoot/libraries-sdk-aspnetcore.windows.Dockerfile" `
+ "$REPO_ROOT_DIR/artifacts/bin/testhost"
+ }
+ else
+ {
+ docker build --tag $imageName `
--build-arg CONFIGURATION=$configuration `
--build-arg TESTHOST_LOCATION=. `
--file "$PSScriptRoot/libraries-sdk.windows.Dockerfile" `
"$REPO_ROOT_DIR/artifacts/bin/testhost"
+ }
}
else
{
# Docker build libraries and copy to dotnet sdk image
+ if($privateAspNetCore)
+ {
+ docker build --tag $imageName `
+ --build-arg CONFIGURATION=$configuration `
+ --file "$PSScriptRoot/libraries-sdk-aspnetcore.linux.Dockerfile" `
+ $REPO_ROOT_DIR
+ }
+ else
+ {
docker build --tag $imageName `
--build-arg CONFIGURATION=$configuration `
--file "$PSScriptRoot/libraries-sdk.linux.Dockerfile" `
$REPO_ROOT_DIR
+ }
}
--- /dev/null
+# Builds and copies library artifacts into target dotnet sdk image
+ARG BUILD_BASE_IMAGE=mcr.microsoft.com/dotnet-buildtools/prereqs:centos-7-f39df28-20191023143754
+ARG SDK_BASE_IMAGE=mcr.microsoft.com/dotnet/core/sdk:3.0.100-buster
+
+FROM $BUILD_BASE_IMAGE as corefxbuild
+
+WORKDIR /repo
+COPY . .
+
+ARG CONFIGURATION=Release
+RUN ./src/coreclr/build.sh -release -skiptests -clang9 && \
+ ./libraries.sh -c $CONFIGURATION -runtimeconfiguration release
+
+FROM $SDK_BASE_IMAGE as target
+
+ARG TESTHOST_LOCATION=/repo/artifacts/bin/testhost
+ARG TFM=netcoreapp5.0
+ARG OS=Linux
+ARG ARCH=x64
+ARG CONFIGURATION=Release
+
+ARG COREFX_SHARED_FRAMEWORK_NAME=Microsoft.NETCore.App
+ARG ASPNETCORE_SHARED_NAME=Microsoft.AspNetCore.App
+ARG SOURCE_COREFX_VERSION=5.0.0
+ARG TARGET_SHARED_FRAMEWORK=/usr/share/dotnet/shared
+ARG TARGET_COREFX_VERSION=3.0.0
+
+COPY --from=corefxbuild \
+ $TESTHOST_LOCATION/$TFM-$OS-$CONFIGURATION-$ARCH/shared/$COREFX_SHARED_FRAMEWORK_NAME/$SOURCE_COREFX_VERSION/* \
+ $TARGET_SHARED_FRAMEWORK/$COREFX_SHARED_FRAMEWORK_NAME/$TARGET_COREFX_VERSION/
+COPY --from=corefxbuild \
+ $TESTHOST_LOCATION/$TFM-$OS-$CONFIGURATION-$ARCH/shared/$COREFX_SHARED_FRAMEWORK_NAME/$SOURCE_COREFX_VERSION/* \
+ $TARGET_SHARED_FRAMEWORK/$COREFX_SHARED_FRAMEWORK_NAME/$SOURCE_COREFX_VERSION/
+COPY --from=corefxbuild \
+ $TESTHOST_LOCATION/$TFM-$OS-$CONFIGURATION-$ARCH/shared/$ASPNETCORE_SHARED_NAME/$SOURCE_COREFX_VERSION/* \
+ $TARGET_SHARED_FRAMEWORK/$ASPNETCORE_SHARED_NAME/$TARGET_COREFX_VERSION/
\ No newline at end of file
--- /dev/null
+# escape=`
+# Simple Dockerfile which copies library build artifacts into target dotnet sdk image
+ARG SDK_BASE_IMAGE=mcr.microsoft.com/dotnet/core/sdk:3.0.100-nanoserver-1809
+FROM $SDK_BASE_IMAGE as target
+
+ARG TESTHOST_LOCATION=".\\artifacts\\bin\\testhost"
+ARG TFM=netcoreapp5.0
+ARG OS=Windows_NT
+ARG ARCH=x64
+ARG CONFIGURATION=Release
+
+ARG COREFX_SHARED_FRAMEWORK_NAME=Microsoft.NETCore.App
+ARG ASPNETCORE_SHARED_NAME=Microsoft.AspNetCore.App
+ARG SOURCE_COREFX_VERSION=5.0.0
+ARG TARGET_SHARED_FRAMEWORK="C:\\Program Files\\dotnet\\shared"
+ARG TARGET_COREFX_VERSION=3.0.0
+
+COPY `
+ $TESTHOST_LOCATION\$TFM-$OS-$CONFIGURATION-$ARCH\shared\$COREFX_SHARED_FRAMEWORK_NAME\$SOURCE_COREFX_VERSION\ `
+ $TARGET_SHARED_FRAMEWORK\$COREFX_SHARED_FRAMEWORK_NAME\$TARGET_COREFX_VERSION\
+COPY `
+ $TESTHOST_LOCATION\$TFM-$OS-$CONFIGURATION-$ARCH\shared\$COREFX_SHARED_FRAMEWORK_NAME\$SOURCE_COREFX_VERSION\ `
+ $TARGET_SHARED_FRAMEWORK\$COREFX_SHARED_FRAMEWORK_NAME\$SOURCE_COREFX_VERSION\
+COPY `
+ $TESTHOST_LOCATION\$TFM-$OS-$CONFIGURATION-$ARCH\shared\$ASPNETCORE_SHARED_NAME\$SOURCE_COREFX_VERSION\ `
+ $TARGET_SHARED_FRAMEWORK\$ASPNETCORE_SHARED_NAME\$TARGET_COREFX_VERSION\
[string][Alias('c')]$configuration = "Release", # Build configuration for libraries and stress suite
[switch][Alias('w')]$useWindowsContainers, # Use windows containers, if available
[switch][Alias('b')]$buildCurrentLibraries, # Drives the stress test using libraries built from current source
+ [switch][Alias('pa')]$privateAspNetCore, # Drive the stress test using a private Asp.Net Core package, requires -b to be set
[switch][Alias('o')]$buildOnly, # Build, but do not run the stress app
[string][Alias('t')]$sdkImageName, # Name of the sdk image name, if built from source.
[string]$clientStressArgs = "",
if ($buildCurrentLibraries)
{
+ if ([string]::IsNullOrEmpty($sdkImageName))
+ {
+ $sdkImageName = "dotnet-sdk-libs-current"
+ }
+
$LIBRARIES_BUILD_ARGS = " -t $sdkImageName -c $configuration"
if($useWindowsContainers)
{
$LIBRARIES_BUILD_ARGS += " -w"
}
+ if($privateAspNetCore)
+ {
+ $LIBRARIES_BUILD_ARGS += " -p"
+ }
Invoke-Expression "& $REPO_ROOT_DIR/eng/docker/build-docker-sdk.ps1 $LIBRARIES_BUILD_ARGS"
if (!$?) { exit 1 }
}
+elseif ($privateAspNetCore) {
+ write-output "Using a private Asp.Net Core package (-pa) requires using privately built libraries. Please, enable it with -b switch."
+ write-output "USAGE: . $($MyInvocation.InvocationName) -b -pa <args>"
+ exit 1
+}
# Dockerize the stress app using docker-compose
[string][Alias('c')]$configuration = "Release", # Build configuration for libraries and stress suite
[switch][Alias('w')]$useWindowsContainers, # Use windows containers, if available
[switch][Alias('b')]$buildCurrentLibraries, # Drives the stress test using libraries built from current source
+ [switch][Alias('pa')]$privateAspNetCore, # Drive the stress test using a private Asp.Net Core package, requires -b to be set
[switch][Alias('o')]$buildOnly, # Build, but do not run the stress app
[string][Alias('t')]$sdkImageName, # Name of the sdk image name, if built from source.
[string]$clientStressArgs = "",
if ($buildCurrentLibraries)
{
+ if ([string]::IsNullOrEmpty($sdkImageName))
+ {
+ $sdkImageName = "dotnet-sdk-libs-current"
+ }
+
$LIBRARIES_BUILD_ARGS = " -t $sdkImageName -c $configuration"
if($useWindowsContainers)
{
$LIBRARIES_BUILD_ARGS += " -w"
}
+ if($privateAspNetCore)
+ {
+ $LIBRARIES_BUILD_ARGS += " -p"
+ }
Invoke-Expression "& $REPO_ROOT_DIR/eng/docker/build-docker-sdk.ps1 $LIBRARIES_BUILD_ARGS"
if (!$?) { exit 1 }
}
+elseif ($privateAspNetCore) {
+ write-output "Using a private Asp.Net Core package (-pa) requires using privately built libraries. Please, enable it with -b switch."
+ write-output "USAGE: . $($MyInvocation.InvocationName) -b -pa <args>"
+ exit 1
+}
# Dockerize the stress app using docker-compose