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:47:36 +08:00
parent 07d1eb553c
commit 3d7ab7c6af

43
Jenkinsfile vendored
View File

@@ -46,27 +46,40 @@ pipeline {
// 确保路径正确 // 确保路径正确
sh "ls -la ${workspace}" sh "ls -la ${workspace}"
// 使用 Jenkins Node.js 插件 // 修复权限问题
nodejs('NodeJS-18') { sh "chmod -R 755 ${workspace}"
// 检查是否存在 package.json sh "chown -R jenkins:jenkins ${workspace}"
if (fileExists('package.json')) {
echo "package.json found"
// 使用 Jenkins Node.js 插件,并确保在工作空间目录中执行
dir(workspace) {
nodejs('NodeJS-18') {
// 检查是否存在 package.json 和 pnpm-lock.yaml
if (fileExists('package.json')) {
echo "package.json found"
if (fileExists('pnpm-lock.yaml')) {
echo "pnpm-lock.yaml found"
} else {
error('pnpm-lock.yaml not found')
}
// 使用 pnpm 安装依赖 // 安装 pnpm
sh 'npm install' sh 'npm install -g pnpm'
// 构建项目 // 使用 pnpm 安装依赖,使用 --frozen-lockfile 确保依赖一致性
sh 'npm run build' sh 'pnpm install --frozen-lockfile'
// 检查 dist 目录是否存在 // 构建项目
if (!fileExists('dist')) { sh 'pnpm run build'
error('ERROR: dist directory does not exist after build')
// 检查 dist 目录是否存在
if (!fileExists('dist')) {
error('ERROR: dist directory does not exist after build')
} else {
echo 'Build completed successfully, dist directory exists'
}
} else { } else {
echo 'Build completed successfully, dist directory exists' error('package.json not found')
} }
} else {
error('package.json not found')
} }
} }
} }