Skip to content

Commit

Permalink
test locally
Browse files Browse the repository at this point in the history
  • Loading branch information
jj22ee committed May 6, 2024
1 parent 94208cf commit 98f284b
Show file tree
Hide file tree
Showing 10 changed files with 226 additions and 136 deletions.
59 changes: 30 additions & 29 deletions .github/workflows/application-signals-python-e2e-ec2-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ permissions:
contents: read

env:
SAMPLE_APP_ZIP: s3://${{ secrets.APP_SIGNALS_E2E_EC2_JAR }}-prod-${{ inputs.aws-region }}/python-sample-app.zip
SAMPLE_APP_ZIP: s3://sample-app-remote-python/python-sample-app.zip
METRIC_NAMESPACE: AppSignals
LOG_GROUP_NAME: /aws/appsignals/generic
ADOT_WHEEL_NAME: ${{ inputs.staging_wheel_name }}
Expand All @@ -44,22 +44,23 @@ jobs:
- name: Generate testing id
run: echo TESTING_ID="${{ github.job }}-${{ env.AWS_DEFAULT_REGION }}-${{ github.run_id }}-${{ github.run_number }}-${{ github.run_attempt }}" >> $GITHUB_ENV

- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: ${{ secrets.E2E_SECRET_TEST_ROLE_ARN }}
aws-region: us-east-1
# - name: Configure AWS Credentials
# uses: aws-actions/configure-aws-credentials@v4
# with:
# role-to-assume: ${{ secrets.E2E_SECRET_TEST_ROLE_ARN }}
# aws-region: us-east-1

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

- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: arn:aws:iam::${{ env.ACCOUNT_ID }}:role/${{ secrets.E2E_TEST_ROLE_ARN }}
# role-to-assume: arn:aws:iam::${{ env.ACCOUNT_ID }}:role/${{ secrets.E2E_TEST_ROLE_ARN }}
role-to-assume: arn:aws:iam::${{ secrets.ACCOUNT_ID }}:role/${{ secrets.E2E_TEST_ROLE_ARN }}
aws-region: ${{ inputs.aws-region }}

- uses: actions/download-artifact@v3
Expand Down Expand Up @@ -218,7 +219,7 @@ jobs:
--endpoint http://${{ env.MAIN_SERVICE_ENDPOINT }}
--remote-service-deployment-name ${{ env.REMOTE_SERVICE_IP }}:8001
--region ${{ inputs.aws-region }}
--account-id ${{ env.ACCOUNT_ID }}
--account-id ${{ secrets.ACCOUNT_ID }}
--metric-namespace ${{ env.METRIC_NAMESPACE }}
--log-group ${{ env.LOG_GROUP_NAME }}
--service-name python-sample-application-${{ env.TESTING_ID }}
Expand All @@ -227,22 +228,22 @@ jobs:
--instance-ami ${{ env.EC2_INSTANCE_AMI }}
--rollup'

- name: Publish metric on test result
if: always()
run: |
if [ "${{ steps.log-validation.outcome }}" = "success" ] && [ "${{ steps.metric-validation.outcome }}" = "success" ] && [ "${{ steps.trace-validation.outcome }}" = "success" ]; then
aws cloudwatch put-metric-data --namespace 'ADOT/GitHubActions' \
--metric-name Failure \
--dimensions repository=${{ github.repository }},branch=${{ github.ref_name }},workflow=${{ inputs.caller-workflow-name }} \
--value 0.0 \
--region ${{ inputs.aws-region }}
else
aws cloudwatch put-metric-data --namespace 'ADOT/GitHubActions' \
--metric-name Failure \
--dimensions repository=${{ github.repository }},branch=${{ github.ref_name }},workflow=${{ inputs.caller-workflow-name }} \
--value 1.0 \
--region ${{ inputs.aws-region }}
fi
# - name: Publish metric on test result
# if: always()
# run: |
# if [ "${{ steps.log-validation.outcome }}" = "success" ] && [ "${{ steps.metric-validation.outcome }}" = "success" ] && [ "${{ steps.trace-validation.outcome }}" = "success" ]; then
# aws cloudwatch put-metric-data --namespace 'ADOT/GitHubActions' \
# --metric-name Failure \
# --dimensions repository=${{ github.repository }},branch=${{ github.ref_name }},workflow=${{ inputs.caller-workflow-name }} \
# --value 0.0 \
# --region ${{ inputs.aws-region }}
# else
# aws cloudwatch put-metric-data --namespace 'ADOT/GitHubActions' \
# --metric-name Failure \
# --dimensions repository=${{ github.repository }},branch=${{ github.ref_name }},workflow=${{ inputs.caller-workflow-name }} \
# --value 1.0 \
# --region ${{ inputs.aws-region }}
# fi

