Skip to content

Commit

Permalink
Restrcture and cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
okankoAMZ committed Oct 16, 2023
1 parent b0b34bd commit 2017a3f
Show file tree
Hide file tree
Showing 15 changed files with 880 additions and 746 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/goVendorCache.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ on:
- uniform-build-env
jobs:
cache:
name: Go mod cache
name: Caching Go Mod files
runs-on: ubuntu-latest
permissions:
id-token: write
Expand Down
39 changes: 38 additions & 1 deletion .github/workflows/integration-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ env:
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"
BUILD_BUCKET_KEY: "integration-test/binary/${{ github.sha }}"
PACKAGE_BUCKET_KEY: "integration-test/packaging/${{ github.sha }}"

on:
push:
Expand Down Expand Up @@ -47,10 +49,45 @@ jobs:
id-token: write
contents: read
with:
# cant use env vars here because of https://github.com/actions/runner/issues/1189#issuecomment-1741672276
ContainerRepositoryNameAndTag: "cwagent-integration-test:${{ github.sha }}"
BucketKey: "integration-test/binary/${{ github.sha }}"
BucketKey: "integration-test/binary/${{ github.sha }}"
PackageBucketKey: "integration-test/packaging/${{ github.sha }}"

BinaryBenchmarkTest:
name: BinaryBenchmarkTest
needs: [ BuildAndUpload ]
permissions:
id-token: write
contents: read
strategy:
matrix:
os: [ ubuntu-latest,windows-latest,macos-latest ]
include:
- os: ubuntu-latest
installationScript: time sudo dpkg -i -E ./amazon-cloudwatch-agent.deb
- os: windows-latest
installationScript: Measure-Command { Start-Process msiexec "/i ./amazon-cloudwatch-agent.msi /norestart " }
- os: macos-latest
installationScript: time sudo installer -pkg ./amazon-cloudwatch-agent.pkg -target /
runs-on: ${{ matrix.os }}
steps:
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v2
with:
role-to-assume: ${{ secrets.TERRAFORM_AWS_ASSUME_ROLE }}
aws-region: us-west-2
- name: Download RPM
run: |
aws s3 cp s3://${{ secrets.S3_INTEGRATION_BUCKET }}/${{ env.BUILD_BUCKET_KEY }}/linux/amd64/amazon-cloudwatch-agent.deb .
aws s3 cp s3://${{ secrets.S3_INTEGRATION_BUCKET }}/${{ env.PACKAGE_BUCKET_KEY }}/amd64/amazon-cloudwatch-agent.pkg .
aws s3 cp s3://${{ secrets.S3_INTEGRATION_BUCKET }}/${{ env.PACKAGE_BUCKET_KEY }}/amazon-cloudwatch-agent.msi .
- name: GetRPMSize
if: matrix.os == 'ubuntu-latest'
run: ls -lh
- name: Measure Installation Time
run: ${{matrix.installationScript}}
GenerateTestMatrix:
name: 'GenerateTestMatrix'
runs-on: ubuntu-latest
Expand Down
80 changes: 51 additions & 29 deletions .github/workflows/test-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -109,41 +109,60 @@ jobs:
with:
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
passphrase: ${{ secrets.PASSPHRASE }}
BinaryBenchmarkTest:
name: BinaryBenchmarkTest
needs: [ MakeBinary ]
DockerBuild:
name: "Build Docker Container"
runs-on: ubuntu-latest
needs: [MakeBinary]
permissions:
id-token: write
contents: read
strategy:
matrix:
os: [ubuntu-latest,windows-latest,macos-latest]
include:
- os: ubuntu-latest
installationScript: time sudo dpkg -i -E ./amazon-cloudwatch-agent.deb
- os: windows-latest
installationScript: Measure-Command { Start-Process msiexec "/i ./amazon-cloudwatch-agent.msi /norestart " }
- os: macos-latest
installationScript: time sudo installer -pkg ./amazon-cloudwatch-agent.pkg -target /
runs-on: ${{ matrix.os }}
steps:
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v2
with:
role-to-assume: ${{ secrets.TERRAFORM_AWS_ASSUME_ROLE }}
aws-region: us-west-2
- name: Download RPM
run: |
aws s3 cp s3://${{ secrets.S3_INTEGRATION_BUCKET }}/${{ inputs.BucketKey }}/linux/amd64/amazon-cloudwatch-agent.deb .
aws s3 cp s3://${{ secrets.S3_INTEGRATION_BUCKET }}/${{ inputs.PackageBucketKey }}/amd64/amazon-cloudwatch-agent.pkg .
aws s3 cp s3://${{ secrets.S3_INTEGRATION_BUCKET }}/${{ inputs.PackageBucketKey }}/amazon-cloudwatch-agent.msi .
- uses: actions/checkout@v3

