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:
21
Jenkinsfile
vendored
21
Jenkinsfile
vendored
@@ -40,17 +40,18 @@ pipeline {
|
|||||||
stage('Build timeline-frontend dist') {
|
stage('Build timeline-frontend dist') {
|
||||||
steps {
|
steps {
|
||||||
script {
|
script {
|
||||||
sh "pwd && ls"
|
def workspace = pwd
|
||||||
// 使用 Docker 运行 Node.js 环境
|
echo "当前工作空间路径: $ {workspace}"
|
||||||
sh '''
|
|
||||||
docker run -v $PWD:/app -w /app node:18-alpine sh -c "
|
|
||||||
npm install &&
|
|
||||||
npm run build
|
|
||||||
"
|
|
||||||
'''
|
|
||||||
|
|
||||||
// 验证构建产物
|
// 确保路径正确
|
||||||
sh 'ls -la dist/'
|
sh "ls -la $ {workspace}"
|
||||||
|
|
||||||
|
// 修复权限问题
|
||||||
|
sh "chmod -R 755 $ {workspace}"
|
||||||
|
sh "chown -R jenkins:jenkins $ {workspace}"
|
||||||
|
|
||||||
|
// 使用更健壮的Docker命令
|
||||||
|
sh "docker run -u $ (id -u): $ (id -g) -v $ {workspace}:/app -w /app node:18-alpine sh -c 'npm install && npm run build'"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user