# Clean up Procedures
- name: Terraform destroy
Expand Down
77 changes: 39 additions & 38 deletions .github/workflows/application-signals-python-e2e-eks-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,24 +64,25 @@ jobs:
echo TESTING_ID="${{ inputs.aws-region }}-${{ github.run_id }}-${{ github.run_number }}" >> $GITHUB_ENV
echo PYTHON_SAMPLE_APP_NAMESPACE="ns-${{ github.run_id }}-${{ github.run_number }}" >> $GITHUB_ENV
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: ${{ secrets.E2E_SECRET_TEST_ROLE_ARN }}
aws-region: us-east-1

- name: Retrieve account
uses: aws-actions/aws-secretsmanager-get-secrets@v1
with:
secret-ids:
ACCOUNT_ID, region-account/${{ inputs.aws-region }}
# - name: Configure AWS Credentials
# uses: aws-actions/configure-aws-credentials@v4
# with:
# role-to-assume: ${{ secrets.E2E_SECRET_TEST_ROLE_ARN }}
# aws-region: us-east-1

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

# ADOT_E2E_TEST_ROLE_ARN is used to access main build e2e test cluster
# E2E_TEST_ROLE_ARN is used to access canary e2e test cluster
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: arn:aws:iam::${{ env.ACCOUNT_ID }}:role/${{ inputs['caller-workflow-name'] == 'main-build' && secrets.ADOT_E2E_TEST_ROLE_ARN || secrets.E2E_TEST_ROLE_ARN }}
# role-to-assume: arn:aws:iam::${{ env.ACCOUNT_ID }}:role/${{ inputs['caller-workflow-name'] == 'main-build' && secrets.ADOT_E2E_TEST_ROLE_ARN || secrets.E2E_TEST_ROLE_ARN }}
role-to-assume: arn:aws:iam::${{ secrets.ACCOUNT_ID }}:role/${{ secrets.E2E_TEST_ROLE_ARN }}
aws-region: ${{ inputs.aws-region }}

