From d0450b239fd37c7073b52c74761de54a1b2341ad Mon Sep 17 00:00:00 2001 From: jianghao <332515344@qq.com> Date: Mon, 29 Dec 2025 15:18:03 +0800 Subject: [PATCH] Jenkins build --- Jenkinsfile | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 5f9d6b4..e798429 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -52,7 +52,18 @@ pipeline { sh "chown -R jenkins:jenkins ${workspace}" // 使用更健壮的Docker命令 - sh 'docker run --rm -v "$(pwd)":/app -w /app node:18-alpine sh -c "ls -la && npm ci && npm run build"' } + sh '''docker run --rm -v "$(pwd)":/app -w /app node:18-alpine sh -c " + ls -la + if [ -f package.json ]; then + echo 'package.json found' + npm ci + npm run build + else + echo 'package.json not found in /app' + exit 1 + fi + "''' + } } }