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:
23
Jenkinsfile
vendored
23
Jenkinsfile
vendored
@@ -46,18 +46,30 @@ pipeline {
|
|||||||
// 确保路径正确
|
// 确保路径正确
|
||||||
sh "ls -la ${workspace}"
|
sh "ls -la ${workspace}"
|
||||||
|
|
||||||
// 使用 Jenkins Node.js 插件
|
// 修复权限问题
|
||||||
|
sh "chmod -R 755 ${workspace}"
|
||||||
|
sh "chown -R jenkins:jenkins ${workspace}"
|
||||||
|
|
||||||
|
// 使用 Jenkins Node.js 插件,并确保在工作空间目录中执行
|
||||||
|
dir(workspace) {
|
||||||
nodejs('NodeJS-18') {
|
nodejs('NodeJS-18') {
|
||||||
// 检查是否存在 package.json
|
// 检查是否存在 package.json 和 pnpm-lock.yaml
|
||||||
if (fileExists('package.json')) {
|
if (fileExists('package.json')) {
|
||||||
echo "package.json found"
|
echo "package.json found"
|
||||||
|
if (fileExists('pnpm-lock.yaml')) {
|
||||||
|
echo "pnpm-lock.yaml found"
|
||||||
|
} else {
|
||||||
|
error('pnpm-lock.yaml not found')
|
||||||
|
}
|
||||||
|
|
||||||
|
// 安装 pnpm
|
||||||
|
sh 'npm install -g pnpm'
|
||||||
|
|
||||||
// 使用 pnpm 安装依赖
|
// 使用 pnpm 安装依赖,使用 --frozen-lockfile 确保依赖一致性
|
||||||
sh 'npm install'
|
sh 'pnpm install --frozen-lockfile'
|
||||||
|
|
||||||
// 构建项目
|
// 构建项目
|
||||||
sh 'npm run build'
|
sh 'pnpm run build'
|
||||||
|
|
||||||
// 检查 dist 目录是否存在
|
// 检查 dist 目录是否存在
|
||||||
if (!fileExists('dist')) {
|
if (!fileExists('dist')) {
|
||||||
@@ -72,6 +84,7 @@ pipeline {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
stage('Build Docker Image') {
|
stage('Build Docker Image') {
|
||||||
steps {
|
steps {
|
||||||
|
|||||||
Reference in New Issue
Block a user