Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Run stress tests on private Asp.Net Core package #33860

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 24 additions & 2 deletions eng/docker/build-docker-sdk.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
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"
Expand All @@ -22,17 +23,38 @@ if ($buildWindowsContainers)
& "$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
}
}
36 changes: 36 additions & 0 deletions eng/docker/libraries-sdk-aspnetcore.linux.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# 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/
26 changes: 26 additions & 0 deletions eng/docker/libraries-sdk-aspnetcore.windows.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# 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\
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ Param(
[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 = "",
Expand All @@ -19,16 +20,30 @@ $COMPOSE_FILE = "$PSScriptRoot/docker-compose.yml"

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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ Param(
[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 = "",
Expand All @@ -19,16 +20,30 @@ $COMPOSE_FILE = "$PSScriptRoot/docker-compose.yml"

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

Expand Down