From 71dbb921ff40f319097333ade07cc9f49c60e603 Mon Sep 17 00:00:00 2001 From: shanshanzhong Date: Thu, 25 Sep 2025 11:28:51 -0700 Subject: [PATCH] i9 --- .gitea/workflows/docker.yml | 42 +++++++++++++++++++++++++++++++++---- 1 file changed, 38 insertions(+), 4 deletions(-) diff --git a/.gitea/workflows/docker.yml b/.gitea/workflows/docker.yml index de1c9e7..d66da47 100644 --- a/.gitea/workflows/docker.yml +++ b/.gitea/workflows/docker.yml @@ -31,8 +31,34 @@ jobs: - name: Install system tools (jq, docker, curl) run: | - apt-get update - apt-get install -y jq curl ca-certificates docker.io + set -e + export DEBIAN_FRONTEND=noninteractive + echo "Waiting for apt/dpkg locks (unattended-upgrades) to release..." + # Wait up to 300s for unattended-upgrades/apt/dpkg locks + end=$((SECONDS+300)) + while true; do + LOCKS_BUSY=0 + # If unattended-upgrades is running, mark busy + if pgrep -x unattended-upgrades >/dev/null 2>&1; then LOCKS_BUSY=1; fi + # If fuser exists, check common lock files + if command -v fuser >/dev/null 2>&1; then + if fuser /var/lib/dpkg/lock >/dev/null 2>&1 \ + || fuser /var/lib/dpkg/lock-frontend >/dev/null 2>&1 \ + || fuser /var/lib/apt/lists/lock >/dev/null 2>&1; then + LOCKS_BUSY=1 + fi + fi + # Break if not busy + if [ "$LOCKS_BUSY" -eq 0 ]; then break; fi + # Timeout after ~5 minutes + if [ $SECONDS -ge $end ]; then + echo "Timeout waiting for apt/dpkg locks, proceeding with Dpkg::Lock::Timeout..." + break + fi + echo "Still waiting for locks..."; sleep 5 + done + apt-get update -y -o Dpkg::Lock::Timeout=600 + apt-get install -y -o Dpkg::Lock::Timeout=600 jq curl ca-certificates docker.io docker --version jq --version curl --version @@ -109,6 +135,14 @@ jobs: if: env.BUILD_TARGET == 'user' || env.BUILD_TARGET == 'both' run: docker push ${{ env.DOCKER_REGISTRY }}/ppanel/ppanel-user-web:${{ env.VERSION }} + - name: Run Admin container after push + if: env.BUILD_TARGET == 'admin' || env.BUILD_TARGET == 'both' + run: make admin-run + + - name: Run User container after push + if: env.BUILD_TARGET == 'user' || env.BUILD_TARGET == 'both' + run: make user-run + - name: Notify success to Telegram uses: chapvic/telegram-notify@master if: success() @@ -117,7 +151,7 @@ jobs: chat: ${{ env.TELEGRAM_CHAT_ID }} status: ${{ job.status }} title: ✅ 构建成功 - message: "${{ gitea.repository }} 构建成功 · 分支: ${{ gitea.ref }} · 提交: ${{ gitea.sha }}" + message: "${{ gitea.repository }} 构建成功 · 分支: ${{ gitea.ref }} · 提交: ${{ gitea.sha }} · 目标: ${{ env.BUILD_TARGET }} · 版本: ${{ env.VERSION }}" footer: "触发者: ${{ gitea.actor }}" parse_mode: HTML @@ -129,6 +163,6 @@ jobs: chat: ${{ env.TELEGRAM_CHAT_ID }} status: ${{ job.status }} title: ❌ 构建失败 - message: "${{ gitea.repository }} 构建失败 · 分支: ${{ gitea.ref }} · 提交: ${{ gitea.sha }}" + message: "${{ gitea.repository }} 构建失败 · 分支: ${{ gitea.ref }} · 提交: ${{ gitea.sha }} · 目标: ${{ env.BUILD_TARGET }} · 版本: ${{ env.VERSION }}" footer: "触发者: ${{ gitea.actor }}" parse_mode: HTML