.
Some checks failed
Test Deploy to OCI Registry / deploy (push) Failing after 3m34s

This commit is contained in:
Mrrp 2025-03-06 16:13:20 -08:00
parent f92be24b17
commit 924bc279d9
3 changed files with 56 additions and 91 deletions

View file

@ -28,13 +28,23 @@ inputs:
required: true
default: ${{ github.repository_owner }}
env:
VALID_ARCHITECTURES: 'amd64 arm64'
VALID_ARCHITECTURES: 'amd64,arm64'
runs:
using: "composite"
steps:
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Install Docker
id: install-docker-quick
shell: bash
run: |
echo "🐋 Installing Docker..."
curl -fsSL https://get.docker.com | sh
echo "✅ Docker installed"
docker --version
- name: Set up Docker Buildx
id: setup-buildx
uses: docker/setup-buildx-action@v3

View file

@ -4,15 +4,16 @@
# reserve first argument for the environment variable name
ENV_VAR_NAME=$1
# Check if the environment variable is lowercase
for var in "${@:2}"; do
# get the value of the specified environment variable
value=$(eval echo \$$var)
# check if the value is not lowercase
if [[ $value =~ [A-Z] ]]; then
# check if the value is lowercase
if [[ "$value" != "${value,,}" ]]; then
echo "❌ Invalid $ENV_VAR_NAME: $value"
echo " $ENV_VAR_NAME must be lowercase"
exit 1
else
echo "$ENV_VAR_NAME is lowercase: $value"
echo "$ENV_VAR_NAME is valid: $value"
fi
done
done

View file

@ -11,95 +11,49 @@ echo "============================================"
echo "Starting Validation Script"
echo "============================================"
# ---------------------------- Docker Installation --------------------------- #
echo "🔍 Checking Docker installation..."
if docker --version >/dev/null 2>&1; then
DOCKER_VERSION=$(docker --version)
echo "✅ Docker is installed: $DOCKER_VERSION"
else
echo "❌ Docker is not installed."
echo " Please install Docker from: https://docs.docker.com/get-docker/"
exit 1
fi
# ---------------------------- Buildx Installation --------------------------- #
echo "🔍 Checking Docker Buildx installation..."
if docker buildx version >/dev/null 2>&1; then
BUILDX_VERSION=$(docker buildx version)
echo "✅ Docker Buildx is installed: $BUILDX_VERSION"
else
echo "❌ Docker Buildx is not installed."
echo " Please install Docker Buildx. See: https://docs.docker.com/buildx/working-with-buildx/"
exit 1
fi
# ---------------------------- Validate Architectures --------------------------- #
# Architectures are CSV (amd64,arm64)
# Usage: ./ensure_lowercase.sh "Architecture" amd64,arm64
echo "🔍 Validating architectures..."
for arch in $ARCHITECTURES; do
echo "→ Checking architecture: $arch"
if [[ $VALID_ARCHITECTURES != *"$arch"* ]]; then
echo "❌ Invalid architecture detected: $arch"
echo " Allowed architectures are: $VALID_ARCHITECTURES"
for arch in $(echo $ARCHITECTURES | tr "," "\n"); do
# Ensure architecture is lowercase.
if [[ "$arch" != "${arch,,}" ]]; then
echo "❌ Invalid Architecture: $arch"
echo " Architecture must be lowercase"
exit 1
else
echo "✅ Architecture is valid: $arch"
fi
# Ensure architecture is supported by Docker Buildx.
if docker buildx inspect --bootstrap | grep -q $arch; then
echo "✅ Architecture is supported by Docker Buildx: $arch"
else
echo "❌ Architecture is not supported by Docker Buildx: $arch"
echo " Please check the supported platforms: https://docs.docker.com/buildx/working-with-buildx/"
exit 1
fi
done
echo "✅ All specified architectures are valid."
# ---------------------------- Validate Tags --------------------------- #
echo "🔍 Validating tags..."
# Ensure tags are lowercase.
if sh ./ensure_lowercase.sh "Tag" $TAGS; then
echo "✅ All tags are lowercase."
else
echo "❌ One or more tags are not lowercase. Please update the tags."
exit 1
fi
# Ensure tags do not contain spaces.
if sh ./ensure_no_spaces.sh "Tag" $TAGS; then
echo "✅ Tags do not contain spaces."
else
echo "❌ One or more tags contain spaces. Please update the tags."
exit 1
fi
# ---------------------------- Validate Image Name --------------------------- #
if [ "$NAME" != "auto" ]; then
echo "🔍 Validating image name..."
# Ensure image name is lowercase.
if sh ./ensure_lowercase.sh "Name" $NAME; then
echo "✅ Image name is lowercase."
else
echo "❌ Image name is not lowercase. Please update the name."
exit 1
fi
# Ensure image name does not contain spaces.
if sh ./ensure_no_spaces.sh "Name" $NAME; then
echo "✅ Image name does not contain spaces."
else
echo "❌ Image name contains spaces. Please update the name."
exit 1
fi
else
echo " Image name is set to auto-detect."
fi
# ---------------------------- Validate Registry URL --------------------------- #
echo "🔍 Validating Registry URL..."
# Ensure Registry URL does not contain spaces.
if sh ./ensure_no_spaces.sh "Registry URL" $REGISTRY_URL; then
echo "✅ Registry URL does not contain spaces."
else
echo "❌ Registry URL contains spaces. Please update the URL."
exit 1
fi
# Ensure Registry URL is lowercase.
if sh ./ensure_lowercase.sh "Registry URL" $REGISTRY_URL; then
echo "✅ Registry URL is lowercase."
else
echo "❌ Registry URL is not lowercase. Please update the URL."
exit 1
fi
# Ensure Registry URL starts with "https://"
if [[ $REGISTRY_URL != https://* ]]; then
echo "❌ Invalid Registry URL: $REGISTRY_URL"
echo " Registry URL must start with 'https://'"
exit 1
fi
echo "✅ Registry URL starts with 'https://'"
# Check if Registry URL is reachable.
echo "🔍 Checking if Registry URL is reachable..."
if curl -s --head "$REGISTRY_URL" | head -n 1 | grep "HTTP/[12]\.[0-9] [23].." >/dev/null; then
echo "✅ Registry URL is reachable: $REGISTRY_URL"
else
echo "❌ Registry URL is not reachable: $REGISTRY_URL"
echo " Please verify the URL and check your network connection."
exit 1
fi
echo "============================================"
echo "All validations passed successfully!"
echo "============================================"