Ensure valid Docker Hub namespace in release workflow
All checks were successful
Container CVE Scan (development) / Scan backend/frontend images for CVEs (push) Successful in 2m44s
PostgreSQL Compatibility Matrix / PG14 smoke (push) Successful in 7s
PostgreSQL Compatibility Matrix / PG15 smoke (push) Successful in 8s
PostgreSQL Compatibility Matrix / PG16 smoke (push) Successful in 8s
PostgreSQL Compatibility Matrix / PG17 smoke (push) Successful in 8s
PostgreSQL Compatibility Matrix / PG18 smoke (push) Successful in 8s
All checks were successful
Container CVE Scan (development) / Scan backend/frontend images for CVEs (push) Successful in 2m44s
PostgreSQL Compatibility Matrix / PG14 smoke (push) Successful in 7s
PostgreSQL Compatibility Matrix / PG15 smoke (push) Successful in 8s
PostgreSQL Compatibility Matrix / PG16 smoke (push) Successful in 8s
PostgreSQL Compatibility Matrix / PG17 smoke (push) Successful in 8s
PostgreSQL Compatibility Matrix / PG18 smoke (push) Successful in 8s
Added validation to normalize input, reject invalid namespaces, and check for proper formatting in the Docker Hub namespace. This prevents configuration mistakes and ensures compliance with naming requirements.
This commit is contained in:
20
.github/workflows/docker-release.yml
vendored
20
.github/workflows/docker-release.yml
vendored
@@ -51,10 +51,28 @@ jobs:
|
||||
if [ -z "$NS" ]; then
|
||||
NS="${{ secrets.DOCKERHUB_USERNAME }}"
|
||||
fi
|
||||
if [ -z "$NS" ]; then
|
||||
|
||||
# Normalize accidental input like spaces or uppercase.
|
||||
NS="$(echo "$NS" | tr '[:upper:]' '[:lower:]' | xargs)"
|
||||
|
||||
# Reject clearly invalid placeholders/config mistakes early.
|
||||
if [ -z "$NS" ] || [ "$NS" = "-" ]; then
|
||||
echo "Missing Docker Hub namespace. Set repo var DOCKERHUB_NAMESPACE or secret DOCKERHUB_USERNAME."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Namespace must be a single Docker Hub account/org name, not a path/url.
|
||||
if [[ "$NS" == *"/"* ]] || [[ "$NS" == *":"* ]]; then
|
||||
echo "Invalid Docker Hub namespace '$NS'. Use only the account/org name (e.g. 'nesterovicit')."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if ! [[ "$NS" =~ ^[a-z0-9]+([._-][a-z0-9]+)*$ ]]; then
|
||||
echo "Invalid Docker Hub namespace '$NS'. Allowed: lowercase letters, digits, ., _, -"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "Using Docker Hub namespace: $NS"
|
||||
echo "value=$NS" >> "$GITHUB_OUTPUT"
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
|
||||
Reference in New Issue
Block a user