From a65ebfbafa957cd8ff3564491478bb8c7423dad4 Mon Sep 17 00:00:00 2001 From: Phil Owen <19691521+PhillipsOwen@users.noreply.github.com> Date: Tue, 25 Jul 2023 11:25:19 -0400 Subject: [PATCH 1/2] updates to handle pushing container images to AWS/ECR --- .github/workflows/aws-ecr-load.yml | 47 ++++++++++++++++++++++++++++++ .github/workflows/image-push.yml | 11 +++++++ 2 files changed, 58 insertions(+) create mode 100644 .github/workflows/aws-ecr-load.yml diff --git a/.github/workflows/aws-ecr-load.yml b/.github/workflows/aws-ecr-load.yml new file mode 100644 index 0000000..8ba5fb4 --- /dev/null +++ b/.github/workflows/aws-ecr-load.yml @@ -0,0 +1,47 @@ +# SPDX-FileCopyrightText: 2022 Renaissance Computing Institute. All rights reserved. +# SPDX-FileCopyrightText: 2023 Renaissance Computing Institute. All rights reserved. +# +# SPDX-License-Identifier: GPL-3.0-or-later +# SPDX-License-Identifier: LicenseRef-RENCI +# SPDX-License-Identifier: MIT + +name: Publish an input docker image to the AWS ECR with the version specified + +on: + workflow_dispatch: + inputs: + in_container: + description: "this is the name of the input image (image:version)" + required: true + version: + description: "this is the image version (only) that will be used in AWS/ECR" + required: true + +# job definition +jobs: + Build-and-publish-image: + runs-on: ubuntu-latest + permissions: + contents: read + + # job steps + steps: + # pull the docker image, latest is presumed + - name: pull the docker image + id: pull-it + run: docker pull containers.renci.org/eds/${{ github.event.inputs.in_container }} + + # list the images for confirmation + - name: list images 1 + run: docker images + + # push the image to AWS/ECR + - name: Push to ECR + id: ecr + uses: jwalton/gh-ecr-push@v1 + with: + access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} + secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} + region: us-east-2 + local-image: containers.renci.org/eds/${{ github.event.inputs.in_container }} + image: ${{ github.event.inputs.in_container }}, ${{ github.event.inputs.in_container }}:${{ github.event.inputs.version }} diff --git a/.github/workflows/image-push.yml b/.github/workflows/image-push.yml index 1204cf3..84a511e 100644 --- a/.github/workflows/image-push.yml +++ b/.github/workflows/image-push.yml @@ -45,3 +45,14 @@ jobs: tags: | ${{ env.REGISTRY }}:latest ${{ env.REGISTRY }}:${{ steps.get_version.outputs.VERSION }} + + # push the image to AWS/ECR + - name: Push the built image to the AWS/ECR registry + id: ecr + uses: jwalton/gh-ecr-push@v1 + with: + access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} + secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} + region: us-east-2 + local-image: ${{ env.REGISTRY }}:${{ steps.get_version.outputs.VERSION }} + image: load_geoserver:latest, load_geoserver:${{ steps.get_version.outputs.VERSION }} \ No newline at end of file From 23ff5339c449f0783323a6c2864e19960497de57 Mon Sep 17 00:00:00 2001 From: Phil Owen <19691521+PhillipsOwen@users.noreply.github.com> Date: Tue, 25 Jul 2023 16:04:52 -0400 Subject: [PATCH 2/2] Fixing comments --- .github/workflows/aws-ecr-load.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/aws-ecr-load.yml b/.github/workflows/aws-ecr-load.yml index 8ba5fb4..f08e29e 100644 --- a/.github/workflows/aws-ecr-load.yml +++ b/.github/workflows/aws-ecr-load.yml @@ -11,10 +11,10 @@ on: workflow_dispatch: inputs: in_container: - description: "this is the name of the input image (image:version)" + description: "The name of the input image name (:latest presumed)" required: true version: - description: "this is the image version (only) that will be used in AWS/ECR" + description: "The image version that will be the image tag in AWS/ECR" required: true # job definition