ci: use Docker agent for yarn build stage on Windows Jenkins
Run yarn install/build inside node:22-alpine Linux container via Docker Pipeline plugin; Docker/SSH deploy stages remain on native agent. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
这个提交包含在:
父节点
b349ae159b
当前提交
5fdb06c1a5
19
Jenkinsfile
vendored
19
Jenkinsfile
vendored
@ -1,5 +1,5 @@
|
||||
pipeline {
|
||||
agent any
|
||||
agent none
|
||||
|
||||
parameters {
|
||||
choice(name: 'APP', choices: ['tenant-platform', 'ops-platform'], description: '要构建的 Web 应用')
|
||||
@ -18,22 +18,36 @@ pipeline {
|
||||
|
||||
stages {
|
||||
stage('Checkout') {
|
||||
steps { checkout scm }
|
||||
agent any
|
||||
steps {
|
||||
checkout scm
|
||||
stash name: 'source', includes: '**/*'
|
||||
}
|
||||
}
|
||||
|
||||
stage('Install & Build') {
|
||||
agent {
|
||||
docker {
|
||||
image 'node:22-alpine'
|
||||
args '-v yarn-cache:/root/.yarn'
|
||||
}
|
||||
}
|
||||
steps {
|
||||
unstash 'source'
|
||||
dir("${params.APP}") {
|
||||
sh '''
|
||||
yarn install --frozen-lockfile
|
||||
yarn build
|
||||
'''
|
||||
}
|
||||
stash name: 'dist', includes: "${params.APP}/dist/**,${params.APP}/Dockerfile"
|
||||
}
|
||||
}
|
||||
|
||||
stage('Docker Build & Push') {
|
||||
agent any
|
||||
steps {
|
||||
unstash 'dist'
|
||||
withCredentials([string(credentialsId: 'ACR_PASSWORD', variable: 'ACR_PASS')]) {
|
||||
script {
|
||||
def imageName = "${ACR_REGISTRY}/${ACR_NAMESPACE}/web-${params.APP}:${params.IMAGE_TAG}"
|
||||
@ -49,6 +63,7 @@ pipeline {
|
||||
}
|
||||
|
||||
stage('Deploy to Production') {
|
||||
agent any
|
||||
when { expression { return params.DEPLOY } }
|
||||
steps {
|
||||
withCredentials([sshUserPrivateKey(credentialsId: 'PROD_SSH_KEY', keyFileVariable: 'SSH_KEY')]) {
|
||||
|
||||
正在加载...
在新工单中引用
屏蔽一个用户