Skip to content

Commit

Permalink
Optimize base image acquisition on main
Browse files Browse the repository at this point in the history
  • Loading branch information
jdisanti committed Feb 3, 2023
1 parent 13651d6 commit e273b37
Showing 1 changed file with 13 additions and 14 deletions.
27 changes: 13 additions & 14 deletions .github/workflows/ci-main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,33 +19,32 @@ env:
ecr_repository: public.ecr.aws/w0m4q9l7/github-awslabs-smithy-rs-ci

jobs:
# Rebuild and upload the Docker build image
rebuild-docker-build-image:
# Build and upload the Docker build image if necessary
acquire-base-image:
runs-on: smithy_ubuntu-latest_8-core
name: Rebuild image
name: Acquire Base Image
permissions:
id-token: write
contents: read
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Build image
run: |
IMAGE_TAG="$(./.github/scripts/docker-image-hash)"
cd tools/ci-build
docker build \
-t "${{ env.ecr_repository }}:${IMAGE_TAG}" \
-t "${{ env.ecr_repository }}:main" \
.
- name: Acquire base image
id: acquire
env:
DOCKER_BUILDKIT: 1
run: ./.github/scripts/acquire-build-image
- name: Acquire credentials
uses: aws-actions/configure-aws-credentials@v1-node16
with:
role-to-assume: ${{ secrets.SMITHY_RS_PUBLIC_ECR_PUSH_ROLE_ARN }}
role-session-name: GitHubActions
aws-region: us-west-2
- name: Upload image
- name: Tag and upload image
run: |
IMAGE_TAG="$(./.github/scripts/docker-image-hash)"
docker tag "${{ env.ecr_repository }}:${IMAGE_TAG}" "${{ env.ecr_repository }}:main"
aws ecr-public get-login-password --region us-east-1 | docker login --username AWS --password-stdin public.ecr.aws
docker push "${{ env.ecr_repository }}:${IMAGE_TAG}"
docker push "${{ env.ecr_repository }}:main"
Expand All @@ -59,10 +58,10 @@ jobs:
# Run the shared CI after a Docker build image has been uploaded to ECR
ci:
needs: rebuild-docker-build-image
needs: acquire-base-image
uses: ./.github/workflows/ci.yml
with:
run_sdk_examples: true
secrets:
ENCRYPTED_DOCKER_PASSWORD: ${{ needs.rebuild-docker-build-image.outputs.docker-login-password }}
ENCRYPTED_DOCKER_PASSWORD: ${{ needs.acquire-base-image.outputs.docker-login-password }}
DOCKER_LOGIN_TOKEN_PASSPHRASE: ${{ secrets.DOCKER_LOGIN_TOKEN_PASSPHRASE }}

0 comments on commit e273b37

Please sign in to comment.