-
Notifications
You must be signed in to change notification settings - Fork 213
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
Added concurrent testing and release updates #526
Changes from 7 commits
2cbaafe
9676dd4
a8f40cd
74bca13
b068ea6
5217407
2b87a82
7eb43be
7eba705
bd099e0
a7a7cae
ddafc1e
77388c7
1ba4ffe
27cf5b2
40f6ac8
975c06c
057bcd8
b515357
b4fdddf
9a00292
5bdfdce
16813cb
7502aa1
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,6 +21,7 @@ on: | |
branches: | ||
- master | ||
|
||
|
||
workflow_dispatch: | ||
|
||
concurrency: | ||
|
@@ -140,12 +141,12 @@ jobs: | |
- name: Upload to s3 | ||
if: steps.cached_binaries.outputs.cache-hit != 'true' | ||
run: aws s3 cp build/bin s3://${S3_INTEGRATION_BUCKET}/integration-test/binary/${{ github.sha }} --recursive | ||
|
||
GenerateTestMatrix: | ||
name: 'GenerateTestMatrix' | ||
runs-on: ubuntu-latest | ||
outputs: | ||
ec2_linux_matrix: ${{ steps.set-matrix.outputs.ec2_linux_matrix }} | ||
ec2_performance_matrix: ${{steps.set-matrix.outputs.ec2_performance_matrix}} | ||
ec2_windows_matrix: ${{ steps.set-matrix.outputs.ec2_windows_matrix }} | ||
ecs_fargate_matrix: ${{ steps.set-matrix.outputs.ecs_fargate_matrix }} | ||
steps: | ||
|
@@ -161,14 +162,19 @@ jobs: | |
run: | | ||
go run --tags=generator integration/generator/test_case_generator.go | ||
echo "::set-output name=ec2_linux_matrix::$(echo $(cat integration/generator/resources/ec2_linux_complete_test_matrix.json))" | ||
echo "::set-output name=ec2_performance_matrix::$(echo $(cat integration/generator/resources/ec2_performance_complete_test_matrix.json))" | ||
echo "::set-output name=ec2_windows_matrix::$(echo $(cat integration/generator/resources/ec2_windows_complete_test_matrix.json))" | ||
echo "::set-output name=ecs_fargate_matrix::$(echo $(cat integration/generator/resources/ecs_fargate_complete_test_matrix.json))" | ||
|
||
- name: Echo test plan matrix | ||
run: | | ||
echo ${{ steps.set-matrix.outputs.ec2_linux_matrix }} | ||
echo ${{ steps.set-matrix.outputs.ec2_performance_matrix}} | ||
echo ${{ steps.set-matrix.outputs.ec2_windows_matrix }} | ||
echo ${{ steps.set-matrix.outputs.ecs_fargate_matrix }} | ||
- name: Echo performance matrix | ||
run: | | ||
echo ${{ steps.set-matrix.outputs.ec2_performance_matrix}} | ||
|
||
MakeMSIZip: | ||
name: 'MakeMSIZip' | ||
|
@@ -619,6 +625,10 @@ jobs: | |
name: "PerformanceTrackingTest" | ||
needs: [MakeBinary, StartLocalStack, GenerateTestMatrix] | ||
runs-on: ubuntu-latest | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
arrays: ${{ fromJson(needs.GenerateTestMatrix.outputs.ec2_performance_matrix) }} | ||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
|
@@ -638,52 +648,51 @@ jobs: | |
|
||
- name: Echo Test Info | ||
run: echo run performance-tracking | ||
|
||
- name: Verify Terraform version | ||
run: terraform --version | ||
|
||
- name: Get SHA | ||
id: sha | ||
run: echo "::set-output name=sha_short::$(git rev-parse --short HEAD)" | ||
- name: Get git date | ||
id: sha_date | ||
run: echo "::set-output name=sha_date::$(git show -s --format=%ct ${{ steps.sha.outputs.sha_short }} )" | ||
|
||
- name: Check env | ||
run: echo "SHA ${GITHUB_SHA} | Date ${{ steps.sha_date.outputs.sha_date }}" | ||
|
||
run: echo "SHA ${{ steps.sha.outputs.sha_short }} | Date ${{ steps.sha_date.outputs.sha_date }} " | ||
- name: Verify Terraform version | ||
run: terraform --version | ||
- name: Terraform apply | ||
if: steps.performance-tracking.outputs.cache-hit != 'true' | ||
uses: nick-invision/retry@v2 | ||
with: | ||
max_attempts: 1 | ||
timeout_minutes: 50 | ||
timeout_minutes: 30 | ||
retry_wait_seconds: 5 | ||
command: | | ||
cd integration/terraform/ec2/linux | ||
terraform init | ||
if terraform apply --auto-approve \ | ||
-var="ssh_key=${PRIVATE_KEY}" -var="github_repo=${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}.git" \ | ||
-var="github_sha=${GITHUB_SHA}" -var="install_agent=rpm -U ./amazon-cloudwatch-agent.rpm" \ | ||
-var="user=ec2-user" \ | ||
-var="ami=cloudwatch-agent-integration-test-al2*" \ | ||
-var="ca_cert_path=/etc/ssl/certs/ca-bundle.crt" \ | ||
-var="arc=amd64" \ | ||
-var="binary_name=amazon-cloudwatch-agent.rpm" \ | ||
-var="github_sha=${GITHUB_SHA}" -var="install_agent=${{ matrix.arrays.installAgentCommand }}" \ | ||
-var="user=${{ matrix.arrays.username }}" \ | ||
-var="ami=${{ matrix.arrays.ami }}" \ | ||
-var="ca_cert_path=${{ matrix.arrays.caCertPath }}" \ | ||
-var="arc=${{ matrix.arrays.arc }}" \ | ||
-var="binary_name=${{ matrix.arrays.binaryName }}" \ | ||
-var="local_stack_host_name=${{ needs.StartLocalStack.outputs.local_stack_host_name }}" \ | ||
-var="s3_bucket=${S3_INTEGRATION_BUCKET}" \ | ||
-var="key_name=${KEY_NAME}" \ | ||
-var="test_name=cw-integ-test-al2" \ | ||
-var="github_sha_date=${{ steps.sha_date.outputs.sha_date }}" \ | ||
-var="test_dir=./integration/test/performancetest" ; then terraform destroy -auto-approve | ||
|
||
-var="test_name=cw-integ-test-${{ matrix.arrays.os }}" \ | ||
-var="performance_number_of_logs=${{ matrix.arrays.performance_number_of_logs}}"\ | ||
-var="test_dir=${{ matrix.arrays.test_dir }}" ; then terraform destroy -auto-approve | ||
else | ||
terraform destroy -auto-approve && exit 1 | ||
fi | ||
|
||
#This is here just in case workflow cancel | ||
- name: Terraform destroy | ||
if: ${{ cancelled() && steps.performance-tracking.outputs.cache-hit != 'true' }} | ||
if: ${{ cancelled() && steps.ec2-linux-integration-test.outputs.cache-hit != 'true' }} | ||
okankoAMZ marked this conversation as resolved.
Show resolved
Hide resolved
|
||
uses: nick-invision/retry@v2 | ||
with: | ||
max_attempts: 3 | ||
max_attempts: 1 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If we're only allowing one attempt, why even have the retry? Why are we reducing this to 1? This is also for just the terraform destroy, so I don't see the issue. |
||
timeout_minutes: 8 | ||
retry_wait_seconds: 5 | ||
command: cd integration/terraform/ec2/linux && terraform destroy --auto-approve | ||
command: cd integration/terraform/ec2/linux && terraform destroy --auto-approve |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
okankoAMZ marked this conversation as resolved.
Show resolved
Hide resolved
|
||
# SPDX-License-Identifier: MIT | ||
|
||
name: Release Update | ||
env: | ||
PRIVATE_KEY: ${{ secrets.AWS_PRIVATE_KEY }} | ||
TERRAFORM_AWS_ACCESS_KEY_ID: ${{ secrets.TERRAFORM_AWS_ACCESS_KEY_ID }} | ||
TERRAFORM_AWS_SECRET_ACCESS_KEY: ${{ secrets.TERRAFORM_AWS_SECRET_ACCESS_KEY }} | ||
S3_INTEGRATION_BUCKET: ${{ secrets.S3_INTEGRATION_BUCKET }} | ||
KEY_NAME: ${{ secrets.KEY_NAME }} | ||
VPC_SECURITY_GROUPS_IDS: ${{ secrets.VPC_SECURITY_GROUPS_IDS }} | ||
IAM_ROLE: ${{ secrets.IAM_ROLE }} | ||
GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }} | ||
PASSPHRASE: ${{ secrets.PASSPHRASE }} | ||
GPG_KEY_NAME: ${{ secrets.GPG_KEY_NAME }} | ||
GPG_TTY: $(tty) | ||
|
||
on: | ||
release: | ||
types: [created] | ||
|
||
workflow_dispatch: | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.ref_name }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
UpdatePerformanceMetrics: | ||
name: "UpdatePerformanceMetrics" | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- name: Set up Go 1.x | ||
uses: actions/setup-go@v2 | ||
with: | ||
go-version: ~1.18.3 | ||
- name: Configure AWS Credentials | ||
uses: aws-actions/configure-aws-credentials@v1 | ||
with: | ||
aws-access-key-id: ${{ secrets.TERRAFORM_AWS_ACCESS_KEY_ID }} | ||
aws-secret-access-key: ${{ secrets.TERRAFORM_AWS_SECRET_ACCESS_KEY }} | ||
aws-region: us-west-2 | ||
|
||
- name: Update isRelease for this release | ||
run: | | ||
cd integration/test/performancetest | ||
export IS_RELEASE=true | ||
export SHA=$GITHUB_SHA | ||
go test -run TestUpdateCommit -p 1 -v --tags=integration | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
[ | ||
okankoAMZ marked this conversation as resolved.
Show resolved
Hide resolved
|
||
{ | ||
"os": "al2", | ||
"username": "ec2-user", | ||
"installAgentCommand": "rpm -U ./amazon-cloudwatch-agent.rpm", | ||
"ami": "cloudwatch-agent-integration-test-al2*", | ||
"caCertPath": "/etc/ssl/certs/ca-bundle.crt", | ||
"arc": "amd64", | ||
"binaryName": "amazon-cloudwatch-agent.rpm", | ||
"performance_number_of_logs": "10" | ||
}, | ||
{ | ||
"os": "al2", | ||
"username": "ec2-user", | ||
"installAgentCommand": "rpm -U ./amazon-cloudwatch-agent.rpm", | ||
"ami": "cloudwatch-agent-integration-test-al2*", | ||
"caCertPath": "/etc/ssl/certs/ca-bundle.crt", | ||
"arc": "amd64", | ||
"binaryName": "amazon-cloudwatch-agent.rpm", | ||
"performance_number_of_logs": "100" | ||
}, | ||
{ | ||
"os": "al2", | ||
"username": "ec2-user", | ||
"installAgentCommand": "rpm -U ./amazon-cloudwatch-agent.rpm", | ||
"ami": "cloudwatch-agent-integration-test-al2*", | ||
"caCertPath": "/etc/ssl/certs/ca-bundle.crt", | ||
"arc": "amd64", | ||
"binaryName": "amazon-cloudwatch-agent.rpm", | ||
"performance_number_of_logs": "1000" | ||
} | ||
] |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -46,6 +46,7 @@ resource "null_resource" "integration_test" { | |
# Prepare Integration Test | ||
provisioner "remote-exec" { | ||
inline = [ | ||
"echo sha ${var.github_sha}", | ||
"cloud-init status --wait", | ||
"echo clone and install agent", | ||
"git clone ${var.github_repo}", | ||
|
@@ -80,10 +81,11 @@ resource "null_resource" "integration_test" { | |
"export PATH=$PATH:/snap/bin:/usr/local/go/bin", | ||
"echo run integration test", | ||
"cd ~/amazon-cloudwatch-agent", | ||
"go test ./integration/test/sanity -p 1 -v --tags=integration", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @sethAmazon why do we need |
||
"echo run sanity test && go test ./integration/test/sanity -p 1 -v --tags=integration", | ||
"export SHA=${var.github_sha}", | ||
"export SHA_DATE=${var.github_sha_date}", | ||
"go test ${var.test_dir} -p 1 -v --tags=integration" | ||
"export PERFORMANCE_NUMBER_OF_LOGS=${var.performance_number_of_logs}", | ||
"go test ${var.test_dir} -p 1 -timeout 30m -v --tags=integration " | ||
] | ||
connection { | ||
type = "ssh" | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this prints out the perf test matrix twice