63 lines
2.2 KiB
Groovy
63 lines
2.2 KiB
Groovy
pipeline {
|
|
agent none
|
|
stages {
|
|
stage('Build Image With localhost') {
|
|
agent { label 'LocalHost' } // 在标签为'linux-build'的节点上执行
|
|
steps {
|
|
script {
|
|
try {
|
|
echo 'Start Build'
|
|
sh 'docker compose -f docker-compose.yaml down'
|
|
sh 'docker compose -f docker-compose.yaml up -d --build'
|
|
echo 'Build success'
|
|
} catch (err) {
|
|
echo err.getMessage()
|
|
}
|
|
}
|
|
}
|
|
post { // 添加post指令处理阶段完成后的情况
|
|
failure {
|
|
echo 'Build failed, but continuing to the next stage...'
|
|
}
|
|
}
|
|
}
|
|
stage('Build Image With rabbit') {
|
|
agent { label '流氓兔' } // 在标签为'linux-build'的节点上执行
|
|
steps {
|
|
script {
|
|
try {
|
|
echo 'Start Build'
|
|
sh 'docker compose -f docker-compose.yaml up -d --build'
|
|
echo 'Build success'
|
|
} catch (err) {
|
|
echo err.getMessage()
|
|
}
|
|
}
|
|
}
|
|
post { // 添加post指令处理阶段完成后的情况
|
|
failure {
|
|
echo 'Build failed, but continuing to the next stage...'
|
|
}
|
|
}
|
|
}
|
|
stage('Build Image With L') {
|
|
agent { label 'L' } // 在标签为'linux-build'的节点上执行
|
|
steps {
|
|
script {
|
|
try {
|
|
echo 'Start Build'
|
|
sh 'docker compose -f docker-compose.yaml up -d --build'
|
|
echo 'Build success'
|
|
} catch (err) {
|
|
echo err.getMessage()
|
|
}
|
|
}
|
|
}
|
|
post { // 添加post指令处理阶段完成后的情况
|
|
failure {
|
|
echo 'Build failed, but continuing to the next stage...'
|
|
}
|
|
}
|
|
}
|
|
}
|
|
} |