Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement EKS E2E Testing Workflow #1445

Merged
merged 39 commits into from
Dec 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
92eeb56
added e2e-build
okankoAMZ Nov 7, 2024
4ec8d1e
resolved deadlock
okankoAMZ Nov 7, 2024
ec8a6fa
turned off build agent for testing
okankoAMZ Nov 7, 2024
a722179
skip testing flag
okankoAMZ Nov 8, 2024
07ff0ca
refractoring
okankoAMZ Nov 8, 2024
3efdcff
Merge branch 'main' into e2c-build-workflow
okankoAMZ Nov 8, 2024
535f12e
Update .github/workflows/e2e-build.yml
okankoAMZ Nov 11, 2024
edb81da
Merge remote-tracking branch 'origin/e2c-build-workflow' into e2e
musa-asad Nov 30, 2024
762c0a7
Add E2E workflows.
musa-asad Dec 1, 2024
ff14103
Push workflow.
musa-asad Dec 1, 2024
adf6e6d
Merge build and test for e2e.
musa-asad Dec 1, 2024
93cfb18
Fix env.
musa-asad Dec 1, 2024
0f2562c
Fix env again.
musa-asad Dec 1, 2024
390e64b
Fix call.
musa-asad Dec 1, 2024
0d8561e
Fix split.
musa-asad Dec 1, 2024
3518c73
Use sha.
musa-asad Dec 1, 2024
d62a739
Remove concurrency.
musa-asad Dec 1, 2024
56126d2
Add concurrency back and use parent.
musa-asad Dec 1, 2024
78595cd
Fix variables and remove terraform destroy.
musa-asad Dec 1, 2024
1cb8048
Remove push.
musa-asad Dec 1, 2024
a4111dc
Fix operator.
musa-asad Dec 2, 2024
59e069f
Remove job.
musa-asad Dec 2, 2024
2bad825
Add destroy.
musa-asad Dec 2, 2024
2b992e5
Merge branch 'main' into e2e
musa-asad Dec 4, 2024
d147b88
Merge branch 'main' into e2e
musa-asad Dec 5, 2024
08bbab6
Add flag for e2e test generation.
musa-asad Dec 8, 2024
99db29c
Update .github/workflows/e2e-test.yml
musa-asad Dec 12, 2024
fe0bc91
Update .github/workflows/e2e-test.yml
musa-asad Dec 12, 2024
3fc3545
Merge branch 'main' into e2e
musa-asad Dec 12, 2024
9ea6844
Add TA.
musa-asad Dec 13, 2024
a3be947
Use main for operator workflow.
musa-asad Dec 13, 2024
187aff0
Make changes.
musa-asad Dec 13, 2024
f6ba2b6
Merge branch 'main' into e2e
musa-asad Dec 13, 2024
2a67460
Remove e2e-build.yml.
musa-asad Dec 13, 2024
fe9e5b4
Fix conditional.
musa-asad Dec 14, 2024
4511475
Fix call.
musa-asad Dec 14, 2024
72f1380
Explicit.
musa-asad Dec 15, 2024
b9fdf81
Check empty string.
musa-asad Dec 15, 2024
8fed8d9
Add input to dispatch.
musa-asad Dec 15, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions .github/workflows/build-test-artifacts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,11 @@ on:
- '!.github/workflows/integration-test.yml'
- '!.github/workflows/application-signals-e2e-test.yml'
workflow_dispatch:
inputs:
test-image-before-upload:
description: "Run Test on the new container image"
default: true
type: boolean
workflow_call:
inputs:
test-image-before-upload:
Expand Down Expand Up @@ -93,7 +98,7 @@ jobs:

