Skip to content

Commit

Permalink
[.NET/EC2] Allow testing for different language versions (#348)
Browse files Browse the repository at this point in the history
  • Loading branch information
Jeel-mehta authored Jan 8, 2025
1 parent ce9f67c commit f487867
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 7 deletions.
1 change: 1 addition & 0 deletions .github/workflows/dotnet-ec2-canary.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ jobs:
with:
aws-region: ${{ matrix.aws-region }}
caller-workflow-name: 'appsignals-dotnet-e2e-ec2-canary-test'
dotnet-version: '8.0'

nuget:
strategy:
Expand Down
5 changes: 5 additions & 0 deletions .github/workflows/dotnet-ec2-default-retry.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ on:
caller-workflow-name:
required: true
type: string
dotnet-version:
required: true
type: string

permissions:
id-token: write
Expand All @@ -26,6 +29,7 @@ jobs:
with:
aws-region: ${{ inputs.aws-region }}
caller-workflow-name: ${{ inputs.caller-workflow-name }}
dotnet-version: ${{ inputs.dotnet-version }}

dotnet-ec2-default-attempt-2:
needs: [ dotnet-ec2-default-attempt-1 ]
Expand All @@ -35,6 +39,7 @@ jobs:
with:
aws-region: ${{ inputs.aws-region }}
caller-workflow-name: ${{ inputs.caller-workflow-name }}
dotnet-version: ${{ inputs.dotnet-version }}

publish-metric-attempt-1:
needs: [ dotnet-ec2-default-attempt-1, dotnet-ec2-default-attempt-2 ]
Expand Down
9 changes: 8 additions & 1 deletion .github/workflows/dotnet-ec2-default-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@ on:
caller-workflow-name:
required: true
type: string
dotnet-version:
description: "Currently support version 6.0, 8.0"
required: false
type: string
default: '8.0'
outputs:
job-started:
value: ${{ jobs.dotnet-ec2-default.outputs.job-started }}
Expand All @@ -32,7 +37,8 @@ env:
E2E_TEST_AWS_REGION: ${{ inputs.aws-region }}
E2E_TEST_ACCOUNT_ID: ${{ secrets.APPLICATION_SIGNALS_E2E_TEST_ACCOUNT_ID }}
E2E_TEST_ROLE_NAME: ${{ secrets.APPLICATION_SIGNALS_E2E_TEST_ROLE_NAME }}
SAMPLE_APP_ZIP: s3://aws-appsignals-sample-app-prod-${{ inputs.aws-region }}/dotnet-sample-app.zip
DOTNET_VERSION: ${{ inputs.dotnet-version }}
SAMPLE_APP_ZIP: s3://aws-appsignals-sample-app-prod-${{ inputs.aws-region }}/dotnet-sample-app-${{ inputs.dotnet-version }}.zip
METRIC_NAMESPACE: ApplicationSignals
LOG_GROUP_NAME: /aws/application-signals/data
ADOT_DISTRO_NAME: ${{ inputs.staging_distro_name }}
Expand Down Expand Up @@ -141,6 +147,7 @@ jobs:
-var="sample_app_zip=${{ env.SAMPLE_APP_ZIP }}" \
-var="get_cw_agent_rpm_command=${{ env.GET_CW_AGENT_RPM_COMMAND }}" \
-var="get_adot_distro_command=${{ env.GET_ADOT_DISTRO_COMMAND }}" \
-var="language_version=${{ env.DOTNET_VERSION }}" \
|| deployment_failed=$?
if [ $deployment_failed -eq 1 ]; then
Expand Down
12 changes: 6 additions & 6 deletions terraform/dotnet/ec2/default/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ resource "null_resource" "main_service_setup" {
sudo yum install -y wget
sudo rpm --import https://packages.microsoft.com/keys/microsoft.asc
sudo wget -O /etc/yum.repos.d/microsoft-prod.repo https://packages.microsoft.com/config/fedora/37/prod.repo
sudo dnf install -y dotnet-sdk-8.0
sudo dnf install -y dotnet-sdk-${var.language_version}
sudo yum install unzip -y
# Copy in CW Agent configuration
Expand All @@ -141,6 +141,7 @@ resource "null_resource" "main_service_setup" {
# Export environment variables for instrumentation
cd ./asp_frontend_service
dotnet build
export CORECLR_ENABLE_PROFILING=1
export CORECLR_PROFILER={918728DD-259F-4A6A-AC2B-B85E1B658318}
export CORECLR_PROFILER_PATH=$current_dir/dotnet-distro/linux-x64/OpenTelemetry.AutoInstrumentation.Native.so
Expand All @@ -158,8 +159,7 @@ resource "null_resource" "main_service_setup" {
export OTEL_AWS_APPLICATION_SIGNALS_RUNTIME_ENABLED=false
export OTEL_TRACES_SAMPLER=always_on
export ASPNETCORE_URLS=http://0.0.0.0:8080
dotnet build
nohup dotnet bin/Debug/netcoreapp8.0/asp_frontend_service.dll &
nohup dotnet bin/Debug/netcoreapp${var.language_version}/asp_frontend_service.dll &
# The application needs time to come up and reach a steady state, this should not take longer than 30 seconds
sleep 30
Expand Down Expand Up @@ -224,7 +224,7 @@ resource "null_resource" "remote_service_setup" {
sudo yum install -y wget
sudo rpm --import https://packages.microsoft.com/keys/microsoft.asc
sudo wget -O /etc/yum.repos.d/microsoft-prod.repo https://packages.microsoft.com/config/fedora/37/prod.repo
sudo dnf install -y dotnet-sdk-8.0
sudo dnf install -y dotnet-sdk-${var.language_version}
sudo yum install unzip -y
# Copy in CW Agent configuration
Expand All @@ -249,6 +249,7 @@ resource "null_resource" "remote_service_setup" {
# Export environment variables for instrumentation
cd ./asp_remote_service
dotnet build
export CORECLR_ENABLE_PROFILING=1
export CORECLR_PROFILER={918728DD-259F-4A6A-AC2B-B85E1B658318}
export CORECLR_PROFILER_PATH=$current_dir/dotnet-distro/linux-x64/OpenTelemetry.AutoInstrumentation.Native.so
Expand All @@ -266,8 +267,7 @@ resource "null_resource" "remote_service_setup" {
export OTEL_AWS_APPLICATION_SIGNALS_RUNTIME_ENABLED=false
export OTEL_TRACES_SAMPLER=always_on
export ASPNETCORE_URLS=http://0.0.0.0:8081
dotnet build
nohup dotnet bin/Debug/netcoreapp8.0/asp_remote_service.dll &
nohup dotnet bin/Debug/netcoreapp${var.language_version}/asp_remote_service.dll &
# The application needs time to come up and reach a steady state, this should not take longer than 30 seconds
sleep 30
Expand Down
4 changes: 4 additions & 0 deletions terraform/dotnet/ec2/default/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,8 @@ variable "get_cw_agent_rpm_command" {

variable "canary_type" {
default = "dotnet-ec2-default"
}

variable "language_version" {
default = "8.0"
}

0 comments on commit f487867

Please sign in to comment.