Skip to content

Use custom tag prefix in linux_job_v2 #6559

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

Closed
wants to merge 4 commits into from
Closed
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
9 changes: 7 additions & 2 deletions .github/actions/calculate-docker-image/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ inputs:
default: ./build.sh
custom-tag-prefix:
description: |
The prefix to use for the docker image tag.
The prefix to use for the docker image tag. You can also just do imagename:customtag
default: ""
working-directory:
description: The working directory where the repo is checked out.
Expand Down Expand Up @@ -81,9 +81,14 @@ runs:
echo "docker-tag=${DOCKER_TAG}" >> "${GITHUB_OUTPUT}"
echo "docker-image=${DOCKER_IMAGE_NAME}" >> "${GITHUB_OUTPUT}"
else
if [[ "${DOCKER_IMAGE_NAME}" == *:* ]]; then
CUSTOM_TAG_PREFIX=${DOCKER_IMAGE_NAME#*:}
DOCKER_IMAGE_NAME=${DOCKER_IMAGE_NAME%%:*}
fi
DOCKER_TAG=${CUSTOM_TAG_PREFIX:+${CUSTOM_TAG_PREFIX}-}$(git rev-parse HEAD:"${DOCKER_BUILD_DIR}")
echo "docker-tag=${DOCKER_TAG}" >> "${GITHUB_OUTPUT}"
echo "docker-image=${DOCKER_REGISTRY}/${REPO_NAME}/${DOCKER_IMAGE_NAME}:${DOCKER_TAG}" >> "${GITHUB_OUTPUT}"
echo "custom-tag-prefix=${CUSTOM_TAG_PREFIX}" >> "${GITHUB_OUTPUT}"
fi

- name: Check if image should be built
Expand Down Expand Up @@ -196,7 +201,7 @@ runs:
env:
REPO_NAME: ${{ github.event.repository.name }}
DOCKER_IMAGE: ${{ steps.calculate-image.outputs.docker-image }}
CUSTOM_TAG_PREFIX: ${{ inputs.custom-tag-prefix }}
CUSTOM_TAG_PREFIX: ${{ steps.calculate-image.outputs.custom-tag-prefix }}
DOCKER_REGISTRY: ${{ inputs.docker-registry }}
WORKING_DIRECTORY: ${{ inputs.working-directory }}/${{ inputs.docker-build-dir }}
DOCKER_BUILD_SCRIPT: ${{ inputs.docker-build-script }}
Expand Down