fix(ci): add image tag fallback logic and code style fixes
- Add fallback to 'latest' tag when build fails - Add fallback mechanism when pulling specific image tag fails - Fix code style: move opening brace in ObjectInfo - Remove unused comment in ObjectStorage
This commit is contained in:
@@ -832,8 +832,13 @@ jobs:
|
|||||||
DEPLOYMENT_HOST="${{ env.DEPLOYMENT_HOST }}"
|
DEPLOYMENT_HOST="${{ env.DEPLOYMENT_HOST }}"
|
||||||
REGISTRY="${{ env.REGISTRY }}"
|
REGISTRY="${{ env.REGISTRY }}"
|
||||||
IMAGE_NAME="${{ env.IMAGE_NAME }}"
|
IMAGE_NAME="${{ env.IMAGE_NAME }}"
|
||||||
|
BUILD_RESULT="${{ needs.build.result }}"
|
||||||
IMAGE_TAG="${{ needs.build.outputs.image_tag || 'latest' }}"
|
IMAGE_TAG="${{ needs.build.outputs.image_tag || 'latest' }}"
|
||||||
|
|
||||||
|
if [ "$BUILD_RESULT" != "success" ]; then
|
||||||
|
IMAGE_TAG="latest"
|
||||||
|
fi
|
||||||
|
|
||||||
if [ -z "$IMAGE_TAG" ] || [ "$IMAGE_TAG" = "null" ]; then
|
if [ -z "$IMAGE_TAG" ] || [ "$IMAGE_TAG" = "null" ]; then
|
||||||
IMAGE_TAG="latest"
|
IMAGE_TAG="latest"
|
||||||
fi
|
fi
|
||||||
@@ -863,10 +868,22 @@ jobs:
|
|||||||
--password-stdin || echo "⚠️ Registry login failed, continuing..."
|
--password-stdin || echo "⚠️ Registry login failed, continuing..."
|
||||||
|
|
||||||
echo "📥 Pulling image ${FULL_IMAGE}..."
|
echo "📥 Pulling image ${FULL_IMAGE}..."
|
||||||
docker pull ${FULL_IMAGE} || {
|
if ! docker pull ${FULL_IMAGE}; then
|
||||||
echo "❌ Failed to pull image ${FULL_IMAGE}"
|
if [ "${IMAGE_TAG}" != "latest" ]; then
|
||||||
exit 1
|
echo "⚠️ Failed to pull ${FULL_IMAGE}, falling back to :latest"
|
||||||
}
|
IMAGE_TAG="latest"
|
||||||
|
FULL_IMAGE="${REGISTRY}/${IMAGE_NAME}:${IMAGE_TAG}"
|
||||||
|
if docker pull ${FULL_IMAGE}; then
|
||||||
|
echo "ℹ️ Using fallback image ${FULL_IMAGE}"
|
||||||
|
else
|
||||||
|
echo "❌ Failed to pull fallback image ${FULL_IMAGE}"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo "❌ Failed to pull image ${FULL_IMAGE}"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
# If docker-compose.yml doesn't exist, it will be created from repo
|
# If docker-compose.yml doesn't exist, it will be created from repo
|
||||||
if [ ! -f docker-compose.yml ]; then
|
if [ ! -f docker-compose.yml ]; then
|
||||||
|
|||||||
@@ -3,7 +3,8 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace App\Framework\Storage;
|
namespace App\Framework\Storage;
|
||||||
|
|
||||||
final readonly class ObjectInfo {
|
final readonly class ObjectInfo
|
||||||
|
{
|
||||||
public function __construct(
|
public function __construct(
|
||||||
public string $bucket,
|
public string $bucket,
|
||||||
public string $key,
|
public string $key,
|
||||||
|
|||||||
@@ -10,7 +10,6 @@ interface ObjectStorage
|
|||||||
public function head(string $bucket, string $key): ObjectInfo;
|
public function head(string $bucket, string $key): ObjectInfo;
|
||||||
public function delete(string $bucket, string $key): void;
|
public function delete(string $bucket, string $key): void;
|
||||||
public function exists(string $bucket, string $key): bool;
|
public function exists(string $bucket, string $key): bool;
|
||||||
|
|
||||||
// Links
|
// Links
|
||||||
public function url(string $bucket, string $key): ?string; // öffentlich, wenn möglich
|
public function url(string $bucket, string $key): ?string; // öffentlich, wenn möglich
|
||||||
public function temporaryUrl(string $bucket, string $key, \DateInterval $ttl, array $opts = []): string;
|
public function temporaryUrl(string $bucket, string $key, \DateInterval $ttl, array $opts = []): string;
|
||||||
|
|||||||
Reference in New Issue
Block a user