mirror of
https://github.com/datahub-project/datahub.git
synced 2025-12-28 02:17:53 +00:00
build: support tag computation from branch with slash in name (#13636)
This commit is contained in:
parent
647fb792de
commit
3de438692d
25
.github/scripts/docker_helpers.sh
vendored
25
.github/scripts/docker_helpers.sh
vendored
@ -14,23 +14,25 @@ export SHORT_SHA=$(get_short_sha)
|
||||
echo "SHORT_SHA: $SHORT_SHA"
|
||||
|
||||
function get_tag {
|
||||
echo $(echo ${GITHUB_REF} | sed -e "s,refs/heads/${MAIN_BRANCH},${MAIN_BRANCH_TAG},g" -e 's,refs/tags/,,g' -e 's,refs/heads/,,g' -e 's,refs/pull/\([0-9]*\).*,pr\1,g')
|
||||
echo $(echo ${GITHUB_REF} | sed -e "s,refs/heads/${MAIN_BRANCH},${MAIN_BRANCH_TAG},g" -e 's,refs/tags/,,g' -e 's,refs/heads/,,g' -e 's,refs/heads/,,g' -e 's,refs/pull/\([0-9]*\).*,pr\1,g' -e 's,/,-,g')
|
||||
}
|
||||
|
||||
function get_tag_slim {
|
||||
echo $(echo ${GITHUB_REF} | sed -e "s,refs/heads/${MAIN_BRANCH},${MAIN_BRANCH_TAG}-slim,g" -e 's,refs/tags/\(.*\),\1-slim,g' -e 's,refs/heads/\(.*\),\1-slim,g' -e 's,refs/pull/\([0-9]*\).*,pr\1-slim,g')
|
||||
echo $(echo ${GITHUB_REF} | sed -e "s,refs/heads/${MAIN_BRANCH},${MAIN_BRANCH_TAG}-slim,g" -e 's,refs/tags/\(.*\),\1-slim,g' -e 's,refs/heads/\(.*\),\1-slim,g' -e 's,refs/heads/\(.*\),\1-slim,g' -e 's,refs/pull/\([0-9]*\).*,pr\1-slim,g' -e 's,/,-,g')
|
||||
}
|
||||
|
||||
function get_tag_full {
|
||||
echo $(echo ${GITHUB_REF} | sed -e "s,refs/heads/${MAIN_BRANCH},${MAIN_BRANCH_TAG}-full,g" -e 's,refs/tags/\(.*\),\1-full,g' -e 's,refs/heads/\(.*\),\1-full,g' -e 's,refs/pull/\([0-9]*\).*,pr\1-full,g')
|
||||
echo $(echo ${GITHUB_REF} | sed -e "s,refs/heads/${MAIN_BRANCH},${MAIN_BRANCH_TAG}-full,g" -e 's,refs/tags/\(.*\),\1-full,g' -e 's,refs/heads/\(.*\),\1-full,g' -e 's,refs/heads/\(.*\),\1-full,g' -e 's,refs/pull/\([0-9]*\).*,pr\1-full,g' -e 's,/,-,g')
|
||||
}
|
||||
|
||||
function get_python_docker_release_v() {
|
||||
echo "$(echo "${GITHUB_REF}" | \
|
||||
sed -e "s,refs/heads/${MAIN_BRANCH},1\!0.0.0+docker.${SHORT_SHA},g" \
|
||||
-e 's,refs/heads/\(.*\),1!0.0.0+docker.\1,g' \
|
||||
-e 's,refs/heads/\(.*\),1!0.0.0+docker.\1,g' \
|
||||
-e 's,refs/tags/v\([0-9a-zA-Z.]*\).*,\1+docker,g' \
|
||||
-e 's,refs/pull/\([0-9]*\).*,1!0.0.0+docker.pr\1,g' \
|
||||
-e 's,/,-,g'
|
||||
)"
|
||||
}
|
||||
# To run these, set TEST_DOCKER_HELPERS=1 and then copy the function + test cases into a bash shell.
|
||||
@ -40,6 +42,23 @@ if [ ${TEST_DOCKER_HELPERS:-0} -eq 1 ]; then
|
||||
GITHUB_REF="refs/tags/v0.1.2.1-test" get_python_docker_release_v # '0.1.2.1'
|
||||
GITHUB_REF="refs/tags/v0.1.2rc1-test" get_python_docker_release_v # '0.1.2rc1'
|
||||
GITHUB_REF="refs/heads/branch-name" get_python_docker_release_v # '1!0.0.0+docker.branch-name'
|
||||
GITHUB_REF="refs/heads/releases/branch-name" get_python_docker_release_v # 1!0.0.0+docker.releases-branch-name'
|
||||
|
||||
GITHUB_REF="refs/tags/v0.1.2rc1" get_tag # '0.1.2rc1'
|
||||
GITHUB_REF="refs/tags/v0.1.2rc1" get_tag_slim # '0.1.2rc1-slim'
|
||||
GITHUB_REF="refs/tags/v0.1.2rc1" get_tag_full # '0.1.2rc1-full'
|
||||
|
||||
GITHUB_REF="refs/pull/4788/merge" get_tag # 'pr4788'
|
||||
GITHUB_REF="refs/pull/4788/merge" get_tag_slim # 'pr4788-slim'
|
||||
GITHUB_REF="refs/pull/4788/merge" get_tag_full # 'pr4788-full'
|
||||
|
||||
GITHUB_REF="refs/heads/branch-name" get_tag # 'branch-name'
|
||||
GITHUB_REF="refs/heads/branch-name" get_tag_slim # 'branch-name-slim'
|
||||
GITHUB_REF="refs/heads/branch-name" get_tag_full # 'branch-name-full'
|
||||
|
||||
GITHUB_REF="refs/heads/releases/branch-name" get_tag # 'releases-branch-name'
|
||||
GITHUB_REF="refs/heads/releases/branch-name" get_tag_slim # 'releases-branch-name-slim'
|
||||
GITHUB_REF="refs/heads/releases/branch-name" get_tag_full # 'releases-branch-name-full'
|
||||
fi
|
||||
|
||||
function get_unique_tag {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user