Skip to content

Commit

Permalink
Enable Java.
Browse files Browse the repository at this point in the history
  • Loading branch information
zzhlogin committed Sep 6, 2024
1 parent 85fb679 commit 5bdd8ab
Show file tree
Hide file tree
Showing 10 changed files with 404 additions and 48 deletions.
9 changes: 6 additions & 3 deletions .github/workflows/java-ecs-e2e-canary-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,19 @@
## It will then clean up the cluster and EC2 instance it runs on for the next test run.
name: Application Signals Enablement - Java ECS E2E Canary Testing
on:
schedule:
- cron: '*/15 * * * *' # run the workflow every 15 minutes
# schedule:
# - cron: '*/15 * * * *' # run the workflow every 15 minutes
workflow_dispatch: # be able to run the workflow on demand
push:
branches:
- ecs-no-call-zzhlogin

permissions:
id-token: write
contents: read

jobs:
e2e-k8s-test:
e2e-ecs-test:
uses: ./.github/workflows/java-ecs-e2e-test.yml
secrets: inherit
with:
Expand Down
35 changes: 19 additions & 16 deletions .github/workflows/java-ecs-e2e-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ env:
METRIC_NAMESPACE: ApplicationSignals
LOG_GROUP_NAME: /aws/application-signals/data
TEST_RESOURCES_FOLDER: ${GITHUB_WORKSPACE}
ACCOUNT_ID: '007003802740'
CWAGENT_IMAGE_URI: 'public.ecr.aws/y8s3a7r9/cloudwatch-agent:latest'

jobs:
java-ecs:
Expand Down Expand Up @@ -73,11 +75,11 @@ jobs:
role-to-assume: arn:aws:iam::${{ env.E2E_TEST_ACCOUNT_ID }}:role/${{ env.E2E_TEST_ROLE_NAME }}
aws-region: us-east-1

# ACCOUNT_ID, region-account/${{ env.E2E_TEST_AWS_REGION }}
- name: Retrieve account
uses: aws-actions/aws-secretsmanager-get-secrets@v1
with:
secret-ids: |
ACCOUNT_ID, region-account/${{ env.E2E_TEST_AWS_REGION }}
JAVA_MAIN_SAMPLE_APP_IMAGE, e2e-test/java-main-sample-app-image
JAVA_REMOTE_SAMPLE_APP_IMAGE, e2e-test/java-remote-sample-app-image
Expand Down Expand Up @@ -111,14 +113,14 @@ jobs:
ADOT_INSTRUMENTATION_IMAGE_TAG=$(curl -s -I -L 'https://github.com/aws-observability/aws-otel-java-instrumentation/releases/latest' | grep -i Location | awk -F'/tag/' '{print $2}')
echo ADOT_INSTRUMENTATION_IMAGE_URI="public.ecr.aws/aws-observability/adot-autoinstrumentation-java:$ADOT_INSTRUMENTATION_IMAGE_TAG" >> $GITHUB_ENV
fi
- name: Set Get CW Agent command environment variable
run: |
if [ "${{ github.event.repository.name }}" = "amazon-cloudwatch-agent" ]; then
echo CWAGENT_IMAGE_URI="${{ secrets.AWS_ECR_PRIVATE_REGISTRY }}/cwagent-integration-test:${{ github.sha }}" >> $GITHUB_ENV
else
echo CWAGENT_IMAGE_URI="public.ecr.aws/cloudwatch-agent/cloudwatch-agent:latest" >> $GITHUB_ENV
fi
#
# - name: Set Get CW Agent command environment variable
# run: |
# if [ "${{ github.event.repository.name }}" = "amazon-cloudwatch-agent" ]; then
# echo CWAGENT_IMAGE_URI="${{ secrets.AWS_ECR_PRIVATE_REGISTRY }}/cwagent-integration-test:${{ github.sha }}" >> $GITHUB_ENV
# else
# echo CWAGENT_IMAGE_URI="public.ecr.aws/cloudwatch-agent/cloudwatch-agent:latest" >> $GITHUB_ENV
# fi

- name: Deploy sample app via terraform and wait for the endpoint to come online
id: deploy-sample-app
Expand All @@ -137,7 +139,7 @@ jobs:
-var="test_id=${{ env.TESTING_ID }}" \
-var="aws_region=${{ env.E2E_TEST_AWS_REGION }}" \
-var="ecs_cluster_name=${{ env.CLUSTER_NAME }}" \
-var="sample_app_name"=${{ env.SAMPLE_APP_NAME }} \
-var="sample_app_name=${{ env.SAMPLE_APP_NAME }}-${{ env.TESTING_ID }}" \
-var="sample_app_image=${{ env.MAIN_SAMPLE_APP_IMAGE_URI }}" \
-var="sample_remote_app_image=${{ env.REMOTE_SAMPLE_APP_IMAGE_URI }}" \
-var="adot_instrumentation_image=${{ env.ADOT_INSTRUMENTATION_IMAGE_URI }}" \
Expand All @@ -156,7 +158,7 @@ jobs:
-var="test_id=${{ env.TESTING_ID }}" \
-var="aws_region=${{ env.E2E_TEST_AWS_REGION }}" \
-var="ecs_cluster_name=${{ env.CLUSTER_NAME }}" \
-var="sample_app_name"=${{ env.SAMPLE_APP_NAME }} \
-var="sample_app_name=${{ env.SAMPLE_APP_NAME }}-${{ env.TESTING_ID }}" \
-var="sample_app_image=${{ env.MAIN_SAMPLE_APP_IMAGE_URI }}" \
-var="sample_remote_app_image=${{ env.REMOTE_SAMPLE_APP_IMAGE_URI }}" \
-var="adot_instrumentation_image=${{ env.ADOT_INSTRUMENTATION_IMAGE_URI }}" \
Expand All @@ -174,8 +176,9 @@ jobs:
fi
done
- name: Log Artifact Versions
- name: Sleep to Wait for Canary Generated and Log Artifact Versions
run: |
sleep 120
echo "ADOT Image: ${{ env.ADOT_INSTRUMENTATION_IMAGE_URI }}";
echo "CW Agent Image: ${{ env.CWAGENT_IMAGE_URI }}";
Expand All @@ -200,7 +203,7 @@ jobs:
--metric-namespace ${{ env.METRIC_NAMESPACE }}
--log-group ${{ env.LOG_GROUP_NAME }}
--platform-info ${{ env.CLUSTER_NAME }}
--service-name ${{env.SAMPLE_APP_NAME }}
--service-name ${{env.SAMPLE_APP_NAME }}-${{ env.TESTING_ID }}
--rollup'