- name: Set up kubeconfig
Expand Down Expand Up @@ -137,8 +138,8 @@ jobs:
-var="eks_cluster_context_name=$(kubectl config current-context)" \
-var="test_namespace=${{ env.PYTHON_SAMPLE_APP_NAMESPACE }}" \
-var="service_account_aws_access=service-account-${{ env.TESTING_ID }}" \
-var="python_app_image=${{ env.ACCOUNT_ID }}.dkr.ecr.${{ inputs.aws-region }}.amazonaws.com/${{ secrets.APP_SIGNALS_PYTHON_E2E_FE_SA_IMG }}" \
-var="python_remote_app_image=${{ env.ACCOUNT_ID }}.dkr.ecr.${{ inputs.aws-region }}.amazonaws.com/${{ secrets.APP_SIGNALS_PYTHON_E2E_RE_SA_IMG }}" \
-var="python_app_image=${{ secrets.ACCOUNT_ID }}.dkr.ecr.${{ inputs.aws-region }}.amazonaws.com/${{ secrets.APP_SIGNALS_PYTHON_E2E_FE_SA_IMG }}" \
-var="python_remote_app_image=${{ secrets.ACCOUNT_ID }}.dkr.ecr.${{ inputs.aws-region }}.amazonaws.com/${{ secrets.APP_SIGNALS_PYTHON_E2E_RE_SA_IMG }}" \
|| deployment_failed=$?
if [ $deployment_failed -eq 1 ]; then
Expand Down Expand Up @@ -211,8 +212,8 @@ jobs:
-var="eks_cluster_context_name=$(kubectl config current-context)" \
-var="test_namespace=${{ env.PYTHON_SAMPLE_APP_NAMESPACE }}" \
-var="service_account_aws_access=service-account-${{ env.TESTING_ID }}" \
-var="python_app_image=${{ env.ACCOUNT_ID }}.dkr.ecr.${{ inputs.aws-region }}.amazonaws.com/${{ secrets.APP_SIGNALS_PYTHON_E2E_FE_SA_IMG }}" \
-var="python_remote_app_image=${{ env.ACCOUNT_ID }}.dkr.ecr.${{ inputs.aws-region }}.amazonaws.com/${{ secrets.APP_SIGNALS_PYTHON_E2E_RE_SA_IMG }}"
-var="python_app_image=${{ secrets.ACCOUNT_ID }}.dkr.ecr.${{ inputs.aws-region }}.amazonaws.com/${{ secrets.APP_SIGNALS_PYTHON_E2E_FE_SA_IMG }}" \
-var="python_remote_app_image=${{ secrets.ACCOUNT_ID }}.dkr.ecr.${{ inputs.aws-region }}.amazonaws.com/${{ secrets.APP_SIGNALS_PYTHON_E2E_RE_SA_IMG }}"
retry_counter=$(($retry_counter+1))
else
Expand Down Expand Up @@ -270,7 +271,7 @@ jobs:
--testing-id ${{ env.TESTING_ID }}
--endpoint http://${{ env.APP_ENDPOINT }}
--region ${{ inputs.aws-region }}
--account-id ${{ env.ACCOUNT_ID }}
--account-id ${{ secrets.ACCOUNT_ID }}
--metric-namespace ${{ env.METRIC_NAMESPACE }}
--log-group ${{ env.LOG_GROUP_NAME }}
--app-namespace ${{ env.PYTHON_SAMPLE_APP_NAMESPACE }}
Expand All @@ -287,7 +288,7 @@ jobs:
--testing-id ${{ env.TESTING_ID }}
--endpoint http://${{ env.APP_ENDPOINT }}
--region ${{ inputs.aws-region }}
--account-id ${{ env.ACCOUNT_ID }}
--account-id ${{ secrets.ACCOUNT_ID }}
--metric-namespace ${{ env.METRIC_NAMESPACE }}
--log-group ${{ env.LOG_GROUP_NAME }}
--app-namespace ${{ env.PYTHON_SAMPLE_APP_NAMESPACE }}
Expand All @@ -305,7 +306,7 @@ jobs:
--testing-id ${{ env.TESTING_ID }}
--endpoint http://${{ env.APP_ENDPOINT }}
--region ${{ inputs.aws-region }}
--account-id ${{ env.ACCOUNT_ID }}
--account-id ${{ secrets.ACCOUNT_ID }}
--log-group ${{ env.LOG_GROUP_NAME }}
--app-namespace ${{ env.PYTHON_SAMPLE_APP_NAMESPACE }}
--platform-info ${{ inputs.test-cluster-name }}
Expand All @@ -314,22 +315,22 @@ jobs:
--query-string ip=${{ env.REMOTE_SERVICE_POD_IP }}
--rollup'

- name: Publish metric on test result
if: always()
run: |
if [ "${{ steps.log-validation.outcome }}" = "success" ] && [ "${{ steps.metric-validation.outcome }}" = "success" ] && [ "${{ steps.trace-validation.outcome }}" = "success" ]; then
aws cloudwatch put-metric-data --namespace 'ADOT/GitHubActions' \
--metric-name Failure \
--dimensions repository=${{ github.repository }},branch=${{ github.ref_name }},workflow=${{ inputs.caller-workflow-name }} \
--value 0.0 \
--region ${{ inputs.aws-region }}
else
aws cloudwatch put-metric-data --namespace 'ADOT/GitHubActions' \
--metric-name Failure \
--dimensions repository=${{ github.repository }},branch=${{ github.ref_name }},workflow=${{ inputs.caller-workflow-name }} \
--value 1.0 \
--region ${{ inputs.aws-region }}
fi
# - name: Publish metric on test result
# if: always()
# run: |
# if [ "${{ steps.log-validation.outcome }}" = "success" ] && [ "${{ steps.metric-validation.outcome }}" = "success" ] && [ "${{ steps.trace-validation.outcome }}" = "success" ]; then
# aws cloudwatch put-metric-data --namespace 'ADOT/GitHubActions' \
# --metric-name Failure \
# --dimensions repository=${{ github.repository }},branch=${{ github.ref_name }},workflow=${{ inputs.caller-workflow-name }} \
# --value 0.0 \
# --region ${{ inputs.aws-region }}
# else
# aws cloudwatch put-metric-data --namespace 'ADOT/GitHubActions' \
# --metric-name Failure \
# --dimensions repository=${{ github.repository }},branch=${{ github.ref_name }},workflow=${{ inputs.caller-workflow-name }} \
# --value 1.0 \
# --region ${{ inputs.aws-region }}
# fi