StartIntegrationTests:
needs: [ BuildAndUploadPackages, BuildAndUploadITAR, BuildAndUploadCN, BuildDocker ]
if: ${{inputs.test-image-before-upload == null || inputs.test-image-before-upload}}
if: ${{ inputs.test-image-before-upload }}
runs-on: ubuntu-latest
steps:
- run: gh workflow run integration-test.yml --ref ${{ github.ref_name }} --repo $GITHUB_REPOSITORY -f build_run_id=${{ github.run_id }} -f build_sha=${{ github.sha }}
Expand All @@ -103,7 +108,7 @@ jobs:
StartApplicationSignalsE2ETests:
needs: [ BuildAndUploadPackages, BuildAndUploadITAR, BuildAndUploadCN, BuildDocker ]
# Workflow only runs against main
if: ${{ contains(github.ref_name, 'main') && (inputs.test-image-before-upload == null ||inputs.test-image-before-upload) }}
if: ${{ contains(github.ref_name, 'main') && inputs.test-image-before-upload }}
runs-on: ubuntu-latest
steps:
- run: gh workflow run application-signals-e2e-test.yml --ref ${{ github.ref_name }} --repo $GITHUB_REPOSITORY -f build_run_id=${{ github.run_id }} -f build_sha=${{ github.sha }}
Expand Down
68 changes: 0 additions & 68 deletions .github/workflows/e2e-build.yml

This file was deleted.

151 changes: 151 additions & 0 deletions .github/workflows/e2e-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,151 @@
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: MIT

name: Run E2E Tests
musa-asad marked this conversation as resolved.
Show resolved Hide resolved
env:
TERRAFORM_AWS_ASSUME_ROLE: ${{ vars.TERRAFORM_AWS_ASSUME_ROLE }}
TERRAFORM_AWS_ASSUME_ROLE_DURATION: 14400 # 4 hours
ECR_INTEGRATION_TEST_REPO: "cwagent-integration-test"
CWA_GITHUB_TEST_REPO_NAME: "aws/amazon-cloudwatch-agent-test"
CWA_GITHUB_TEST_REPO_URL: "https://github.com/aws/amazon-cloudwatch-agent-test.git"
CWA_GITHUB_TEST_REPO_BRANCH: "main"
TERRAFORM_AWS_ASSUME_ROLE_ITAR: ${{ vars.TERRAFORM_AWS_ASSUME_ROLE_ITAR }}
TERRAFORM_AWS_ASSUME_ROLE_CN: ${{ vars.TERRAFORM_AWS_ASSUME_ROLE_CN }}
OPERATOR_GITHUB_REPO_NAME: "aws/amazon-cloudwatch-agent-operator"

on:
workflow_dispatch:
inputs:
region:
required: false
type: string
description: 'AWS Region to run tests in'
default: 'us-west-2'
operator-branch:
required: false
type: string
description: 'Branch of the operator to test'
default: 'main'
helm-charts-branch:
required: false
type: string
description: 'Branch of the helm charts to test'
default: 'main'

concurrency:
group: ${{ github.workflow }}-${{ github.ref_name }}-parent
cancel-in-progress: true

jobs:
GetLatestOperatorCommitSHA:
runs-on: ubuntu-latest
outputs:
operator_commit_sha: ${{steps.get_latest_sha.outputs.operator_sha}}
operator_repo_name: ${{env.OPERATOR_GITHUB_REPO_NAME}}
steps:
- name: Checkout the target repo
uses: actions/checkout@v3
with:
repository: ${{env.OPERATOR_GITHUB_REPO_NAME}}
ref: ${{inputs.operator-branch}}
path: operator-repo

- name: Get latest commit SHA
id: get_latest_sha
run: |
cd operator-repo
latest_sha=$(git rev-parse HEAD)
echo "::set-output name=operator_sha::$latest_sha"

BuildAgent:
uses: ./.github/workflows/build-test-artifacts.yml
concurrency:
group: "Build-Test-Artifacts-${{github.ref_name}}"
cancel-in-progress: true
secrets: inherit
permissions:
id-token: write
contents: read
with:
test-image-before-upload: false

BuildOperator:
needs: [GetLatestOperatorCommitSHA]
uses: aws/amazon-cloudwatch-agent-operator/.github/workflows/build-and-upload.yml@main
concurrency:
group: ${{ github.workflow }}-operator-${{ inputs.operator-branch}}
cancel-in-progress: true
secrets: inherit
with:
tag: ${{needs.GetLatestOperatorCommitSHA.outputs.operator_commit_sha}}
target-sha: ${{needs.GetLatestOperatorCommitSHA.outputs.operator_commit_sha}}
repository: ${{needs.GetLatestOperatorCommitSHA.outputs.operator_repo_name}}
test-image-before-upload: false

