Jenkins build
Some checks failed
test/timeline-frontend/pipeline/head There was a failure building this commit

This commit is contained in:
2025-12-29 15:26:05 +08:00
parent 13e1bb78f7
commit 2b63c3f026

26
Jenkinsfile vendored
View File

@@ -51,27 +51,11 @@ pipeline {
sh "chown -R jenkins:jenkins ${workspace}" sh "chown -R jenkins:jenkins ${workspace}"
// 使用绝对路径挂载工作目录到容器中,并确保所有命令都在容器内执行 // 使用绝对路径挂载工作目录到容器中,并确保所有命令都在容器内执行
sh '''docker run --rm -v "${PWD}:/app" -w /app node:18-alpine sh -c " sh 'docker run --rm -v "${PWD}:/app" -w /app node:18-alpine sh -c \'if [ -f "package.json" ]; then echo "package.json found"; npm install && npm run build; else echo "package.json not found"; exit 1; fi\''
echo \"Current directory contents:\"
ls -la // 检查构建是否生成了 dist 目录
echo \"Checking for package.json:\" sh 'ls -la'
if [ -f \"package.json\" ]; then sh 'if [ ! -d "dist" ]; then echo "ERROR: dist directory does not exist after build"; exit 1; fi'
echo \"package.json found, proceeding with build\"
npm install
npm run build
echo \"Build completed, checking for dist directory:\"
ls -la
if [ -d \"dist\" ]; then
echo \"dist directory exists\"
else
echo \"ERROR: dist directory does not exist\"
exit 1
fi
else
echo \"package.json not found\"
exit 1
fi
"'''
} }
} }
} }