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

[.NET] Add onboarding tests for unsupported runtime version #3504

Merged
merged 18 commits into from
Nov 25, 2024
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
3 changes: 3 additions & 0 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,9 @@ onboarding_dotnet:
- ONBOARDING_FILTER_WEBLOG: [test-app-dotnet-multicontainer,test-app-dotnet-multialpine]
SCENARIO: [SIMPLE_INSTALLER_AUTO_INJECTION]
DEFAULT_VMS: ["True", "False"]
- ONBOARDING_FILTER_WEBLOG: [test-app-dotnet-unsupported]
SCENARIO: [INSTALLER_NOT_SUPPORTED_AUTO_INJECTION]
brettlangdon marked this conversation as resolved.
Show resolved Hide resolved
DEFAULT_VMS: ["True", "False"]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
DEFAULT_VMS: ["True", "False"]
DEFAULT_VMS: ["True"]

Since we skip all the systems in the non-default we can probably remove the False here.

However, maybe we want to keep it anyways in case we add support later, or move the tested VM to non-default?

No preference, but the job run with False just does a single skip.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Better to maintain the both cases (true and false)

script:
- ./build.sh -i runner
- timeout 4800s ./run.sh $SCENARIO --vm-weblog ${ONBOARDING_FILTER_WEBLOG} --vm-env ${ONBOARDING_FILTER_ENV} --vm-library ${TEST_LIBRARY} --vm-provider aws --report-run-url ${CI_PIPELINE_URL} --report-environment ${ONBOARDING_FILTER_ENV} --vm-default-vms ${DEFAULT_VMS}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
FROM mcr.microsoft.com/dotnet/aspnet:2.1-stretch-slim AS base
WORKDIR /app

FROM mcr.microsoft.com/dotnet/sdk:7.0.100 AS build
WORKDIR /app
COPY . .
RUN dotnet publish -c Release -o /publish

FROM base AS final
WORKDIR /app
EXPOSE 18080
ENV ASPNETCORE_URLS=http://+:18080
COPY --from=build /publish .

ENTRYPOINT ["dotnet", "MinimalWebApp.dll"]
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFramework>netcoreapp2.1</TargetFramework>
<RootNamespace>MinimalWebApp</RootNamespace>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.App" Version="2.1.30" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
using Microsoft.AspNetCore;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Http;

namespace MinimalWebApp
{
public class Program
{
public static void Main(string[] args)
{
WebHost.CreateDefaultBuilder(args)
.Configure(app =>
{
app.Run(async context => await context.Response.WriteAsync("Hello World!"));
})
.Build()
.Run();
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"Logging": {
"LogLevel": {
"Default": "Debug"
}
},
"AllowedHosts": "*"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/bash

if [ -z "${BUILDX_PLATFORMS}" ] ; then
BUILDX_PLATFORMS="linux/amd64"
fi

docker buildx build --platform ${BUILDX_PLATFORMS} --tag ${LIBRARY_INJECTION_TEST_APP_IMAGE} --push .
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
lang_variant:
name: dotnet
cache: true
version: 3
install:
brettlangdon marked this conversation as resolved.
Show resolved Hide resolved
- os_type: linux
os_distro: deb
os_branch: ubuntu20_amd64
remote-command: |
sudo apt-get update
sudo apt-get install -y wget
wget https://packages.microsoft.com/config/ubuntu/20.04/packages-microsoft-prod.deb -O packages-microsoft-prod.deb
sudo dpkg -i packages-microsoft-prod.deb
rm packages-microsoft-prod.deb
sudo apt-get update;
sudo apt-get install -y apt-transport-https
sudo apt-get update
sudo DEBIAN_FRONTEND=noninteractive apt-get install -y dotnet-sdk-2.1


weblog:
name: test-app-dotnet-unsupported
# Mostly based on the docs on supported OSs from
# https://github.com/dotnet/docs/commit/9693653929db2efbc8f5893c4eee37acf81b5ac6
exact_os_branches: [ubuntu20_amd64]
install:
- os_type: linux
copy_files:
- name: copy-dotnet-app
local_path: lib-injection/build/docker/dotnet/dd-lib-dotnet-init-test-app-unsupported

- name: copy-service
local_path: utils/build/virtual_machine/weblogs/common/test-app.service

- name: copy-service-run-script
local_path: utils/build/virtual_machine/weblogs/common/create_and_run_app_service.sh

- name: copy-run-weblog-script
local_path: utils/build/virtual_machine/weblogs/dotnet/test-app-dotnet-unsupported/test-app-dotnet-unsupported_run.sh

remote-command: sh test-app-dotnet-unsupported_run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#!/bin/bash
set -e

# shellcheck disable=SC2035
sudo chmod -R 755 *

echo "START dotnet APP (debug active)"
#If we are trying to inject the library on the "restore" or "build" command we should show the traces
export DD_APM_INSTRUMENTATION_DEBUG=false
export DOTNET_DbgEnableMiniDump=1
export DOTNET_DbgMiniDumpType=4
export DOTNET_CreateDumpDiagnostics=1
export DOTNET_DbgMiniDumpName=/var/log/datadog/dotnet/coredump.txt
export DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=1

#workaround. Remove the system-tests cloned folder. The sources are copied to current home folder
#if we don't remove it, the dotnet restore will try to restore the system-tests folder
sudo rm -rf system-tests

#Restore, build and publish the app
sudo dotnet publish -c Release -o /home/datadog

#Copy app service and start it
export DD_APM_INSTRUMENTATION_DEBUG=true
sudo chmod 755 create_and_run_app_service.sh
./create_and_run_app_service.sh "dotnet MinimalWebApp.dll" "ASPNETCORE_URLS=http://+:5985 DOTNET_DbgEnableMiniDump=1 DOTNET_DbgMiniDumpType=4"

echo "RUN dotnet DONE"
Loading