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

This commit is contained in:
jiangh277
2025-12-26 21:14:40 +08:00
parent 5bbbafa0c0
commit 854e5924a3

18
Jenkinsfile vendored
View File

@@ -1,6 +1,9 @@
pipeline {
agent any
agent {
docker {
image 'node:18-alpine' // 使用包含 Node.js 的 Docker 镜像
}
}
environment {
// 环境变量定义
PROJECT_NAME = 'timeline-frontend'
@@ -25,11 +28,16 @@ pipeline {
stages {
stage('Checkout') {
steps {
checkout scm
script {
echo "当前分支: ${params.BRANCH_NAME}"
if (params.GIT_COMMIT) {
checkout scm
sh "git reset --hard ${params.GIT_COMMIT}"
} else {
checkout scm
}
}
echo "当前构建的 Git Commit: ${env.GIT_COMMIT}"
}
}
stage('Build timeline-frontend dist') {
steps {
@@ -37,6 +45,8 @@ pipeline {
// 确保先执行前端构建命令
sh 'npm install'
sh 'npm run build' // 这会生成 dist 目录
// 验证构建产物
sh 'ls -la dist/'
}
}
}