- name: GetRPMSize
if: matrix.os == 'ubuntu-latest'
run: ls -lh
- name: Measure Installation Time
run : ${{matrix.installationScript}}
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v2
with:
role-to-assume: ${{ secrets.TERRAFORM_AWS_ASSUME_ROLE }}
aws-region: us-west-2

- name: Download from s3
if: contains(inputs.BucketKey, 'test') == false || steps.cached_sig.outputs.cache-hit == false
run: |
mkdir -p packages/amd64
mkdir packages/arm64
aws s3 cp s3://${{ secrets.S3_INTEGRATION_BUCKET }}/${{ inputs.PackageBucketKey }}/amazon-cloudwatch-agent.msi ./packages/amazon-cloudwatch-agent.msi
aws s3 cp s3://${{ secrets.S3_INTEGRATION_BUCKET }}/${{ inputs.PackageBucketKey }}/amd64/amazon-cloudwatch-agent.pkg ./packages/amd64/amazon-cloudwatch-agent.pkg
aws s3 cp s3://${{ secrets.S3_INTEGRATION_BUCKET }}/${{ inputs.PackageBucketKey }}/arm64/amazon-cloudwatch-agent.pkg ./packages/arm64/amazon-cloudwatch-agent.pkg
- name: Login ECR
if: contains(inputs.BucketKey, 'test') == false || steps.cached_binaries.outputs.cache-hit == false
id: login-ecr
uses: aws-actions/amazon-ecr-login@v1

- name: Set up Docker Buildx
if: contains(inputs.BucketKey, 'test') == false || steps.cached_binaries.outputs.cache-hit == false
uses: docker/setup-buildx-action@v1

- name: Set up QEMU
if: contains(inputs.BucketKey, 'test') == false || steps.cached_binaries.outputs.cache-hit == false
uses: docker/setup-qemu-action@v1

# Build dir is ignored in our .dockerignore thus need to copy to another dir.
- name: Copy Binary For Agent Image Build
if: contains(inputs.BucketKey, 'test') == false || steps.cached_binaries.outputs.cache-hit == false
run: cp -r build/bin/linux/* .

- name: Build Cloudwatch Agent Image
uses: docker/build-push-action@v4
if: contains(inputs.BucketKey, 'test') == false || steps.cached_binaries.outputs.cache-hit == false
with:
file: amazon-cloudwatch-container-insights/cloudwatch-agent-dockerfile/localdeb/Dockerfile
context: .
push: true
tags: |
${{ steps.login-ecr.outputs.registry }}/${{ inputs.ContainerRepositoryNameAndTag }}
platforms: linux/amd64, linux/arm64
# #GH actions set up gpg only works on ubuntu as of this commit date
GPGSignMacAndWindowsPackage:
name: 'SignMacAndWindowsPackage'
Expand Down Expand Up @@ -191,3 +210,6 @@ jobs:
aws s3 cp packages/amazon-cloudwatch-agent.msi.sig s3://${{ secrets.S3_INTEGRATION_BUCKET }}/${{ inputs.PackageBucketKey }}/amazon-cloudwatch-agent.msi.sig
aws s3 cp packages/amd64/amazon-cloudwatch-agent.pkg.sig s3://${{ secrets.S3_INTEGRATION_BUCKET }}/${{ inputs.PackageBucketKey }}/amd64/amazon-cloudwatch-agent.pkg.sig
aws s3 cp packages/arm64/amazon-cloudwatch-agent.pkg.sig s3://${{ secrets.S3_INTEGRATION_BUCKET }}/${{ inputs.PackageBucketKey }}/arm64/amazon-cloudwatch-agent.pkg.sig
Loading

0 comments on commit 2017a3f

Please sign in to comment.