diff --git a/Jenkinsfile b/Jenkinsfile new file mode 100644 index 0000000..fde1616 --- /dev/null +++ b/Jenkinsfile @@ -0,0 +1,24 @@ +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 up -d --build' + echo 'Build success' + } catch (err) { + echo err.getMessage() + } + } + } + post { // 添加post指令处理阶段完成后的情况 + failure { + echo 'Build failed, but continuing to the next stage...' + } + } + } + } +} \ No newline at end of file diff --git a/Jenkinsfile.bak b/Jenkinsfile.bak new file mode 100644 index 0000000..3035f84 --- /dev/null +++ b/Jenkinsfile.bak @@ -0,0 +1,62 @@ +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 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...' + } + } + } + } +} \ No newline at end of file