Skip to content

Commit

Permalink
Networking stress tests moved out of Hosted pool (dotnet#35011)
Browse files Browse the repository at this point in the history
HttpStress and SslStress tests moved off hosted pool to different queues.

Note: HttpStress runs are failing but it's actual test code or prod code issue which will be investigated. Infrastructure-wise everything looks good now.

Fixes dotnet#34780
  • Loading branch information
alnikola committed Jun 18, 2020
1 parent 0de5003 commit 3ace198
Show file tree
Hide file tree
Showing 13 changed files with 315 additions and 51 deletions.
1 change: 1 addition & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@
**/*.obj
**/*.pch
**/*.pdb
!**/_.pdb
**/*.pgc
**/*.pgd
**/*.rsp
Expand Down
54 changes: 25 additions & 29 deletions eng/docker/build-docker-sdk.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -14,46 +14,42 @@ $ErrorActionPreference = "Stop"

$REPO_ROOT_DIR=$(git -C "$PSScriptRoot" rev-parse --show-toplevel)

$dockerFilePrefix="$PSScriptRoot/libraries-sdk"

if ($privateAspNetCore)
{
$dockerFilePrefix="$PSScriptRoot/libraries-sdk-aspnetcore"
}

if ($buildWindowsContainers)
{
# Due to size concerns, we don't currently do docker builds on windows.
# Build on the host machine, then simply copy artifacts to the target docker image.
# This should result in significantly lower build times, for now.
& "$REPO_ROOT_DIR/build.cmd" -ci -subset clr+libs -runtimeconfiguration release -c $configuration

# Dockerize the build artifacts
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
& "$REPO_ROOT_DIR/build.cmd" clr+libs -ci -rc release -c $configuration

if (!$?)
{
docker build --tag $imageName `
--build-arg CONFIGURATION=$configuration `
--build-arg TESTHOST_LOCATION=. `
--file "$PSScriptRoot/libraries-sdk.windows.Dockerfile" `
"$REPO_ROOT_DIR/artifacts/bin/testhost"
exit $LASTEXITCODE
}

$dockerFile="$dockerFilePrefix.windows.Dockerfile"

docker build --tag $imageName `
--build-arg CONFIGURATION=$configuration `
--build-arg TESTHOST_LOCATION=. `
--file $dockerFile `
"$REPO_ROOT_DIR/artifacts/bin/testhost"
}
else
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
{
$dockerFile="$dockerFilePrefix.linux.Dockerfile"

docker build --tag $imageName `
--build-arg CONFIGURATION=$configuration `
--file "$PSScriptRoot/libraries-sdk.linux.Dockerfile" `
--file $dockerFile `
$REPO_ROOT_DIR
}
}

exit $LASTEXITCODE
61 changes: 61 additions & 0 deletions eng/docker/build-docker-sdk.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
#!/usr/bin/env bash
# Builds libraries and produces a dotnet sdk docker image
# that contains the current bits in its shared framework folder.

# Stop script if unbound variable found (use ${var:-} if intentional)
set -u

# Stop script if command returns non-zero exit code.
# Prevents hidden errors caused by missing error code propagation.
set -e

source="${BASH_SOURCE[0]}"

# resolve $source until the file is no longer a symlink
while [[ -h "$source" ]]; do
scriptroot="$( cd -P "$( dirname "$source" )" && pwd )"
source="$(readlink "$source")"
# if $source was a relative symlink, we need to resolve it relative to the path where the
# symlink file was located
[[ $source != /* ]] && source="$scriptroot/$source"
done
scriptroot="$( cd -P "$( dirname "$source" )" && pwd )"

imagename="dotnet-sdk-libs-current"
configuration="Release"
privateaspnetcore=0

while [[ $# > 0 ]]; do
opt="$(echo "${1/#--/-}" | awk '{print tolower($0)}')"
case "$opt" in
-imagename|-t)
imagename=$2
shift 2
;;
-configuration|-c)
configuration=$2
shift 2
;;
-privateaspnetcore|-pa)
privateaspnetcore=1
shift 1
;;
*)
shift 1
;;
esac
done

repo_root=$(git rev-parse --show-toplevel)
docker_file="$scriptroot/libraries-sdk.linux.Dockerfile"

if [[ $privateaspnetcore -eq 1 ]]; then
docker_file="$scriptroot/libraries-sdk-aspnetcore.linux.Dockerfile"
fi

docker build --tag $imagename \
--build-arg CONFIGURATION=$configuration \
--file $docker_file \
$repo_root

exit $?
2 changes: 1 addition & 1 deletion eng/docker/libraries-sdk-aspnetcore.linux.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# 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
ARG SDK_BASE_IMAGE=mcr.microsoft.com/dotnet/nightly/sdk:5.0-buster-slim

FROM $BUILD_BASE_IMAGE as corefxbuild

Expand Down
2 changes: 1 addition & 1 deletion eng/docker/libraries-sdk-aspnetcore.windows.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# 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
ARG SDK_BASE_IMAGE=mcr.microsoft.com/dotnet/nightly/sdk:5.0-nanoserver-1809
FROM $SDK_BASE_IMAGE as target

ARG TESTHOST_LOCATION=".\\artifacts\\bin\\testhost"
Expand Down
4 changes: 2 additions & 2 deletions eng/docker/libraries-sdk.linux.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# 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
ARG SDK_BASE_IMAGE=mcr.microsoft.com/dotnet/nightly/sdk:5.0-buster-slim

FROM $BUILD_BASE_IMAGE as corefxbuild

Expand All @@ -25,4 +25,4 @@ 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/
$TARGET_SHARED_FRAMEWORK/$COREFX_SHARED_FRAMEWORK_NAME/$TARGET_COREFX_VERSION/
4 changes: 2 additions & 2 deletions eng/docker/libraries-sdk.windows.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# 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
# Simple Dockerfile which copies clr and library build artifacts into target dotnet sdk image
ARG SDK_BASE_IMAGE=mcr.microsoft.com/dotnet/nightly/sdk:5.0-nanoserver-1809
FROM $SDK_BASE_IMAGE as target

ARG TESTHOST_LOCATION=".\\artifacts\\bin\\testhost"
Expand Down
16 changes: 9 additions & 7 deletions eng/pipelines/libraries/stress/http.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,19 +27,20 @@ jobs:
displayName: Docker Linux
timeoutInMinutes: 120
pool:
name: Hosted Ubuntu 1604
name: NetCorePublic-Pool
queue: BuildPool.Ubuntu.1604.Amd64.Open

steps:
- checkout: self
clean: true
fetchDepth: 5

- bash: |
$(dockerfilesFolder)/build-docker-sdk.ps1 -t $(sdkBaseImage) -c $(BUILD_CONFIGURATION)
$(dockerfilesFolder)/build-docker-sdk.sh -t $(sdkBaseImage) -c $(BUILD_CONFIGURATION)
displayName: Build CLR and Libraries
- bash: |
$(httpStressProject)/run-docker-compose.ps1 -o -c $(BUILD_CONFIGURATION) -t $(sdkBaseImage)
$(httpStressProject)/run-docker-compose.sh -o -c $(BUILD_CONFIGURATION) -t $(sdkBaseImage)
displayName: Build HttpStress
- bash: |
Expand All @@ -51,23 +52,24 @@ jobs:
displayName: Docker NanoServer
timeoutInMinutes: 120
pool:
vmImage: 'windows-latest'
name: NetCorePublic-Pool
queue: BuildPool.Server.Amd64.VS2019.Open

steps:
- checkout: self
clean: true
fetchDepth: 5
lfs: false

- pwsh: |
- powershell: |
$(dockerfilesFolder)/build-docker-sdk.ps1 -w -t $(sdkBaseImage) -c $(BUILD_CONFIGURATION)
displayName: Build CLR and Libraries
- pwsh: |
- powershell: |
$(httpStressProject)/run-docker-compose.ps1 -w -o -c $(BUILD_CONFIGURATION) -t $(sdkBaseImage)
displayName: Build HttpStress
- pwsh: |
- powershell: |
cd '$(httpStressProject)'
docker-compose up --abort-on-container-exit --no-color
displayName: Run HttpStress
16 changes: 9 additions & 7 deletions eng/pipelines/libraries/stress/ssl.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,19 +28,20 @@ jobs:
displayName: Docker Linux
timeoutInMinutes: 120
pool:
name: Hosted Ubuntu 1604
name: NetCorePublic-Pool
queue: BuildPool.Ubuntu.1604.Amd64.Open

steps:
- checkout: self
clean: true
fetchDepth: 5

- bash: |
$(dockerfilesFolder)/build-docker-sdk.ps1 -t $(sdkBaseImage) -c $(BUILD_CONFIGURATION)
$(dockerfilesFolder)/build-docker-sdk.sh -t $(sdkBaseImage) -c $(BUILD_CONFIGURATION)
displayName: Build CLR and Libraries
- bash: |
$(sslStressProject)/run-docker-compose.ps1 -o -c $(BUILD_CONFIGURATION) -t $(sdkBaseImage)
$(sslStressProject)/run-docker-compose.sh -o -c $(BUILD_CONFIGURATION) -t $(sdkBaseImage)
displayName: Build SslStress
- bash: |
Expand All @@ -52,23 +53,24 @@ jobs:
displayName: Docker NanoServer
timeoutInMinutes: 120
pool:
vmImage: 'windows-latest'
name: NetCorePublic-Pool
queue: BuildPool.Server.Amd64.VS2019.Open

steps:
- checkout: self
clean: true
fetchDepth: 5
lfs: false

- pwsh: |
- powershell: |
$(dockerfilesFolder)/build-docker-sdk.ps1 -w -t $(sdkBaseImage) -c $(BUILD_CONFIGURATION)
displayName: Build CLR and Libraries
- pwsh: |
- powershell: |
$(sslStressProject)/run-docker-compose.ps1 -w -o -c $(BUILD_CONFIGURATION) -t $(sdkBaseImage)
displayName: Build SslStress
- pwsh: |
- powershell: |
cd '$(sslStressProject)'
docker-compose up --abort-on-container-exit --no-color
displayName: Run SslStress
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp3.0</TargetFramework>
<TargetFramework>net5.0</TargetFramework>
<LangVersion>preview</LangVersion>
<Nullable>enable</Nullable>
</PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
#!/usr/bin/env bash
# Runs the stress test using docker-compose

# Stop script if unbound variable found (use ${var:-} if intentional)
set -u

# Stop script if command returns non-zero exit code.
# Prevents hidden errors caused by missing error code propagation.
set -e

source="${BASH_SOURCE[0]}"

# resolve $source until the file is no longer a symlink
while [[ -h "$source" ]]; do
scriptroot="$( cd -P "$( dirname "$source" )" && pwd )"
source="$(readlink "$source")"
# if $source was a relative symlink, we need to resolve it relative to the path where the
# symlink file was located
[[ $source != /* ]] && source="$scriptroot/$source"
done
scriptroot="$( cd -P "$( dirname "$source" )" && pwd )"

imagename="dotnet-sdk-libs-current"
configuration="Release"
privateaspnetcore=0
buildcurrentlibraries=0
buildonly=0
clientstressargs=""
serverstressargs=""

while [[ $# > 0 ]]; do
opt="$(echo "${1/#--/-}" | awk '{print tolower($0)}')"
case "$opt" in
-sdkimagename|-t)
imagename=$2
shift 2
;;
-configuration|-c)
configuration=$2
shift 2
;;
-privateaspnetcore|-pa)
privateaspnetcore=1
shift 1
;;
-buildcurrentlibraries|-b)
buildcurrentlibraries=1
shift 1
;;
-buildonly|-o)
buildonly=1
shift 1
;;
-clientstressargs)
clientstressargs=$2
shift 2
;;
-serverstressargs)
serverstressargs=$2
shift 2
;;
*)
shift 1
;;
esac
done

repo_root=$(git rev-parse --show-toplevel)

if [[ buildcurrentlibraries -eq 1 ]]; then
libraries_args=" -t $imagename -c $configuration"
if [[ $privateaspnetcore -eq 1 ]]; then
libraries_args="$libraries_args -pa"
fi

if ! $repo_root/eng/docker/build-docker-sdk.sh $libraries_args; then
exit 1
fi

elif [[ $privateaspnetcore -eq 1 ]]; then
echo "Using a private Asp.Net Core package (-pa) requires using privately built libraries. Please, enable it with -b switch."
exit 1
fi

build_args=""
if [[ "$imagename" != "" ]]; then
build_args=" --build-arg SDK_BASE_IMAGE=$imagename"
fi

compose_file="$scriptroot/docker-compose.yml"

if ! docker-compose --file "$compose_file" build $build_args; then
exit $?
fi

if [[ $buildonly -eq 0 ]]; then
export HTTPSTRESS_CLIENT_ARGS=$clientstressargs
export HTTPSTRESS_SERVER_ARGS=$serverstressargs
docker-compose --file "$compose_file" up --abort-on-container-exit
exit $?
fi
Loading

0 comments on commit 3ace198

Please sign in to comment.