ci(docker): resolve registry package identity
This commit is contained in:
@@ -5,6 +5,8 @@ KEEP_COUNT="${REGISTRY_PACKAGE_KEEP_COUNT:-3}"
|
||||
API_BASE_URL="${REGISTRY_API_BASE_URL:-https://gitea.banlv-ai.com/api/v1}"
|
||||
TOKEN="${REGISTRY_PACKAGE_TOKEN:-}"
|
||||
REGISTRY_IMAGE="${REGISTRY_IMAGE:-${IMAGE:-}}"
|
||||
REGISTRY_PACKAGE_OWNER="${REGISTRY_PACKAGE_OWNER:-}"
|
||||
REGISTRY_PACKAGE_NAME="${REGISTRY_PACKAGE_NAME:-}"
|
||||
DEPLOY_ENV="${DEPLOY_ENV:-}"
|
||||
CURRENT_IMAGE_TAG="${IMAGE_VERSION_TAG:-}"
|
||||
|
||||
@@ -38,11 +40,23 @@ fi
|
||||
|
||||
image_without_tag="${REGISTRY_IMAGE%%:*}"
|
||||
path_without_registry="${image_without_tag#*/}"
|
||||
owner="${path_without_registry%%/*}"
|
||||
package="${path_without_registry#*/}"
|
||||
parsed_owner=""
|
||||
parsed_package="$path_without_registry"
|
||||
if [ "$path_without_registry" != "$image_without_tag" ] && [ "$path_without_registry" != "${path_without_registry#*/}" ]; then
|
||||
parsed_owner="${path_without_registry%%/*}"
|
||||
parsed_package="${path_without_registry#*/}"
|
||||
fi
|
||||
|
||||
if [ "$owner" = "$path_without_registry" ] || [ -z "$owner" ] || [ -z "$package" ]; then
|
||||
echo "Could not parse owner/package from REGISTRY_IMAGE: $REGISTRY_IMAGE" >&2
|
||||
repository_owner="${GITHUB_REPOSITORY_OWNER:-}"
|
||||
if [ -z "$repository_owner" ] && [ -n "${GITHUB_REPOSITORY:-}" ]; then
|
||||
repository_owner="${GITHUB_REPOSITORY%%/*}"
|
||||
fi
|
||||
|
||||
owner="${REGISTRY_PACKAGE_OWNER:-${parsed_owner:-$repository_owner}}"
|
||||
package="${REGISTRY_PACKAGE_NAME:-$parsed_package}"
|
||||
|
||||
if [ -z "$owner" ] || [ -z "$package" ]; then
|
||||
echo "Could not resolve registry package owner/name. Set REGISTRY_PACKAGE_OWNER and REGISTRY_PACKAGE_NAME." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
||||
Reference in New Issue
Block a user