Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
Jeel Mehta committed Jan 28, 2025
2 parents 6fd1e7c + f011798 commit 53a4b64
Show file tree
Hide file tree
Showing 34 changed files with 2,149 additions and 1,025 deletions.
7 changes: 7 additions & 0 deletions .github/workflows/deploy-canary.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ jobs:
role-to-assume: ${{ env.TERRAFORM_AWS_ASSUME_ROLE }}
aws-region: us-west-2

- name: Install Terraform
uses: hashicorp/setup-terraform@v3

- name: Terminate Last Canary
run: |
if aws s3api wait object-exists --bucket ${S3_INTEGRATION_BUCKET} --key canary/al2/terraform.tfstate ;
Expand All @@ -51,6 +54,10 @@ jobs:
terraform destroy -auto-approve
aws s3api delete-object --bucket ${S3_INTEGRATION_BUCKET} --key canary/al2/terraform.tfstate
fi
- name: Verify Terraform version
run: terraform --version

# @TODO we can add a matrix in the future but for alpha we will only deploy to al2
- name: Terraform apply
uses: nick-fields/retry@v2
Expand Down
18 changes: 10 additions & 8 deletions .github/workflows/e2e-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ env:
OPERATOR_GITHUB_REPO_NAME: "aws/amazon-cloudwatch-agent-operator"

on:
schedule:
- cron: '0 17 * * 1'
workflow_dispatch:
inputs:
region:
Expand Down Expand Up @@ -47,7 +49,7 @@ jobs:
uses: actions/checkout@v3
with:
repository: ${{env.OPERATOR_GITHUB_REPO_NAME}}
ref: ${{inputs.operator-branch}}
ref: ${{ inputs.operator-branch || 'main' }}
path: operator-repo

- name: Get latest commit SHA
Expand All @@ -73,7 +75,7 @@ jobs:
needs: [GetLatestOperatorCommitSHA]
uses: aws/amazon-cloudwatch-agent-operator/.github/workflows/build-and-upload.yml@main
concurrency:
group: ${{ github.workflow }}-operator-${{ inputs.operator-branch}}
group: ${{ github.workflow }}-operator-${{ inputs.operator-branch || 'main' }}
cancel-in-progress: true
secrets: inherit
with:
Expand Down Expand Up @@ -165,8 +167,8 @@ jobs:
cloudwatch_agent_tag: ${{ github.sha }}
cloudwatch_agent_operator_repository: ${{ needs.OutputEnvVariables.outputs.ECR_OPERATOR_REPO }}
cloudwatch_agent_operator_tag: ${{ needs.GetLatestOperatorCommitSHA.outputs.operator_commit_sha }}
region: ${{ inputs.region }}
helm_charts_branch: ${{ inputs.helm-charts-branch }}
region: ${{ inputs.region || 'us-west-2' }}
helm_charts_branch: ${{ inputs.helm-charts-branch || 'main' }}
terraform_assume_role: ${{ vars.TERRAFORM_AWS_ASSUME_ROLE }}
agent_config: resources/cwagent_configs/jvm_tomcat.json
sample_app: resources/sample_apps/tomcat.yaml
Expand All @@ -187,8 +189,8 @@ jobs:
cloudwatch_agent_tag: ${{ github.sha }}
cloudwatch_agent_operator_repository: ${{ needs.OutputEnvVariables.outputs.ECR_OPERATOR_REPO }}
cloudwatch_agent_operator_tag: ${{ needs.GetLatestOperatorCommitSHA.outputs.operator_commit_sha }}
region: ${{ inputs.region }}
helm_charts_branch: ${{ inputs.helm-charts-branch }}
region: ${{ inputs.region || 'us-west-2' }}
helm_charts_branch: ${{ inputs.helm-charts-branch || 'main' }}
terraform_assume_role: ${{ vars.TERRAFORM_AWS_ASSUME_ROLE }}
agent_config: resources/cwagent_configs/kafka.json
sample_app: resources/sample_apps/kafka.yaml
Expand All @@ -209,8 +211,8 @@ jobs:
cloudwatch_agent_tag: ${{ github.sha }}
cloudwatch_agent_operator_repository: ${{ needs.OutputEnvVariables.outputs.ECR_OPERATOR_REPO }}
cloudwatch_agent_operator_tag: ${{ needs.GetLatestOperatorCommitSHA.outputs.operator_commit_sha }}
region: ${{ inputs.region }}
helm_charts_branch: ${{ inputs.helm-charts-branch }}
region: ${{ inputs.region || 'us-west-2' }}
helm_charts_branch: ${{ inputs.helm-charts-branch || 'main' }}
terraform_assume_role: ${{ vars.TERRAFORM_AWS_ASSUME_ROLE }}
agent_config: resources/cwagent_configs/containerinsights.json
sample_app: resources/sample_apps/tomcat.yaml
Expand Down
14 changes: 5 additions & 9 deletions .github/workflows/ec2-integration-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,23 +65,19 @@ jobs:
aws-region: ${{inputs.region}}
role-duration-seconds: ${{ env.TERRAFORM_AWS_ASSUME_ROLE_DURATION }}

