diff --git a/.github/workflows/application-signals-python-e2e-ec2-test.yml b/.github/workflows/application-signals-python-e2e-ec2-test.yml index cdad606..c446f15 100644 --- a/.github/workflows/application-signals-python-e2e-ec2-test.yml +++ b/.github/workflows/application-signals-python-e2e-ec2-test.yml @@ -32,11 +32,12 @@ env: METRIC_NAMESPACE: AppSignals LOG_GROUP_NAME: /aws/appsignals/generic ADOT_WHEEL_NAME: ${{ inputs.staging_wheel_name }} - TEST_RESOURCES_FOLDER: /home/runner/work/aws-application-signals-test-framework/aws-application-signals-test-framework jobs: python-e2e-ec2-test: runs-on: ubuntu-latest + container: + image: public.ecr.aws/h6o3z5z9/aws-application-signals-test-framework-workflow-container:latest steps: - name: Get testing resources from aws-application-signals-test-framework uses: actions/checkout@v4 @@ -87,13 +88,6 @@ jobs: echo GET_ADOT_WHEEL_COMMAND="python3.9 -m pip install aws-opentelemetry-distro" >> $GITHUB_ENV fi - - 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' - - name: Initiate Terraform uses: ./.github/workflows/actions/execute_and_retry with: @@ -237,7 +231,7 @@ jobs: - 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 + 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 }} \ diff --git a/.github/workflows/application-signals-python-e2e-eks-test.yml b/.github/workflows/application-signals-python-e2e-eks-test.yml index 357336f..77695a1 100644 --- a/.github/workflows/application-signals-python-e2e-eks-test.yml +++ b/.github/workflows/application-signals-python-e2e-eks-test.yml @@ -32,14 +32,14 @@ env: # The precense of this env var is required for use by terraform and AWS CLI commands # It is not redundant AWS_DEFAULT_REGION: ${{ inputs.aws-region }} - PYTHON_SAMPLE_APP_NAMESPACE: python-app-namespace METRIC_NAMESPACE: AppSignals LOG_GROUP_NAME: /aws/appsignals/eks - TEST_RESOURCES_FOLDER: /home/runner/work/aws-application-signals-test-framework/aws-application-signals-test-framework jobs: python-e2e-eks-test: runs-on: ubuntu-latest + container: + image: public.ecr.aws/h6o3z5z9/aws-application-signals-test-framework-workflow-container:latest steps: - uses: actions/checkout@v4 with: @@ -63,8 +63,10 @@ jobs: delete_log_group="aws logs delete-log-group --log-group-name '${{ env.LOG_GROUP_NAME }}' --region \$REGION" sed -i "s#$delete_log_group##g" clean-app-signals.sh - - name: Generate testing id - run: echo TESTING_ID="${{ inputs.aws-region }}-${{ github.run_id }}-${{ github.run_number }}" >> $GITHUB_ENV + - name: Generate testing id and python sample app namespace + run: | + 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 @@ -86,24 +88,9 @@ jobs: 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 }} aws-region: ${{ inputs.aws-region }} - # local directory to store the kubernetes config - - name: Create kubeconfig directory - run: mkdir -p ${{ github.workspace }}/.kube - - - name: Set KUBECONFIG environment variable - run: echo KUBECONFIG="${{ github.workspace }}/.kube/config" >> $GITHUB_ENV - - name: Set up kubeconfig run: aws eks update-kubeconfig --name ${{ inputs.test-cluster-name }} --region ${{ inputs.aws-region }} - - name: Install eksctl - uses: ./.github/workflows/actions/execute_and_retry - with: - pre-command: 'mkdir ${{ github.workspace }}/eksctl' - command: 'curl -sLO "https://github.com/weaveworks/eksctl/releases/latest/download/eksctl_Linux_amd64.tar.gz" - && tar -xzf eksctl_Linux_amd64.tar.gz -C ${{ github.workspace }}/eksctl && rm eksctl_Linux_amd64.tar.gz' - cleanup: 'rm -f eksctl_Linux_amd64.tar.gz' - - name: Add eksctl to Github Path run: | echo "${{ github.workspace }}/eksctl" >> $GITHUB_PATH @@ -121,13 +108,6 @@ jobs: --region ${{ inputs.aws-region }} \ --approve" - - 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' - - name: Initiate Terraform uses: ./.github/workflows/actions/execute_and_retry with: @@ -167,7 +147,7 @@ jobs: # after installing Application Signals. Attempts to connect will be made for up to 10 minutes if [ $deployment_failed -eq 0 ]; then echo "Installing application signals to the sample app" - source ${GITHUB_WORKSPACE}/.github/workflows/util/execute_and_retry.sh + . ${GITHUB_WORKSPACE}/.github/workflows/util/execute_and_retry.sh execute_and_retry 2 \ "${GITHUB_WORKSPACE}/enablement-script/enable-app-signals.sh \ ${{ inputs.test-cluster-name }} \ @@ -327,7 +307,7 @@ jobs: - 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 + 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 }} \ @@ -363,6 +343,7 @@ jobs: - name: Terraform destroy if: always() continue-on-error: true + timeout-minutes: 5 working-directory: terraform/python/eks run: | terraform destroy -auto-approve \