Skip to content

Commit 313843f

Browse files
authored
[CI/CD] Add Target Allocator(TA) Build to Build and Upload Workflow (aws#247)
* edited workflow
1 parent b74b110 commit 313843f

File tree

2 files changed

+63
-3
lines changed

2 files changed

+63
-3
lines changed

.github/workflows/build-and-upload-integration.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ on:
77
push:
88
branches:
99
- main
10+
- target-allocator
1011
concurrency:
1112
group: ${{ github.workflow }}-${{ github.ref_name }}
1213
cancel-in-progress: true

.github/workflows/build-and-upload-release.yml

Lines changed: 62 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,9 @@ env:
66
# Use terraform assume role for uploading to ecr
77
AWS_ASSUME_ROLE: ${{ secrets.TERRAFORM_AWS_ASSUME_ROLE }}
88
ECR_OPERATOR_STAGING_REPO: ${{ vars.ECR_OPERATOR_STAGING_REPO }}
9-
ECR_OPERATOR_RELEASE_IMAGE: ${{ secrets.ECR_OPERATOR_RELEASE_IMAGE }}
9+
ECR_TARGET_ALLOCATOR_STAGING_REPO: ${{ vars.ECR_TARGET_ALLOCATOR_STAGING_REPO}}
10+
ECR_OPERATOR_RELEASE_IMAGE: ${{ vars.ECR_TARGET_ALLOCATOR_TEST_OPERATOR_REPO}}
11+
ECR_TARGET_ALLOCATOR_RELEASE_REPO: ${{ vars.ECR_TARGET_ALLOCATOR_RELEASE_REPO}}
1012

1113
on:
1214
workflow_dispatch:
@@ -81,9 +83,60 @@ jobs:
8183
tags: ${{ env.ECR_OPERATOR_STAGING_REPO }}:${{ inputs.tag }}
8284
platforms: linux/amd64, linux/arm64
8385

86+
MakeTABinary:
87+
name: 'MakeTargetAllocatorImage'
88+
runs-on: ubuntu-latest
89+
permissions:
90+
id-token: write
91+
contents: read
92+
steps:
93+
- uses: actions/checkout@v3
94+
with:
95+
fetch-depth: 0
96+
97+
- name: Set up Go 1.x
98+
uses: actions/setup-go@v4
99+
with:
100+
go-version: '>1.22'
101+
cache: true
102+
103+
- name: Configure AWS Credentials
104+
uses: aws-actions/configure-aws-credentials@v2
105+
with:
106+
role-to-assume: ${{ env.AWS_ASSUME_ROLE }}
107+
aws-region: us-west-2
108+
109+
- name: Login to ECR
110+
if: steps.cached_binaries.outputs.cache-hit == false
111+
id: login-ecr
112+
uses: aws-actions/amazon-ecr-login@v1
113+
114+
- name: Set up Docker Buildx
115+
if: steps.cached_binaries.outputs.cache-hit == false
116+
uses: docker/setup-buildx-action@v1
117+
118+
- name: Set up QEMU
119+
if: steps.cached_binaries.outputs.cache-hit == false
120+
uses: docker/setup-qemu-action@v1
121+
122+
- name: Build Binaries
123+
run: |
124+
go mod download
125+
export GOARCH=arm64 && make targetallocator
126+
export GOARCH=amd64 && make targetallocator
127+
- name: Build Cloudwatch Agent Target Allocator Image and push to ECR
128+
uses: docker/build-push-action@v4
129+
if: steps.cached_binaries.outputs.cache-hit == false
130+
with:
131+
file: ./cmd/amazon-cloudwatch-agent-target-allocator/Dockerfile
132+
context: ./cmd/amazon-cloudwatch-agent-target-allocator
133+
push: true
134+
tags: ${{ env.ECR_TARGET_ALLOCATOR_STAGING_REPO }}:${{ inputs.tag }}
135+
platforms: linux/amd64, linux/arm64
136+
84137
e2e-test:
85138
name: "Application Signals E2E Test"
86-
needs: MakeBinary
139+
needs: [MakeBinary,MakeTABinary]
87140
uses: ./.github/workflows/application-signals-e2e-test.yml
88141
secrets: inherit
89142
permissions:
@@ -119,4 +172,10 @@ jobs:
119172
run: |
120173
docker buildx imagetools create \
121174
-t ${{ env.ECR_OPERATOR_RELEASE_IMAGE }} \
122-
${{ env.ECR_OPERATOR_STAGING_REPO }}:${{ inputs.tag }}
175+
${{ env.ECR_OPERATOR_STAGING_REPO }}:${{ inputs.tag }}
176+
177+
- name: Push image to TA release ECR
178+
run: |
179+
docker buildx imagetools create \
180+
-t ${{ env.ECR_TARGET_ALLOCATOR_RELEASE_REPO}} \
181+
${{ env.ECR_TARGET_ALLOCATOR_STAGING_REPO }}:${{ inputs.tag }}

0 commit comments

Comments
 (0)