- name: Cache if success
id: cache_if_success
uses: actions/cache@v3
with:
path: go.mod
key: ${{inputs.region}}-${{ github.sha }}-${{ matrix.arrays.os }}-${{ matrix.arrays.arc }}-${{ matrix.arrays.test_dir }}

- name: Echo Test Info
run: |
echo run cache_if_success os ${{ matrix.arrays.os }} arc ${{ matrix.arrays.arc }} test dir ${{ matrix.arrays.test_dir }}
echo localstack input ${{ inputs.localstack_host }}
- name: Install Terraform
uses: hashicorp/setup-terraform@v3

- name: Verify Terraform version
run: terraform --version

# nick-fields/retry@v2 starts at base dir
- name: Terraform apply
if: steps.cache_if_success.outputs.cache-hit != 'true'
uses: nick-fields/retry@v2
with:
max_attempts: 2
Expand All @@ -93,7 +89,7 @@ jobs:
else
cd ${{inputs.test_dir}}
fi
terraform init
if terraform apply --auto-approve \
-var="ssh_key_value=${{env.PRIVATE_KEY}}" -var="github_test_repo=${{ inputs.test_repo_url }}" \
Expand Down
15 changes: 4 additions & 11 deletions .github/workflows/eks-e2e-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -90,24 +90,17 @@ jobs:
aws-region: ${{ inputs.region }}
role-duration-seconds: ${{ env.TERRAFORM_AWS_ASSUME_ROLE_DURATION }}

- name: Cache if success
id: cache_if_success
uses: actions/cache@v3
with:
path: go.mod
key: ${{inputs.region}}-${{ github.sha }}-${{ matrix.arrays.os }}-${{ matrix.arrays.arc }}-${{ matrix.arrays.test_dir }}

- name: Login ECR
id: login-ecr
if: steps.cache_if_success.outputs.cache-hit != 'true'
uses: aws-actions/amazon-ecr-login@v2

- name: Install Terraform
uses: hashicorp/setup-terraform@v3

- name: Verify Terraform version
if: steps.cache_if_success.outputs.cache-hit != 'true'
run: terraform --version

- name: Terraform apply
if: steps.cache_if_success.outputs.cache-hit != 'true'
uses: nick-fields/retry@v2
with:
max_attempts: 3
Expand Down Expand Up @@ -144,7 +137,7 @@ jobs:
else
terraform destroy --auto-approve && exit 1
fi
- name: Terraform destroy
if: ${{ cancelled() || failure() }}
uses: nick-fields/retry@v2
Expand Down
Loading

0 comments on commit 53a4b64

Please sign in to comment.