OutputEnvVariables:
needs: [ BuildAgent, BuildOperator ]
name: 'OutputEnvVariables'
runs-on: ubuntu-latest
outputs:
CWA_GITHUB_TEST_REPO_NAME: ${{ steps.set-outputs.outputs.CWA_GITHUB_TEST_REPO_NAME }}
CWA_GITHUB_TEST_REPO_URL: ${{ steps.set-outputs.outputs.CWA_GITHUB_TEST_REPO_URL }}
CWA_GITHUB_TEST_REPO_BRANCH: ${{ steps.set-outputs.outputs.CWA_GITHUB_TEST_REPO_BRANCH }}
ECR_INTEGRATION_TEST_REPO: ${{ steps.set-outputs.outputs.ECR_INTEGRATION_TEST_REPO }}
ECR_OPERATOR_REPO: ${{ steps.set-outputs.outputs.ECR_OPERATOR_REPO }}
ECR_TARGET_ALLOCATOR_REPO: ${{ steps.set-outputs.outputs.ECR_TARGET_ALLOCATOR_REPO }}
steps:
- uses: actions/checkout@v3
with:
repository: ${{env.CWA_GITHUB_TEST_REPO_NAME}}
ref: ${{env.CWA_GITHUB_TEST_REPO_BRANCH}}

- name: Set up Go 1.x
uses: actions/setup-go@v4
with:
go-version: ~1.22.2

- name: SetOutputs
id: set-outputs
run: |
echo "::set-output name=CWA_GITHUB_TEST_REPO_NAME::${{ env.CWA_GITHUB_TEST_REPO_NAME }}"
echo "::set-output name=CWA_GITHUB_TEST_REPO_URL::${{ env.CWA_GITHUB_TEST_REPO_URL }}"
echo "::set-output name=CWA_GITHUB_TEST_REPO_BRANCH::${{ env.CWA_GITHUB_TEST_REPO_BRANCH }}"
echo "::set-output name=ECR_INTEGRATION_TEST_REPO::cwagent-integration-test"
echo "::set-output name=ECR_OPERATOR_REPO::$(echo "${{ vars.ECR_OPERATOR_STAGING_REPO }}" | awk -F'/' '{print $NF}')"
echo "::set-output name=ECR_TARGET_ALLOCATOR_REPO::$(echo "${{ vars.ECR_TARGET_ALLOCATOR_STAGING_REPO }}" | awk -F'/' '{print $NF}')"

- name: Echo test variables
run: |
echo "CWA_GITHUB_TEST_REPO_NAME: ${{ steps.set-outputs.outputs.CWA_GITHUB_TEST_REPO_NAME }}"
echo "CWA_GITHUB_TEST_REPO_URL: ${{ steps.set-outputs.outputs.CWA_GITHUB_TEST_REPO_URL }}"
echo "CWA_GITHUB_TEST_REPO_BRANCH: ${{ steps.set-outputs.outputs.CWA_GITHUB_TEST_REPO_BRANCH }}"
echo "ECR_INTEGRATION_TEST_REPO: ${{ steps.set-outputs.outputs.ECR_INTEGRATION_TEST_REPO }}"
echo "ECR_OPERATOR_REPO: ${{ steps.set-outputs.outputs.ECR_OPERATOR_REPO }}"
echo "ECR_TARGET_ALLOCATOR_REPO: ${{ steps.set-outputs.outputs.ECR_TARGET_ALLOCATOR_REPO }}"

GenerateTestMatrix:
musa-asad marked this conversation as resolved.
Show resolved Hide resolved
needs: [BuildAgent, BuildOperator]
name: 'GenerateTestMatrix'
runs-on: ubuntu-latest
outputs:
eks_e2e_matrix: ${{ steps.set-matrix.outputs.eks_e2e_matrix }}
steps:
- uses: actions/checkout@v3
with:
repository: ${{env.CWA_GITHUB_TEST_REPO_NAME}}
ref: ${{env.CWA_GITHUB_TEST_REPO_BRANCH}}

- name: Set up Go 1.x
uses: actions/setup-go@v4
with:
go-version: ~1.22.2

- name: Generate matrix
id: set-matrix
run: |
go run generator/test_case_generator.go -e2e
echo "::set-output name=eks_e2e_matrix::$(echo $(cat generator/resources/eks_e2e_complete_test_matrix.json))"

- name: Echo test plan matrix
run: |
echo "eks_e2e_matrix: ${{ steps.set-matrix.outputs.eks_e2e_matrix }}"
Loading
Loading