# Clean up Procedures

Expand Down Expand Up @@ -363,8 +364,8 @@ jobs:
-var="eks_cluster_name=${{ inputs.test-cluster-name }}" \
-var="test_namespace=${{ env.PYTHON_SAMPLE_APP_NAMESPACE }}" \
-var="service_account_aws_access=service-account-${{ env.TESTING_ID }}" \
-var="python_app_image=${{ env.ACCOUNT_ID }}.dkr.ecr.${{ inputs.aws-region }}.amazonaws.com/${{ secrets.APP_SIGNALS_PYTHON_E2E_FE_SA_IMG }}" \
-var="python_remote_app_image=${{ env.ACCOUNT_ID }}.dkr.ecr.${{ inputs.aws-region }}.amazonaws.com/${{ secrets.APP_SIGNALS_PYTHON_E2E_RE_SA_IMG }}"
-var="python_app_image=${{ secrets.ACCOUNT_ID }}.dkr.ecr.${{ inputs.aws-region }}.amazonaws.com/${{ secrets.APP_SIGNALS_PYTHON_E2E_FE_SA_IMG }}" \
-var="python_remote_app_image=${{ secrets.ACCOUNT_ID }}.dkr.ecr.${{ inputs.aws-region }}.amazonaws.com/${{ secrets.APP_SIGNALS_PYTHON_E2E_RE_SA_IMG }}"
- name: Remove aws access service account
if: always()
Expand All @@ -374,4 +375,4 @@ jobs:
--name service-account-${{ env.TESTING_ID }} \
--namespace ${{ env.PYTHON_SAMPLE_APP_NAMESPACE }} \
--cluster ${{ inputs.test-cluster-name }} \
--region ${{ inputs.aws-region }}
--region ${{ inputs.aws-region }}
4 changes: 2 additions & 2 deletions .github/workflows/appsignals-e2e-ec2-canary-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
## including logs, metrics, and traces.
name: App Signals Enablement - E2E EC2 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

permissions:
Expand Down
64 changes: 32 additions & 32 deletions .github/workflows/appsignals-e2e-ec2-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ env:
# It is not redundant
AWS_DEFAULT_REGION: ${{ inputs.aws-region }}
TEST_ACCOUNT: ${{ secrets.APP_SIGNALS_E2E_TEST_ACC }}
SAMPLE_APP_FRONTEND_SERVICE_JAR: s3://${{ secrets.APP_SIGNALS_E2E_EC2_JAR }}-prod-${{ inputs.aws-region }}/main-service.jar
SAMPLE_APP_REMOTE_SERVICE_JAR: s3://${{ secrets.APP_SIGNALS_E2E_EC2_JAR }}-prod-${{ inputs.aws-region }}/remote-service.jar
SAMPLE_APP_FRONTEND_SERVICE_JAR: s3://sample-app-remote/sample-app.jar
SAMPLE_APP_REMOTE_SERVICE_JAR: s3://sample-app-remote/sample-app-remote.jar
APP_SIGNALS_ADOT_JAR: "https://github.com/aws-observability/aws-otel-java-instrumentation/releases/latest/download/aws-opentelemetry-agent.jar"
METRIC_NAMESPACE: AppSignals
LOG_GROUP_NAME: /aws/appsignals/generic
Expand All @@ -46,22 +46,22 @@ jobs:
- name: Generate testing id
run: echo TESTING_ID="${{ github.run_id }}-${{ github.run_number }}" >> $GITHUB_ENV

- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: ${{ secrets.E2E_SECRET_TEST_ROLE_ARN }}
aws-region: us-east-1
# - name: Configure AWS Credentials
# uses: aws-actions/configure-aws-credentials@v4
# with:
# role-to-assume: ${{ secrets.E2E_SECRET_TEST_ROLE_ARN }}
# aws-region: us-east-1

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

- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: arn:aws:iam::${{ env.ACCOUNT_ID }}:role/${{ secrets.E2E_TEST_ROLE_ARN }}
role-to-assume: arn:aws:iam::${{ secrets.ACCOUNT_ID }}:role/${{ secrets.E2E_TEST_ROLE_ARN_JAVA_EKS }}
aws-region: ${{ inputs.aws-region }}

- name: Initiate Terraform
Expand Down Expand Up @@ -186,7 +186,7 @@ jobs:
--endpoint http://${{ env.MAIN_SERVICE_ENDPOINT }}
--remote-service-deployment-name ${{ env.REMOTE_SERVICE_IP }}:8080
--region ${{ inputs.aws-region }}
--account-id ${{ env.ACCOUNT_ID }}
--account-id ${{ secrets.ACCOUNT_ID }}
--metric-namespace ${{ env.METRIC_NAMESPACE }}
--log-group ${{ env.LOG_GROUP_NAME }}
--service-name sample-application-${{ env.TESTING_ID }}
Expand All @@ -203,7 +203,7 @@ jobs:
--endpoint http://${{ env.MAIN_SERVICE_ENDPOINT }}
--remote-service-deployment-name ${{ env.REMOTE_SERVICE_IP }}:8080
--region ${{ inputs.aws-region }}
--account-id ${{ env.ACCOUNT_ID }}
--account-id ${{ secrets.ACCOUNT_ID }}
--metric-namespace ${{ env.METRIC_NAMESPACE }}
--log-group ${{ env.LOG_GROUP_NAME }}
--service-name sample-application-${{ env.TESTING_ID }}
Expand All @@ -220,7 +220,7 @@ jobs:
--endpoint http://${{ env.MAIN_SERVICE_ENDPOINT }}
--remote-service-deployment-name ${{ env.REMOTE_SERVICE_IP }}:8080
--region ${{ inputs.aws-region }}
--account-id ${{ env.ACCOUNT_ID }}
--account-id ${{ secrets.ACCOUNT_ID }}
--metric-namespace ${{ env.METRIC_NAMESPACE }}
--log-group ${{ env.LOG_GROUP_NAME }}
--service-name sample-application-${{ env.TESTING_ID }}
Expand All @@ -229,22 +229,22 @@ jobs:
--instance-ami ${{ env.EC2_INSTANCE_AMI }}
--rollup'

- name: Publish metric on test result
if: always()
run: |
if [ "${{ steps.log-validation.outcome }}" = "success" ] && [ "${{ steps.metric-validation.outcome }}" = "success" ] && [ "${{ steps.trace-validation.outcome }}" = "success" ]; then
aws cloudwatch put-metric-data --namespace 'ADOT/GitHubActions' \
--metric-name Failure \
--dimensions repository=${{ github.repository }},branch=${{ github.ref_name }},workflow=${{ inputs.caller-workflow-name }} \
--value 0.0 \
--region ${{ inputs.aws-region }}
else
aws cloudwatch put-metric-data --namespace 'ADOT/GitHubActions' \
--metric-name Failure \
--dimensions repository=${{ github.repository }},branch=${{ github.ref_name }},workflow=${{ inputs.caller-workflow-name }} \
--value 1.0 \
--region ${{ inputs.aws-region }}
fi
# - name: Publish metric on test result
# if: always()
# run: |
# if [ "${{ steps.log-validation.outcome }}" = "success" ] && [ "${{ steps.metric-validation.outcome }}" = "success" ] && [ "${{ steps.trace-validation.outcome }}" = "success" ]; then
# aws cloudwatch put-metric-data --namespace 'ADOT/GitHubActions' \
# --metric-name Failure \
# --dimensions repository=${{ github.repository }},branch=${{ github.ref_name }},workflow=${{ inputs.caller-workflow-name }} \
# --value 0.0 \
# --region ${{ inputs.aws-region }}
# else
# aws cloudwatch put-metric-data --namespace 'ADOT/GitHubActions' \
# --metric-name Failure \
# --dimensions repository=${{ github.repository }},branch=${{ github.ref_name }},workflow=${{ inputs.caller-workflow-name }} \
# --value 1.0 \
# --region ${{ inputs.aws-region }}
# fi

# Clean up Procedures
- name: Terraform destroy
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/appsignals-e2e-eks-canary-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
## including logs, metrics, and traces.
name: App Signals Enablement - E2E EKS 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

permissions:
Expand Down
Loading

0 comments on commit 98f284b

Please sign in to comment.