Skip to content
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

Allow image tag override for docker images #53

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 18 additions & 4 deletions .github/workflows/build-docker-images.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ on:
"ecr_repository_name": "${{ github.event.repository.name }}"
}
]
image_tag_override:
type: string
default: ""
required: false
pr_open:
type: boolean
default: true
Expand Down Expand Up @@ -96,14 +100,24 @@ jobs:
timeout-minutes: 1
uses: aws-actions/amazon-ecr-login@v2

- name: Set IMAGE_TAG with override if set
id: set_image_tag
run: |
if [[ -z "${{ inputs.image_tag_override }}" ]]; then
echo "IMAGE_TAG=${{ steps.github-commit-details.outputs.date }}-${{ steps.github-commit-details.outputs.sha_short }}" >> $GITHUB_OUTPUT
else
echo "IMAGE_TAG=${{ inputs.image_tag_override }}" >> $GITHUB_OUTPUT
fi
timeout-minutes: 1

- name: Build, tag and push image to US
uses: docker/build-push-action@v5
if: github.ref != 'refs/heads/master'
timeout-minutes: 30
env:
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }}
ECR_REPOSITORY_NAME: ${{ matrix.ecr_repository_name }}
IMAGE_TAG: ${{ steps.github-commit-details.outputs.date }}-${{ steps.github-commit-details.outputs.sha_short }}
IMAGE_TAG: ${{ steps.set_image_tag.outputs.IMAGE_TAG }}
DOCKER_BUILDKIT: 1
BUILDKIT_PROGRESS: plain
with:
Expand Down Expand Up @@ -135,7 +149,7 @@ jobs:
env:
ECR_REGISTRY: ${{ steps.login-ecr-eu.outputs.registry }}
ECR_REPOSITORY_NAME: ${{ matrix.ecr_repository_name }}
IMAGE_TAG: ${{ steps.github-commit-details.outputs.date }}-${{ steps.github-commit-details.outputs.sha_short }}
IMAGE_TAG: ${{ steps.set_image_tag.outputs.IMAGE_TAG }}
DOCKER_BUILDKIT: 1
BUILDKIT_PROGRESS: plain
with:
Expand Down Expand Up @@ -166,7 +180,7 @@ jobs:
env:
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }}
ECR_REPOSITORY_NAME: ${{ matrix.ecr_repository_name }}
IMAGE_TAG: ${{ steps.github-commit-details.outputs.date }}-${{ steps.github-commit-details.outputs.sha_short }}
IMAGE_TAG: ${{ steps.set_image_tag.outputs.IMAGE_TAG }}
DOCKER_BUILDKIT: 1
BUILDKIT_PROGRESS: plain
with:
Expand Down Expand Up @@ -199,7 +213,7 @@ jobs:
env:
ECR_REGISTRY: ${{ steps.login-ecr-eu.outputs.registry }}
ECR_REPOSITORY_NAME: ${{ matrix.ecr_repository_name }}
IMAGE_TAG: ${{ steps.github-commit-details.outputs.date }}-${{ steps.github-commit-details.outputs.sha_short }}
IMAGE_TAG: ${{ steps.set_image_tag.outputs.IMAGE_TAG }}
DOCKER_BUILDKIT: 1
BUILDKIT_PROGRESS: plain
with:
Expand Down