Jenkins 镜像预拉取增加超时重试与缓存检测

This commit is contained in:
2026-03-03 15:30:16 +08:00
parent 35aa7fb6bc
commit 0b28c94762
Vendored
+20 -4
View File
@@ -23,11 +23,27 @@ pipeline {
}
stage('Prepare Test Images') {
options {
timeout(time: 15, unit: 'MINUTES')
}
steps {
sh '''
docker pull node:20-bookworm
docker pull mcr.microsoft.com/playwright:v1.51.1-jammy
'''
retry(2) {
sh '''
set -e
if docker image inspect node:20-bookworm >/dev/null 2>&1; then
echo "node:20-bookworm already exists, skip pull"
else
docker pull node:20-bookworm
fi
if docker image inspect mcr.microsoft.com/playwright:v1.51.1-jammy >/dev/null 2>&1; then
echo "mcr.microsoft.com/playwright:v1.51.1-jammy already exists, skip pull"
else
docker pull mcr.microsoft.com/playwright:v1.51.1-jammy
fi
'''
}
}
}