Jenkins build
Some checks failed
test/timeline-frontend/pipeline/head There was a failure building this commit
Some checks failed
test/timeline-frontend/pipeline/head There was a failure building this commit
This commit is contained in:
26
Jenkinsfile
vendored
26
Jenkinsfile
vendored
@@ -51,27 +51,11 @@ pipeline {
|
||||
sh "chown -R jenkins:jenkins ${workspace}"
|
||||
|
||||
// 使用绝对路径挂载工作目录到容器中,并确保所有命令都在容器内执行
|
||||
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
|
||||
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
|
||||
"'''
|
||||
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\''
|
||||
|
||||
// 检查构建是否生成了 dist 目录
|
||||
sh 'ls -la'
|
||||
sh 'if [ ! -d "dist" ]; then echo "ERROR: dist directory does not exist after build"; exit 1; fi'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user