- name: Call endpoints and validate generated metrics
Expand All @@ -213,7 +216,7 @@ jobs:
--metric-namespace ${{ env.METRIC_NAMESPACE }}
--log-group ${{ env.LOG_GROUP_NAME }}
--platform-info ${{ env.CLUSTER_NAME }}
--service-name ${{env.SAMPLE_APP_NAME }}
--service-name ${{env.SAMPLE_APP_NAME }}-${{ env.TESTING_ID }}
--rollup'

- name: Call endpoints and validate generated traces
Expand All @@ -226,7 +229,7 @@ jobs:
--metric-namespace ${{ env.METRIC_NAMESPACE }}
--log-group ${{ env.LOG_GROUP_NAME }}
--platform-info ${{ env.CLUSTER_NAME }}
--service-name ${{env.SAMPLE_APP_NAME }}
--service-name ${{env.SAMPLE_APP_NAME }}-${{ env.TESTING_ID }}
--rollup'

- name: Publish metric on test result
Expand Down Expand Up @@ -258,7 +261,7 @@ jobs:
-var="test_id=${{ env.TESTING_ID }}" \
-var="aws_region=${{ env.E2E_TEST_AWS_REGION }}" \
-var="ecs_cluster_name=${{ env.CLUSTER_NAME }}" \
-var="sample_app_name"=${{ env.SAMPLE_APP_NAME }} \
-var="sample_app_name=${{ env.SAMPLE_APP_NAME }}-${{ env.TESTING_ID }}" \
-var="sample_app_image=${{ env.MAIN_SAMPLE_APP_IMAGE_URI }}" \
-var="sample_remote_app_image=${{ env.REMOTE_SAMPLE_APP_IMAGE_URI }}" \
-var="adot_instrumentation_image=${{ env.ADOT_INSTRUMENTATION_IMAGE_URI }}" \
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
## Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
## SPDX-License-Identifier: Apache-2.0

## Operator and our sample app and remote service onto a native K8s cluster, call the
## APIs, and validate the generated telemetry, including logs, metrics, and traces.
## It will then clean up the cluster and EC2 instance it runs on for the next test run.
## This workflow aims to run the Application Signals Python end-to-end tests as a canary to
## test the artifacts for Application Signals enablement. It will deploy a sample app onto an ECS cluster,
## call the APIs, and validate the generated telemetry, including logs, metrics, and traces.
name: ZZH Application Signals Enablement - Python ECS E2E Canary Testing
on:
# schedule:
# - cron: '*/15 * * * *' # run the workflow every 15 minutes
schedule:
- cron: '*/15 * * * *' # run the workflow every 15 minutes
workflow_dispatch: # be able to run the workflow on demand
push:
branches:
Expand All @@ -18,10 +18,14 @@ permissions:
contents: read

jobs:
e2e-ecs-test:
uses: ./.github/workflows/python-ecs-e2e-test.yml
ecs:
strategy:
fail-fast: false
matrix:
aws-region: ['us-east-1']
uses: ./.github/workflows/python-ecs-retry.yml
secrets: inherit
with:
# To run in more regions, a cluster must be provisioned manually on EC2 instances in that region
aws-region: 'us-east-1'
aws-region: ${{ matrix.aws-region }}
caller-workflow-name: 'appsignals-e2e-python-ecs-canary-test'
64 changes: 64 additions & 0 deletions .github/workflows/python-ecs-retry.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
## 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: Python ECS Retry
on:
workflow_call:
inputs:
aws-region:
required: true
type: string
test-cluster-name:
required: true
type: string
caller-workflow-name:
required: true
type: string

concurrency:
group: 'python-eks-${{ inputs.aws-region }}-${{ github.ref_name }}'
cancel-in-progress: false

permissions:
id-token: write
contents: read

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

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

publish-metric-attempt-1:
needs: [ python-ecs-attempt-1, python-ecs-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.python-ecs-attempt-1.outputs.validation-result || needs.python-ecs-attempt-2.outputs.validation-result }}

publish-metric-attempt-2:
needs: [ python-ecs-attempt-1, python-ecs-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.python-ecs-attempt-1.outputs.validation-result || needs.python-ecs-attempt-2.outputs.validation-result }}
Loading

0 comments on commit 5bdd8ab

Please sign in to comment.