diff --git a/docs/instrumentations/dotnet/dotnet.mdx b/docs/instrumentations/dotnet/dotnet.mdx index 334280bc2..3289601ed 100644 --- a/docs/instrumentations/dotnet/dotnet.mdx +++ b/docs/instrumentations/dotnet/dotnet.mdx @@ -56,3 +56,14 @@ The following .NET modules will be auto instrumented by Odigos: | [Kafka](https://www.nuget.org/packages/Confluent.Kafka) | | | | | [NServiceBus](https://docs.particular.net/nservicebus/) | Yes | Yes | | | [MassTransit](https://masstransit-project.com/) | Yes | | | + +## Automatic Testing + +The following scenarios are automatically tested with every release: + +| .NET Version | LibC type | CPU | +|--------------|-----------|-------| +| 6.0 | glibc | amd64 | +| 6.0 | musl | amd64 | +| 8.0 | glibc | amd64 | +| 8.0 | musl | amd64 | \ No newline at end of file diff --git a/odiglet/Dockerfile b/odiglet/Dockerfile index 8470da66d..0c8e8d7ca 100644 --- a/odiglet/Dockerfile +++ b/odiglet/Dockerfile @@ -78,6 +78,13 @@ RUN ARCH_SUFFIX=$(cat /tmp/arch_suffix) && \ unzip opentelemetry-dotnet-instrumentation-linux-musl-${ARCH_SUFFIX}.zip "linux-musl-$ARCH_SUFFIX/*" -d . && \ rm opentelemetry-dotnet-instrumentation-linux-musl-${ARCH_SUFFIX}.zip +# TODO(edenfed): Currently .NET Automatic instrumentation does not work on dotnet 6.0 with glibc, +# This is due to compilation of the .so file on a newer version of glibc than the one used by the dotnet runtime. +# The following override the .so file with our own which is compiled on the same glibc version as the dotnet runtime. +RUN ARCH_SUFFIX=$(cat /tmp/arch_suffix) && \ + wget https://github.com/odigos-io/opentelemetry-dotnet-instrumentation/releases/download/${DOTNET_OTEL_VERSION}/OpenTelemetry.AutoInstrumentation.Native-${ARCH_SUFFIX}.so && \ + mv OpenTelemetry.AutoInstrumentation.Native-${ARCH_SUFFIX}.so linux-glibc-${ARCH_SUFFIX}/OpenTelemetry.AutoInstrumentation.Native.so + FROM --platform=$BUILDPLATFORM keyval/odiglet-base:v1.7 AS builder WORKDIR /go/src/github.com/odigos-io/odigos # Copy local modules required by the build diff --git a/odiglet/debug.Dockerfile b/odiglet/debug.Dockerfile index 369bde3b8..8f5fb6b4b 100644 --- a/odiglet/debug.Dockerfile +++ b/odiglet/debug.Dockerfile @@ -61,7 +61,18 @@ RUN if [ "$TARGETARCH" = "arm64" ]; then \ RUN ARCH_SUFFIX=$(cat /tmp/arch_suffix) && \ wget https://github.com/open-telemetry/opentelemetry-dotnet-instrumentation/releases/download/${DOTNET_OTEL_VERSION}/opentelemetry-dotnet-instrumentation-linux-glibc-${ARCH_SUFFIX}.zip && \ unzip opentelemetry-dotnet-instrumentation-linux-glibc-${ARCH_SUFFIX}.zip && \ - rm opentelemetry-dotnet-instrumentation-linux-glibc-${ARCH_SUFFIX}.zip + rm opentelemetry-dotnet-instrumentation-linux-glibc-${ARCH_SUFFIX}.zip && \ + mv linux-$ARCH_SUFFIX linux-glibc-$ARCH_SUFFIX && \ + wget https://github.com/open-telemetry/opentelemetry-dotnet-instrumentation/releases/download/${DOTNET_OTEL_VERSION}/opentelemetry-dotnet-instrumentation-linux-musl-${ARCH_SUFFIX}.zip && \ + unzip opentelemetry-dotnet-instrumentation-linux-musl-${ARCH_SUFFIX}.zip "linux-musl-$ARCH_SUFFIX/*" -d . && \ + rm opentelemetry-dotnet-instrumentation-linux-musl-${ARCH_SUFFIX}.zip + +# TODO(edenfed): Currently .NET Automatic instrumentation does not work on dotnet 6.0 with glibc, +# This is due to compilation of the .so file on a newer version of glibc than the one used by the dotnet runtime. +# The following override the .so file with our own which is compiled on the same glibc version as the dotnet runtime. +RUN ARCH_SUFFIX=$(cat /tmp/arch_suffix) && \ + wget https://github.com/odigos-io/opentelemetry-dotnet-instrumentation/releases/download/${DOTNET_OTEL_VERSION}/OpenTelemetry.AutoInstrumentation.Native-${ARCH_SUFFIX}.so && \ + mv OpenTelemetry.AutoInstrumentation.Native-${ARCH_SUFFIX}.so linux-glibc-${ARCH_SUFFIX}/OpenTelemetry.AutoInstrumentation.Native.so FROM --platform=$BUILDPLATFORM keyval/odiglet-base:v1.7 AS builder WORKDIR /go/src/github.com/odigos-io/odigos diff --git a/tests/e2e/workload-lifecycle/01-assert-apps-installed.yaml b/tests/e2e/workload-lifecycle/01-assert-apps-installed.yaml index a5cca08bc..8bceaebeb 100644 --- a/tests/e2e/workload-lifecycle/01-assert-apps-installed.yaml +++ b/tests/e2e/workload-lifecycle/01-assert-apps-installed.yaml @@ -277,11 +277,53 @@ apiVersion: v1 kind: Pod metadata: labels: - app: dotnet-musl + app: dotnet8-musl namespace: default status: containerStatuses: - - name: dotnet-musl + - name: dotnet8-musl + ready: true + restartCount: 0 + started: true + phase: Running +--- +apiVersion: v1 +kind: Pod +metadata: + labels: + app: dotnet6-musl + namespace: default +status: + containerStatuses: + - name: dotnet6-musl + ready: true + restartCount: 0 + started: true + phase: Running +--- +apiVersion: v1 +kind: Pod +metadata: + labels: + app: dotnet6-glibc + namespace: default +status: + containerStatuses: + - name: dotnet6-glibc + ready: true + restartCount: 0 + started: true + phase: Running +--- +apiVersion: v1 +kind: Pod +metadata: + labels: + app: dotnet8-glibc + namespace: default +status: + containerStatuses: + - name: dotnet8-glibc ready: true restartCount: 0 started: true diff --git a/tests/e2e/workload-lifecycle/01-assert-runtime-detected.yaml b/tests/e2e/workload-lifecycle/01-assert-runtime-detected.yaml index 4750d0ba3..79a26d088 100644 --- a/tests/e2e/workload-lifecycle/01-assert-runtime-detected.yaml +++ b/tests/e2e/workload-lifecycle/01-assert-runtime-detected.yaml @@ -324,16 +324,67 @@ spec: apiVersion: odigos.io/v1alpha1 kind: InstrumentedApplication metadata: - name: deployment-dotnet-musl + name: deployment-dotnet8-musl namespace: default ownerReferences: - apiVersion: apps/v1 blockOwnerDeletion: true controller: true kind: Deployment - name: dotnet-musl + name: dotnet8-musl spec: runtimeDetails: - - containerName: dotnet-musl + - containerName: dotnet8-musl language: dotnet - libCType: musl \ No newline at end of file + libCType: musl +--- +apiVersion: odigos.io/v1alpha1 +kind: InstrumentedApplication +metadata: + name: deployment-dotnet6-musl + namespace: default + ownerReferences: + - apiVersion: apps/v1 + blockOwnerDeletion: true + controller: true + kind: Deployment + name: dotnet6-musl +spec: + runtimeDetails: + - containerName: dotnet6-musl + language: dotnet + libCType: musl +--- +apiVersion: odigos.io/v1alpha1 +kind: InstrumentedApplication +metadata: + name: deployment-dotnet8-glibc + namespace: default + ownerReferences: + - apiVersion: apps/v1 + blockOwnerDeletion: true + controller: true + kind: Deployment + name: dotnet8-glibc +spec: + runtimeDetails: + - containerName: dotnet8-glibc + language: dotnet + libCType: glibc +--- +apiVersion: odigos.io/v1alpha1 +kind: InstrumentedApplication +metadata: + name: deployment-dotnet6-glibc + namespace: default + ownerReferences: + - apiVersion: apps/v1 + blockOwnerDeletion: true + controller: true + kind: Deployment + name: dotnet6-glibc +spec: + runtimeDetails: + - containerName: dotnet6-glibc + language: dotnet + libCType: glibc \ No newline at end of file diff --git a/tests/e2e/workload-lifecycle/01-assert-workloads.yaml b/tests/e2e/workload-lifecycle/01-assert-workloads.yaml index 47d89aaa9..efbca6ebf 100644 --- a/tests/e2e/workload-lifecycle/01-assert-workloads.yaml +++ b/tests/e2e/workload-lifecycle/01-assert-workloads.yaml @@ -555,21 +555,108 @@ metadata: deployment.kubernetes.io/revision: "2" # the deployment spec changed when odigos resource was added generation: 2 # the deployment spec changed when odigos resource was added labels: - app: dotnet-musl - name: dotnet-musl + app: dotnet8-musl + name: dotnet8-musl namespace: default spec: selector: matchLabels: - app: dotnet-musl + app: dotnet8-musl template: spec: containers: - - image: dotnet-musl:v0.0.1 - name: dotnet-musl + - image: dotnet8-musl:v0.0.1 + name: dotnet8-musl resources: limits: instrumentation.odigos.io/musl-dotnet-native-community: "1" +status: + availableReplicas: 1 + observedGeneration: 2 # the deployment spec changed when odigos resource was added + readyReplicas: 1 + replicas: 1 + updatedReplicas: 1 +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + annotations: + deployment.kubernetes.io/revision: "2" # the deployment spec changed when odigos resource was added + generation: 2 # the deployment spec changed when odigos resource was added + labels: + app: dotnet6-musl + name: dotnet6-musl + namespace: default +spec: + selector: + matchLabels: + app: dotnet6-musl + template: + spec: + containers: + - image: dotnet6-musl:v0.0.1 + name: dotnet6-musl + resources: + limits: + instrumentation.odigos.io/musl-dotnet-native-community: "1" +status: + availableReplicas: 1 + observedGeneration: 2 # the deployment spec changed when odigos resource was added + readyReplicas: 1 + replicas: 1 + updatedReplicas: 1 +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + annotations: + deployment.kubernetes.io/revision: "2" # the deployment spec changed when odigos resource was added + generation: 2 # the deployment spec changed when odigos resource was added + labels: + app: dotnet8-glibc + name: dotnet8-glibc + namespace: default +spec: + selector: + matchLabels: + app: dotnet8-glibc + template: + spec: + containers: + - image: dotnet8-glibc:v0.0.1 + name: dotnet8-glibc + resources: + limits: + instrumentation.odigos.io/dotnet-native-community: "1" +status: + availableReplicas: 1 + observedGeneration: 2 # the deployment spec changed when odigos resource was added + readyReplicas: 1 + replicas: 1 + updatedReplicas: 1 +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + annotations: + deployment.kubernetes.io/revision: "2" # the deployment spec changed when odigos resource was added + generation: 2 # the deployment spec changed when odigos resource was added + labels: + app: dotnet6-glibc + name: dotnet6-glibc + namespace: default +spec: + selector: + matchLabels: + app: dotnet6-glibc + template: + spec: + containers: + - image: dotnet6-glibc:v0.0.1 + name: dotnet6-glibc + resources: + limits: + instrumentation.odigos.io/dotnet-native-community: "1" status: availableReplicas: 1 observedGeneration: 2 # the deployment spec changed when odigos resource was added diff --git a/tests/e2e/workload-lifecycle/01-generate-traffic.yaml b/tests/e2e/workload-lifecycle/01-generate-traffic.yaml index 5b3cf2499..7e1b6e408 100644 --- a/tests/e2e/workload-lifecycle/01-generate-traffic.yaml +++ b/tests/e2e/workload-lifecycle/01-generate-traffic.yaml @@ -46,4 +46,7 @@ spec: curl -s --fail http://python-min-version:3000/insert-random/ curl -s --fail http://python-not-supported:3000/insert-random/ - curl -s --fail http://dotnet-musl:8080 \ No newline at end of file + curl -s --fail http://dotnet8-musl:8080 + curl -s --fail http://dotnet6-musl:8080 + curl -s --fail http://dotnet8-glibc:8080 + curl -s --fail http://dotnet6-glibc:8080 \ No newline at end of file diff --git a/tests/e2e/workload-lifecycle/01-install-test-apps.yaml b/tests/e2e/workload-lifecycle/01-install-test-apps.yaml index 12af6d787..be9dbd894 100644 --- a/tests/e2e/workload-lifecycle/01-install-test-apps.yaml +++ b/tests/e2e/workload-lifecycle/01-install-test-apps.yaml @@ -719,22 +719,22 @@ spec: apiVersion: apps/v1 kind: Deployment metadata: - name: dotnet-musl + name: dotnet8-musl namespace: default labels: - app: dotnet-musl + app: dotnet8-musl spec: selector: matchLabels: - app: dotnet-musl + app: dotnet8-musl template: metadata: labels: - app: dotnet-musl + app: dotnet8-musl spec: containers: - - name: dotnet-musl - image: dotnet-musl:v0.0.1 + - name: dotnet8-musl + image: dotnet8-musl:v0.0.1 imagePullPolicy: IfNotPresent ports: - containerPort: 8080 @@ -745,11 +745,125 @@ spec: kind: Service apiVersion: v1 metadata: - name: dotnet-musl + name: dotnet8-musl namespace: default spec: selector: - app: dotnet-musl + app: dotnet8-musl ports: - protocol: TCP - port: 8080 \ No newline at end of file + port: 8080 +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: dotnet6-musl + namespace: default + labels: + app: dotnet6-musl +spec: + selector: + matchLabels: + app: dotnet6-musl + template: + metadata: + labels: + app: dotnet6-musl + spec: + containers: + - name: dotnet6-musl + image: dotnet6-musl:v0.0.1 + imagePullPolicy: IfNotPresent + ports: + - containerPort: 8080 + readinessProbe: + tcpSocket: + port: 8080 +--- +kind: Service +apiVersion: v1 +metadata: + name: dotnet6-musl + namespace: default +spec: + selector: + app: dotnet6-musl + ports: + - protocol: TCP + port: 8080 +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: dotnet8-glibc + namespace: default + labels: + app: dotnet8-glibc +spec: + selector: + matchLabels: + app: dotnet8-glibc + template: + metadata: + labels: + app: dotnet8-glibc + spec: + containers: + - name: dotnet8-glibc + image: dotnet8-glibc:v0.0.1 + imagePullPolicy: IfNotPresent + ports: + - containerPort: 8080 + readinessProbe: + tcpSocket: + port: 8080 +--- +kind: Service +apiVersion: v1 +metadata: + name: dotnet8-glibc + namespace: default +spec: + selector: + app: dotnet8-glibc + ports: + - protocol: TCP + port: 8080 +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: dotnet6-glibc + namespace: default + labels: + app: dotnet6-glibc +spec: + selector: + matchLabels: + app: dotnet6-glibc + template: + metadata: + labels: + app: dotnet6-glibc + spec: + containers: + - name: dotnet6-glibc + image: dotnet6-glibc:v0.0.1 + imagePullPolicy: IfNotPresent + ports: + - containerPort: 8080 + readinessProbe: + tcpSocket: + port: 8080 +--- +kind: Service +apiVersion: v1 +metadata: + name: dotnet6-glibc + namespace: default +spec: + selector: + app: dotnet6-glibc + ports: + - protocol: TCP + port: 8080 \ No newline at end of file diff --git a/tests/e2e/workload-lifecycle/01-wait-for-trace.yaml b/tests/e2e/workload-lifecycle/01-wait-for-trace.yaml index fedeb6d17..27980046c 100644 --- a/tests/e2e/workload-lifecycle/01-wait-for-trace.yaml +++ b/tests/e2e/workload-lifecycle/01-wait-for-trace.yaml @@ -16,6 +16,10 @@ query: | { resource.service.name = "python-latest-version" && span.http.route = "insert-random/" } || { resource.service.name = "python-alpine" && span.http.route = "insert-random/" } || { resource.service.name = "python-not-supported" && span.http.route = "insert-random/" } || - { resource.service.name = "python-min-version" && span.http.route = "insert-random/" } + { resource.service.name = "python-min-version" && span.http.route = "insert-random/" } || + { resource.service.name = "dotnet8-glibc" } || + { resource.service.name = "dotnet8-musl" } || + { resource.service.name = "dotnet6-glibc" } || + { resource.service.name = "dotnet6-musl" } expected: - count: 14 + count: 18 diff --git a/tests/e2e/workload-lifecycle/02-assert-workload-update.yaml b/tests/e2e/workload-lifecycle/02-assert-workload-update.yaml index 2e6b0fc1d..0c04a78e5 100644 --- a/tests/e2e/workload-lifecycle/02-assert-workload-update.yaml +++ b/tests/e2e/workload-lifecycle/02-assert-workload-update.yaml @@ -487,24 +487,129 @@ apiVersion: apps/v1 kind: Deployment metadata: generation: 4 - name: dotnet-musl + name: dotnet8-musl namespace: default labels: - app: dotnet-musl + app: dotnet8-musl spec: selector: matchLabels: - app: dotnet-musl + app: dotnet8-musl template: metadata: labels: - app: dotnet-musl + app: dotnet8-musl annotations: odigos-test-step: "2" spec: containers: - - name: dotnet-musl - image: dotnet-musl:v0.0.1 + - name: dotnet8-musl + image: dotnet8-musl:v0.0.1 + imagePullPolicy: IfNotPresent + ports: + - containerPort: 8080 + readinessProbe: + tcpSocket: + port: 8080 +status: + availableReplicas: 1 + observedGeneration: 4 + readyReplicas: 1 + replicas: 1 + updatedReplicas: 1 +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + generation: 4 + name: dotnet6-musl + namespace: default + labels: + app: dotnet6-musl +spec: + selector: + matchLabels: + app: dotnet6-musl + template: + metadata: + labels: + app: dotnet6-musl + annotations: + odigos-test-step: "2" + spec: + containers: + - name: dotnet6-musl + image: dotnet6-musl:v0.0.1 + imagePullPolicy: IfNotPresent + ports: + - containerPort: 8080 + readinessProbe: + tcpSocket: + port: 8080 +status: + availableReplicas: 1 + observedGeneration: 4 + readyReplicas: 1 + replicas: 1 + updatedReplicas: 1 +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + generation: 4 + name: dotnet8-glibc + namespace: default + labels: + app: dotnet8-glibc +spec: + selector: + matchLabels: + app: dotnet8-glibc + template: + metadata: + labels: + app: dotnet8-glibc + annotations: + odigos-test-step: "2" + spec: + containers: + - name: dotnet8-glibc + image: dotnet8-glibc:v0.0.1 + imagePullPolicy: IfNotPresent + ports: + - containerPort: 8080 + readinessProbe: + tcpSocket: + port: 8080 +status: + availableReplicas: 1 + observedGeneration: 4 + readyReplicas: 1 + replicas: 1 + updatedReplicas: 1 +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + generation: 4 + name: dotnet6-glibc + namespace: default + labels: + app: dotnet6-glibc +spec: + selector: + matchLabels: + app: dotnet6-glibc + template: + metadata: + labels: + app: dotnet6-glibc + annotations: + odigos-test-step: "2" + spec: + containers: + - name: dotnet6-glibc + image: dotnet6-glibc:v0.0.1 imagePullPolicy: IfNotPresent ports: - containerPort: 8080 diff --git a/tests/e2e/workload-lifecycle/02-update-workload-manifests.yaml b/tests/e2e/workload-lifecycle/02-update-workload-manifests.yaml index f3ea891b5..b2310a1fa 100644 --- a/tests/e2e/workload-lifecycle/02-update-workload-manifests.yaml +++ b/tests/e2e/workload-lifecycle/02-update-workload-manifests.yaml @@ -529,24 +529,108 @@ spec: apiVersion: apps/v1 kind: Deployment metadata: - name: dotnet-musl + name: dotnet8-musl namespace: default labels: - app: dotnet-musl + app: dotnet8-musl spec: selector: matchLabels: - app: dotnet-musl + app: dotnet8-musl template: metadata: labels: - app: dotnet-musl + app: dotnet8-musl annotations: odigos-test-step: "2" spec: containers: - - name: dotnet-musl - image: dotnet-musl:v0.0.1 + - name: dotnet8-musl + image: dotnet8-musl:v0.0.1 + imagePullPolicy: IfNotPresent + ports: + - containerPort: 8080 + readinessProbe: + tcpSocket: + port: 8080 +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: dotnet6-musl + namespace: default + labels: + app: dotnet6-musl +spec: + selector: + matchLabels: + app: dotnet6-musl + template: + metadata: + labels: + app: dotnet6-musl + annotations: + odigos-test-step: "2" + spec: + containers: + - name: dotnet6-musl + image: dotnet6-musl:v0.0.1 + imagePullPolicy: IfNotPresent + ports: + - containerPort: 8080 + readinessProbe: + tcpSocket: + port: 8080 +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: dotnet8-glibc + namespace: default + labels: + app: dotnet8-glibc +spec: + selector: + matchLabels: + app: dotnet8-glibc + template: + metadata: + labels: + app: dotnet8-glibc + annotations: + odigos-test-step: "2" + spec: + containers: + - name: dotnet8-glibc + image: dotnet8-glibc:v0.0.1 + imagePullPolicy: IfNotPresent + ports: + - containerPort: 8080 + readinessProbe: + tcpSocket: + port: 8080 +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: dotnet6-glibc + namespace: default + labels: + app: dotnet6-glibc +spec: + selector: + matchLabels: + app: dotnet6-glibc + template: + metadata: + labels: + app: dotnet6-glibc + annotations: + odigos-test-step: "2" + spec: + containers: + - name: dotnet6-glibc + image: dotnet6-glibc:v0.0.1 imagePullPolicy: IfNotPresent ports: - containerPort: 8080 diff --git a/tests/e2e/workload-lifecycle/03-wait-for-trace.yaml b/tests/e2e/workload-lifecycle/03-wait-for-trace.yaml index d8f63fa1f..eb21a23f4 100644 --- a/tests/e2e/workload-lifecycle/03-wait-for-trace.yaml +++ b/tests/e2e/workload-lifecycle/03-wait-for-trace.yaml @@ -4,4 +4,4 @@ description: This test waits for a trace that is generated from the successful i query: | { resource.k8s.cluster.name = "e2e-test-cluster" } expected: - count: 14 + count: 17 diff --git a/tests/e2e/workload-lifecycle/chainsaw-test.yaml b/tests/e2e/workload-lifecycle/chainsaw-test.yaml index a4d33eacc..1c0360e5d 100644 --- a/tests/e2e/workload-lifecycle/chainsaw-test.yaml +++ b/tests/e2e/workload-lifecycle/chainsaw-test.yaml @@ -49,8 +49,14 @@ spec: docker build -t python-min-version:v0.0.1 -f services/python-http-server/Dockerfile.python-min-version services/python-http-server kind load docker-image python-min-version:v0.0.1 - docker build -t dotnet-musl:v0.0.1 -f services/dotnet-musl-server/Dockerfile services/dotnet-musl-server - kind load docker-image dotnet-musl:v0.0.1 + docker build -t dotnet8-musl:v0.0.1 -f services/dotnet-http-server/net8-musl.Dockerfile services/dotnet-http-server + kind load docker-image dotnet8-musl:v0.0.1 + docker build -t dotnet6-musl:v0.0.1 -f services/dotnet-http-server/net6-musl.Dockerfile services/dotnet-http-server + kind load docker-image dotnet6-musl:v0.0.1 + docker build -t dotnet8-glibc:v0.0.1 -f services/dotnet-http-server/net8-glibc.Dockerfile services/dotnet-http-server + kind load docker-image dotnet8-glibc:v0.0.1 + docker build -t dotnet6-glibc:v0.0.1 -f services/dotnet-http-server/net6-glibc.Dockerfile services/dotnet-http-server + kind load docker-image dotnet6-glibc:v0.0.1 - name: Prepare destination try: - script: diff --git a/tests/e2e/workload-lifecycle/services/dotnet-http-server/Program.cs b/tests/e2e/workload-lifecycle/services/dotnet-http-server/Program.cs new file mode 100644 index 000000000..891f17598 --- /dev/null +++ b/tests/e2e/workload-lifecycle/services/dotnet-http-server/Program.cs @@ -0,0 +1,53 @@ +using Microsoft.AspNetCore.Builder; +using Microsoft.AspNetCore.Hosting; +using Microsoft.AspNetCore.Http; +using Microsoft.Extensions.Logging; +using System; + + +namespace LegacyWebHostTest +{ + public class Program + { + public static void Main(string[] args) + { + var host = new WebHostBuilder() + // Configure Kestrel, etc. + .UseKestrel(options => + { + options.ListenAnyIP(8080); + }) + + // Logging + .ConfigureLogging(logging => + { + logging.ClearProviders(); + logging.AddConsole(); + // Typically with 2.x hosting, AddConsole() + // sets up the console logger, including logger for WebHost + }) + + // Minimal pipeline + .Configure(app => + { + app.Run(async context => + { + var logger = context + .RequestServices + .GetService(typeof(ILogger)) + as ILogger; + + logger?.LogInformation("Handling request on path {path}", context.Request.Path); + + await context.Response.WriteAsync("Hello from a legacy webhost on .NET 6\n"); + }); + }) + + // Build the host + .Build(); + + // Run + host.Run(); + } + } +} diff --git a/tests/e2e/workload-lifecycle/services/dotnet-http-server/dotnet-http-server.csproj b/tests/e2e/workload-lifecycle/services/dotnet-http-server/dotnet-http-server.csproj new file mode 100644 index 000000000..6f064ec1a --- /dev/null +++ b/tests/e2e/workload-lifecycle/services/dotnet-http-server/dotnet-http-server.csproj @@ -0,0 +1,11 @@ + + + + net6.0 + net8.0 + dotnet-http-server + enable + enable + + + diff --git a/tests/e2e/workload-lifecycle/services/dotnet-http-server/net6-glibc.Dockerfile b/tests/e2e/workload-lifecycle/services/dotnet-http-server/net6-glibc.Dockerfile new file mode 100644 index 000000000..0f3594d90 --- /dev/null +++ b/tests/e2e/workload-lifecycle/services/dotnet-http-server/net6-glibc.Dockerfile @@ -0,0 +1,12 @@ +FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build +WORKDIR /src +COPY . . +ENV USE_DOTNET6 true +RUN dotnet restore +RUN dotnet publish -c Release -o /app + +FROM mcr.microsoft.com/dotnet/aspnet:6.0 +WORKDIR /app +COPY --from=build /app . +EXPOSE 8080 +ENTRYPOINT ["dotnet", "dotnet-http-server.dll"] diff --git a/tests/e2e/workload-lifecycle/services/dotnet-http-server/net6-musl.Dockerfile b/tests/e2e/workload-lifecycle/services/dotnet-http-server/net6-musl.Dockerfile new file mode 100644 index 000000000..46c7f32c0 --- /dev/null +++ b/tests/e2e/workload-lifecycle/services/dotnet-http-server/net6-musl.Dockerfile @@ -0,0 +1,12 @@ +FROM mcr.microsoft.com/dotnet/sdk:6.0-alpine AS build +WORKDIR /src +COPY . . +ENV USE_DOTNET6 true +RUN dotnet restore +RUN dotnet publish -c Release -o /app + +FROM mcr.microsoft.com/dotnet/aspnet:6.0-alpine +WORKDIR /app +COPY --from=build /app . +EXPOSE 8080 +ENTRYPOINT ["dotnet", "dotnet-http-server.dll"] diff --git a/tests/e2e/workload-lifecycle/services/dotnet-http-server/net8-glibc.Dockerfile b/tests/e2e/workload-lifecycle/services/dotnet-http-server/net8-glibc.Dockerfile new file mode 100644 index 000000000..36d0da0ae --- /dev/null +++ b/tests/e2e/workload-lifecycle/services/dotnet-http-server/net8-glibc.Dockerfile @@ -0,0 +1,11 @@ +FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build +WORKDIR /src +COPY . . +RUN dotnet restore +RUN dotnet publish -c Release -o /app + +FROM mcr.microsoft.com/dotnet/aspnet:8.0 +WORKDIR /app +COPY --from=build /app . +EXPOSE 8080 +ENTRYPOINT ["dotnet", "dotnet-http-server.dll"] diff --git a/tests/e2e/workload-lifecycle/services/dotnet-musl-server/Dockerfile b/tests/e2e/workload-lifecycle/services/dotnet-http-server/net8-musl.Dockerfile similarity index 82% rename from tests/e2e/workload-lifecycle/services/dotnet-musl-server/Dockerfile rename to tests/e2e/workload-lifecycle/services/dotnet-http-server/net8-musl.Dockerfile index e0186e467..bbaa270ac 100644 --- a/tests/e2e/workload-lifecycle/services/dotnet-musl-server/Dockerfile +++ b/tests/e2e/workload-lifecycle/services/dotnet-http-server/net8-musl.Dockerfile @@ -8,4 +8,4 @@ FROM mcr.microsoft.com/dotnet/aspnet:8.0-alpine WORKDIR /app COPY --from=build /app . EXPOSE 8080 -ENTRYPOINT ["dotnet", "dotnet-musl-server.dll"] +ENTRYPOINT ["dotnet", "dotnet-http-server.dll"] diff --git a/tests/e2e/workload-lifecycle/services/dotnet-musl-server/obj/dotnet-musl-server.csproj.nuget.dgspec.json b/tests/e2e/workload-lifecycle/services/dotnet-http-server/obj/dotnet-http-server.csproj.nuget.dgspec.json similarity index 86% rename from tests/e2e/workload-lifecycle/services/dotnet-musl-server/obj/dotnet-musl-server.csproj.nuget.dgspec.json rename to tests/e2e/workload-lifecycle/services/dotnet-http-server/obj/dotnet-http-server.csproj.nuget.dgspec.json index 75ffb17b5..ff21c1d35 100644 --- a/tests/e2e/workload-lifecycle/services/dotnet-musl-server/obj/dotnet-musl-server.csproj.nuget.dgspec.json +++ b/tests/e2e/workload-lifecycle/services/dotnet-http-server/obj/dotnet-http-server.csproj.nuget.dgspec.json @@ -1,15 +1,15 @@ { "format": 1, "restore": { - "/app/dotnet-musl-server.csproj": {} + "/app/dotnet-http-server.csproj": {} }, "projects": { - "/app/dotnet-musl-server.csproj": { + "/app/dotnet-http-server.csproj": { "version": "1.0.0", "restore": { - "projectUniqueName": "/app/dotnet-musl-server.csproj", - "projectName": "dotnet-musl-server", - "projectPath": "/app/dotnet-musl-server.csproj", + "projectUniqueName": "/app/dotnet-http-server.csproj", + "projectName": "dotnet-http-server", + "projectPath": "/app/dotnet-http-server.csproj", "packagesPath": "/root/.nuget/packages/", "outputPath": "/app/obj/", "projectStyle": "PackageReference", diff --git a/tests/e2e/workload-lifecycle/services/dotnet-musl-server/obj/dotnet-musl-server.csproj.nuget.g.props b/tests/e2e/workload-lifecycle/services/dotnet-http-server/obj/dotnet-http-server.csproj.nuget.g.props similarity index 100% rename from tests/e2e/workload-lifecycle/services/dotnet-musl-server/obj/dotnet-musl-server.csproj.nuget.g.props rename to tests/e2e/workload-lifecycle/services/dotnet-http-server/obj/dotnet-http-server.csproj.nuget.g.props diff --git a/tests/e2e/workload-lifecycle/services/dotnet-musl-server/obj/dotnet-musl-server.csproj.nuget.g.targets b/tests/e2e/workload-lifecycle/services/dotnet-http-server/obj/dotnet-http-server.csproj.nuget.g.targets similarity index 100% rename from tests/e2e/workload-lifecycle/services/dotnet-musl-server/obj/dotnet-musl-server.csproj.nuget.g.targets rename to tests/e2e/workload-lifecycle/services/dotnet-http-server/obj/dotnet-http-server.csproj.nuget.g.targets diff --git a/tests/e2e/workload-lifecycle/services/dotnet-musl-server/obj/project.assets.json b/tests/e2e/workload-lifecycle/services/dotnet-http-server/obj/project.assets.json similarity index 90% rename from tests/e2e/workload-lifecycle/services/dotnet-musl-server/obj/project.assets.json rename to tests/e2e/workload-lifecycle/services/dotnet-http-server/obj/project.assets.json index f72c9a95a..d703acd0c 100644 --- a/tests/e2e/workload-lifecycle/services/dotnet-musl-server/obj/project.assets.json +++ b/tests/e2e/workload-lifecycle/services/dotnet-http-server/obj/project.assets.json @@ -13,9 +13,9 @@ "project": { "version": "1.0.0", "restore": { - "projectUniqueName": "/app/dotnet-musl-server.csproj", - "projectName": "dotnet-musl-server", - "projectPath": "/app/dotnet-musl-server.csproj", + "projectUniqueName": "/app/dotnet-http-server.csproj", + "projectName": "dotnet-http-server", + "projectPath": "/app/dotnet-http-server.csproj", "packagesPath": "/root/.nuget/packages/", "outputPath": "/app/obj/", "projectStyle": "PackageReference", diff --git a/tests/e2e/workload-lifecycle/services/dotnet-musl-server/obj/project.nuget.cache b/tests/e2e/workload-lifecycle/services/dotnet-http-server/obj/project.nuget.cache similarity index 67% rename from tests/e2e/workload-lifecycle/services/dotnet-musl-server/obj/project.nuget.cache rename to tests/e2e/workload-lifecycle/services/dotnet-http-server/obj/project.nuget.cache index 220ca9bf3..68eb3e302 100644 --- a/tests/e2e/workload-lifecycle/services/dotnet-musl-server/obj/project.nuget.cache +++ b/tests/e2e/workload-lifecycle/services/dotnet-http-server/obj/project.nuget.cache @@ -2,7 +2,7 @@ "version": 2, "dgSpecHash": "9NJOUczYkvg=", "success": true, - "projectFilePath": "/app/dotnet-musl-server.csproj", + "projectFilePath": "/app/dotnet-http-server.csproj", "expectedPackageFiles": [], "logs": [] } \ No newline at end of file diff --git a/tests/e2e/workload-lifecycle/services/dotnet-musl-server/Program.cs b/tests/e2e/workload-lifecycle/services/dotnet-musl-server/Program.cs deleted file mode 100644 index c2dc41dbe..000000000 --- a/tests/e2e/workload-lifecycle/services/dotnet-musl-server/Program.cs +++ /dev/null @@ -1,6 +0,0 @@ -var builder = WebApplication.CreateBuilder(args); -var app = builder.Build(); - -app.MapGet("/", () => "Hello World!"); - -app.Run("http://0.0.0.0:8080"); diff --git a/tests/e2e/workload-lifecycle/services/dotnet-musl-server/dotnet-musl-server.csproj b/tests/e2e/workload-lifecycle/services/dotnet-musl-server/dotnet-musl-server.csproj deleted file mode 100644 index 97c4f0efc..000000000 --- a/tests/e2e/workload-lifecycle/services/dotnet-musl-server/dotnet-musl-server.csproj +++ /dev/null @@ -1,10 +0,0 @@ - - - - net8.0 - dotnet-musl-server - enable - enable - - -