Update xahau-sh-build-in-docker.yml

This commit is contained in:
Denis Angell
2025-03-29 04:22:35 +01:00
parent c27e2a9c05
commit 8b0592ce06

View File

@@ -12,7 +12,7 @@ concurrency:
env: env:
DEBUG_CONTAINERS: 1 DEBUG_CONTAINERS: 1
REMOVE_CONTAINERS: 1 REMOVE_CONTAINERS: 0
jobs: jobs:
build-and-test: build-and-test:
@@ -59,19 +59,16 @@ jobs:
if [[ "${DEBUG_CONTAINERS}" == "1" ]]; then if [[ "${DEBUG_CONTAINERS}" == "1" ]]; then
echo "🔍 Checking for leftover containers..." echo "🔍 Checking for leftover containers..."
BUILD_CONTAINERS=$(docker ps --format '{{.Names}}' | grep '^xahaud_cached_builder' || echo "") BUILD_CONTAINERS=$(docker ps --format '{{.Names}}' | grep '^xahaud_cached_builder' || echo "")
CONTAINER_NAME="xahaud_cached_builder_${{ github.workflow }}-${{ github.ref_name }}"
if [[ -n "$BUILD_CONTAINERS" && "${REMOVE_CONTAINERS}" == "1" ]]; then if [[ -n "$BUILD_CONTAINERS" && "${REMOVE_CONTAINERS}" == "1" ]]; then
echo "⚠️ WARNING: Some build containers are still running" echo "⚠️ WARNING: Some build containers are still running"
echo "$BUILD_CONTAINERS" echo "$BUILD_CONTAINERS"
# stop and remove the build containers echo "Attempting to stop build containers.."
echo "Attempting to stop build containers..." echo "Stopping container: $CONTAINER_NAME"
for CONTAINER in $BUILD_CONTAINERS; do docker stop "$CONTAINER_NAME" || echo "Failed to stop container: $CONTAINER_NAME"
echo "Stopping container: $CONTAINER" echo "Removing container: $CONTAINER_NAME"
docker stop "$CONTAINER" || echo "Failed to stop container: $CONTAINER" docker rm -f "$CONTAINER_NAME" || echo "Failed to remove container: $CONTAINER_NAME"
echo "Removing container: $CONTAINER" echo "✅ Build container stopped and removed"
docker rm -f "$CONTAINER" || echo "Failed to remove container: $CONTAINER"
done
echo "✅ Build containers stopped and removed"
else else
echo "✅ No build containers found" echo "✅ No build containers found"
fi fi