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:21:35 +08:00
parent 78c04ef3d3
commit c182574917

17
Jenkinsfile vendored
View File

@@ -41,7 +41,6 @@ pipeline {
steps {
script {
def workspace = sh(script: "pwd", returnStdout: true).trim()
echo "当前工作空间路径: ${workspace}"
// 确保路径正确
@@ -51,8 +50,20 @@ pipeline {
sh "chmod -R 755 ${workspace}"
sh "chown -R jenkins:jenkins ${workspace}"
// 使用更健壮的Docker命令
sh """docker run --rm -v ${workspace}:/app -w /app node:18-alpine sh -c 'ls -la && if [ -f package.json ]; then npm install && npm run build; else echo "package.json not found"; exit 1; fi'"""
// 使用绝对路径挂载工作目录到容器中,并确保所有命令都在容器内执行
sh '''docker run --rm -v "${PWD}:/app" -w /app node:18-alpine sh -c "
echo \"Current directory contents:\"
ls -la
echo \"Checking for package.json:\"
if [ -f \"package.json\" ]; then
echo \"package.json found, proceeding with build\"
npm install
npm run build
else
echo \"package.json not found\"
exit 1
fi
"'''
}
}
}