mirror of
https://github.com/Frooodle/Stirling-PDF.git
synced 2025-09-08 17:51:20 +02:00
Update test.sh
This commit is contained in:
parent
84e73a4431
commit
7c80a63c35
@ -169,21 +169,19 @@ compare_file_lists() {
|
|||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Get the expected version from Gradle once
|
||||||
|
get_expected_version() {
|
||||||
|
./gradlew printVersion --quiet | tail -1
|
||||||
|
}
|
||||||
|
|
||||||
# Function to verify the application version
|
# Function to verify the application version
|
||||||
verify_app_version() {
|
verify_app_version() {
|
||||||
local service_name=$1
|
local service_name=$1
|
||||||
local base_url=$2
|
local base_url=$2
|
||||||
local expected_version
|
|
||||||
|
|
||||||
# Get the expected version from Gradle
|
echo "Checking version for $service_name (expecting $EXPECTED_VERSION)..."
|
||||||
expected_version=$(./gradlew printVersion --quiet | tail -1)
|
|
||||||
echo "Expected version from Gradle: $expected_version"
|
|
||||||
|
|
||||||
# Give the application a moment to fully initialize
|
|
||||||
sleep 5
|
|
||||||
|
|
||||||
# Try to access the homepage and extract the version
|
# Try to access the homepage and extract the version
|
||||||
echo "Checking if version is correctly displayed in the application..."
|
|
||||||
local response
|
local response
|
||||||
response=$(curl -s "$base_url")
|
response=$(curl -s "$base_url")
|
||||||
|
|
||||||
@ -193,26 +191,24 @@ verify_app_version() {
|
|||||||
|
|
||||||
# If we couldn't find the version in the pixel tag, try other approaches
|
# If we couldn't find the version in the pixel tag, try other approaches
|
||||||
if [ -z "$actual_version" ]; then
|
if [ -z "$actual_version" ]; then
|
||||||
echo "Could not find version in version tag, trying other methods..."
|
|
||||||
|
|
||||||
# Check for "App Version:" format
|
# Check for "App Version:" format
|
||||||
if echo "$response" | grep -q "App Version:"; then
|
if echo "$response" | grep -q "App Version:"; then
|
||||||
actual_version=$(echo "$response" | grep -o "App Version: [0-9.]*" | sed 's/App Version: //')
|
actual_version=$(echo "$response" | grep -o "App Version: [0-9.]*" | sed 's/App Version: //')
|
||||||
else
|
else
|
||||||
echo "❌ Version verification failed: Could not find version information in the response"
|
echo "❌ Version verification failed: Could not find version information"
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Check if the extracted version matches expected version
|
# Check if the extracted version matches expected version
|
||||||
if [ "$actual_version" = "$expected_version" ]; then
|
if [ "$actual_version" = "$EXPECTED_VERSION" ]; then
|
||||||
echo "✅ Version verification passed: Found correct version $actual_version"
|
echo "✅ Version verification passed: $actual_version"
|
||||||
return 0
|
return 0
|
||||||
elif [ "$actual_version" = "0.0.0" ]; then
|
elif [ "$actual_version" = "0.0.0" ]; then
|
||||||
echo "❌ Version verification failed: Found placeholder version 0.0.0 instead of $expected_version"
|
echo "❌ Version verification failed: Found placeholder version 0.0.0"
|
||||||
return 1
|
return 1
|
||||||
else
|
else
|
||||||
echo "❌ Version verification failed: Found incorrect version $actual_version instead of $expected_version"
|
echo "❌ Version verification failed: Found $actual_version, expected $EXPECTED_VERSION"
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
@ -264,12 +260,18 @@ main() {
|
|||||||
export DOCKER_CLI_EXPERIMENTAL=enabled
|
export DOCKER_CLI_EXPERIMENTAL=enabled
|
||||||
export COMPOSE_DOCKER_CLI_BUILD=0
|
export COMPOSE_DOCKER_CLI_BUILD=0
|
||||||
export DISABLE_ADDITIONAL_FEATURES=true
|
export DISABLE_ADDITIONAL_FEATURES=true
|
||||||
|
|
||||||
# Run the gradlew build command and check if it fails
|
# Run the gradlew build command and check if it fails
|
||||||
if ! ./gradlew clean build; then
|
if ! ./gradlew clean build; then
|
||||||
echo "Gradle build failed with security disabled, exiting script."
|
echo "Gradle build failed with security disabled, exiting script."
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Get expected version after the build to ensure version.properties is created
|
||||||
|
echo "Getting expected version from Gradle..."
|
||||||
|
EXPECTED_VERSION=$(get_expected_version)
|
||||||
|
echo "Expected version: $EXPECTED_VERSION"
|
||||||
|
|
||||||
# Building Docker images
|
# Building Docker images
|
||||||
# docker build --no-cache --pull --build-arg VERSION_TAG=alpha -t stirlingtools/stirling-pdf:latest -f ./Dockerfile .
|
# docker build --no-cache --pull --build-arg VERSION_TAG=alpha -t stirlingtools/stirling-pdf:latest -f ./Dockerfile .
|
||||||
docker build --build-arg VERSION_TAG=alpha -t docker.stirlingpdf.com/stirlingtools/stirling-pdf:latest-ultra-lite -f ./Dockerfile.ultra-lite .
|
docker build --build-arg VERSION_TAG=alpha -t docker.stirlingpdf.com/stirlingtools/stirling-pdf:latest-ultra-lite -f ./Dockerfile.ultra-lite .
|
||||||
@ -308,6 +310,11 @@ main() {
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Get expected version after the security-enabled build
|
||||||
|
echo "Getting expected version from Gradle (security enabled)..."
|
||||||
|
EXPECTED_VERSION=$(get_expected_version)
|
||||||
|
echo "Expected version with security enabled: $EXPECTED_VERSION"
|
||||||
|
|
||||||
# Building Docker images with security enabled
|
# Building Docker images with security enabled
|
||||||
# docker build --no-cache --pull --build-arg VERSION_TAG=alpha -t stirlingtools/stirling-pdf:latest -f ./Dockerfile .
|
# docker build --no-cache --pull --build-arg VERSION_TAG=alpha -t stirlingtools/stirling-pdf:latest -f ./Dockerfile .
|
||||||
# docker build --no-cache --pull --build-arg VERSION_TAG=alpha -t stirlingtools/stirling-pdf:latest-ultra-lite -f ./Dockerfile.ultra-lite .
|
# docker build --no-cache --pull --build-arg VERSION_TAG=alpha -t stirlingtools/stirling-pdf:latest-ultra-lite -f ./Dockerfile.ultra-lite .
|
||||||
|
Loading…
Reference in New Issue
Block a user