-
Notifications
You must be signed in to change notification settings - Fork 28
Adding branch option to operator build workflow. #270
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
Merged
+213
−160
Merged
Changes from 8 commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
cb227c9
added new build
okankoAMZ c5f5457
added test flag
okankoAMZ e030329
refractoring
okankoAMZ 9a12488
removed unnecessary files
okankoAMZ c189f0f
addressed commnets
okankoAMZ 0013765
added second tag
okankoAMZ 49ae934
added region input
okankoAMZ 19a8a9f
Update .github/workflows/build-and-upload.yml
okankoAMZ b97e960
added tags
okankoAMZ baf4aec
merge main
okankoAMZ 5f8f49a
Update .github/workflows/build-and-upload-release.yml
okankoAMZ d92505a
Update .github/workflows/build-and-upload.yml
okankoAMZ 9e51f0d
Update .github/workflows/build-and-upload.yml
okankoAMZ b7e4dfd
Update .github/workflows/build-and-upload.yml
okankoAMZ 992deb7
Update .github/workflows/build-and-upload.yml
okankoAMZ ec73311
Merge branch 'main' into e2e-testing
okankoAMZ d96d913
moved env
okankoAMZ File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,132 @@ | ||
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
name: Build And Upload Artifact for Branch | ||
env: | ||
# Use terraform assume role for uploading to ecr | ||
AWS_ASSUME_ROLE: ${{ secrets.TERRAFORM_AWS_ASSUME_ROLE }} | ||
ECR_OPERATOR_STAGING_REPO: ${{ vars.ECR_OPERATOR_STAGING_REPO }} | ||
ECR_OPERATOR_RELEASE_IMAGE: ${{ vars.ECR_OPERATOR_RELEASE_IMAGE }} | ||
|
||
on: | ||
workflow_call: | ||
inputs: | ||
release: | ||
description: 'Release Artifact' | ||
required: false | ||
default: false | ||
type: boolean | ||
tag: | ||
description: 'Staging Artifact Tag' | ||
required: false | ||
default: 'integration' | ||
type: string | ||
target-sha: | ||
default: ${{ github.sha}} | ||
type: string | ||
repository: | ||
default: ${{ github.repository }} | ||
type: string | ||
test-image-before-upload: | ||
description: "Run Test on the new container image" | ||
default: true | ||
type: boolean | ||
region: | ||
description: "AWS Region to run the build/test on" | ||
default: "us-west-2" | ||
type: string | ||
|
||
|
||
jobs: | ||
MakeBinary: | ||
name: 'MakeContainerImage' | ||
runs-on: ubuntu-latest | ||
permissions: | ||
id-token: write | ||
contents: read | ||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
ref: ${{ inputs.target-sha }} | ||
repository: ${{inputs.repository}} | ||
|
||
|
||
- name: Set up Go 1.x | ||
uses: actions/setup-go@v4 | ||
with: | ||
go-version: ~1.19.6 | ||
cache: false | ||
|
||
- name: Configure AWS Credentials | ||
uses: aws-actions/configure-aws-credentials@v2 | ||
with: | ||
role-to-assume: ${{ env.AWS_ASSUME_ROLE }} | ||
aws-region: ${{inputs.region}} | ||
|
||
- name: Login to ECR | ||
if: steps.cached_binaries.outputs.cache-hit == false | ||
id: login-ecr | ||
uses: aws-actions/amazon-ecr-login@v1 | ||
|
||
- name: Set up Docker Buildx | ||
if: steps.cached_binaries.outputs.cache-hit == false | ||
uses: docker/setup-buildx-action@v1 | ||
|
||
- name: Set up QEMU | ||
if: steps.cached_binaries.outputs.cache-hit == false | ||
uses: docker/setup-qemu-action@v1 | ||
|
||
- name: Build Cloudwatch Agent Operator Image and push to ECR | ||
uses: docker/build-push-action@v4 | ||
if: steps.cached_binaries.outputs.cache-hit == false | ||
with: | ||
file: ./Dockerfile | ||
context: . | ||
push: true | ||
platforms: linux/amd64, linux/arm64 | ||
tags: | | ||
${{ env.ECR_OPERATOR_STAGING_REPO }}:${{ inputs.tag }} | ||
${{ env.ECR_OPERATOR_STAGING_REPO }}:${{ inputs.target-sha }} | ||
|
||
|
||
e2e-test: | ||
if: ${{inputs.test-image-before-upload}} | ||
name: "Application Signals E2E Test" | ||
needs: MakeBinary | ||
uses: ./.github/workflows/application-signals-e2e-test.yml | ||
secrets: inherit | ||
permissions: | ||
id-token: write | ||
contents: read | ||
with: | ||
tag: ${{ inputs.tag }} | ||
|
||
push-release-ecr: | ||
if: ${{ inputs.release }} | ||
needs: e2e-test | ||
okankoAMZ marked this conversation as resolved.
Show resolved
Hide resolved
|
||
permissions: | ||
id-token: write | ||
contents: read | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Set up QEMU | ||
uses: docker/setup-qemu-action@v3 | ||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
|
||
- name: Configure AWS Credentials | ||
uses: aws-actions/configure-aws-credentials@v2 | ||
with: | ||
role-to-assume: ${{ env.AWS_ASSUME_ROLE }} | ||
aws-region: ${{inputs.region}} | ||
|
||
- name: Login ECR | ||
id: login-ecr | ||
uses: aws-actions/amazon-ecr-login@v1 | ||
|
||
- name: Push image to release ECR | ||
run: | | ||
docker buildx imagetools create \ | ||
-t ${{ env.ECR_OPERATOR_RELEASE_IMAGE }} \ | ||
${{ env.ECR_OPERATOR_STAGING_REPO }}:${{ inputs.tag }} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.