i9
This commit is contained in:
parent
a38bb5d38a
commit
71dbb921ff
@ -31,8 +31,34 @@ jobs:
|
|||||||
|
|
||||||
- name: Install system tools (jq, docker, curl)
|
- name: Install system tools (jq, docker, curl)
|
||||||
run: |
|
run: |
|
||||||
apt-get update
|
set -e
|
||||||
apt-get install -y jq curl ca-certificates docker.io
|
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
|
docker --version
|
||||||
jq --version
|
jq --version
|
||||||
curl --version
|
curl --version
|
||||||
@ -109,6 +135,14 @@ jobs:
|
|||||||
if: env.BUILD_TARGET == 'user' || env.BUILD_TARGET == 'both'
|
if: env.BUILD_TARGET == 'user' || env.BUILD_TARGET == 'both'
|
||||||
run: docker push ${{ env.DOCKER_REGISTRY }}/ppanel/ppanel-user-web:${{ env.VERSION }}
|
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
|
- name: Notify success to Telegram
|
||||||
uses: chapvic/telegram-notify@master
|
uses: chapvic/telegram-notify@master
|
||||||
if: success()
|
if: success()
|
||||||
@ -117,7 +151,7 @@ jobs:
|
|||||||
chat: ${{ env.TELEGRAM_CHAT_ID }}
|
chat: ${{ env.TELEGRAM_CHAT_ID }}
|
||||||
status: ${{ job.status }}
|
status: ${{ job.status }}
|
||||||
title: ✅ 构建成功
|
title: ✅ 构建成功
|
||||||
message: "${{ gitea.repository }} 构建成功 · 分支: ${{ gitea.ref }} · 提交: ${{ gitea.sha }}"
|
message: "${{ gitea.repository }} 构建成功 · 分支: ${{ gitea.ref }} · 提交: ${{ gitea.sha }} · 目标: ${{ env.BUILD_TARGET }} · 版本: ${{ env.VERSION }}"
|
||||||
footer: "触发者: ${{ gitea.actor }}"
|
footer: "触发者: ${{ gitea.actor }}"
|
||||||
parse_mode: HTML
|
parse_mode: HTML
|
||||||
|
|
||||||
@ -129,6 +163,6 @@ jobs:
|
|||||||
chat: ${{ env.TELEGRAM_CHAT_ID }}
|
chat: ${{ env.TELEGRAM_CHAT_ID }}
|
||||||
status: ${{ job.status }}
|
status: ${{ job.status }}
|
||||||
title: ❌ 构建失败
|
title: ❌ 构建失败
|
||||||
message: "${{ gitea.repository }} 构建失败 · 分支: ${{ gitea.ref }} · 提交: ${{ gitea.sha }}"
|
message: "${{ gitea.repository }} 构建失败 · 分支: ${{ gitea.ref }} · 提交: ${{ gitea.sha }} · 目标: ${{ env.BUILD_TARGET }} · 版本: ${{ env.VERSION }}"
|
||||||
footer: "触发者: ${{ gitea.actor }}"
|
footer: "触发者: ${{ gitea.actor }}"
|
||||||
parse_mode: HTML
|
parse_mode: HTML
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user