🚀 尝试编写ci/cd文件

This commit is contained in:
孙晓龙
2024-06-26 16:20:12 +08:00
committed by sunxiaolong
parent 8ce0b4572e
commit 484e5f4808
4 changed files with 63 additions and 12 deletions

63
Jenkinsfile vendored Normal file
View File

@@ -0,0 +1,63 @@
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...'
}
}
}
}
}

View File

@@ -1,15 +1,5 @@
package consts package consts
/***************************************************
** @Desc : This file for ...
** @Time : 2019/11/25 14:14
** @Author : yuebin
** @File : consts.go
** @Last Modified by : yuebin
** @Last Modified time: 2019/11/25 14:14
** @Software: GoLand
****************************************************/
const ( const (
ACTIVE = "active" ACTIVE = "active"
UNACTIVE = "unactive" UNACTIVE = "unactive"

1
go.mod
View File

@@ -8,7 +8,6 @@ require (
github.com/dchest/captcha v0.0.0-20200903113550-03f5f0333e1f github.com/dchest/captcha v0.0.0-20200903113550-03f5f0333e1f
github.com/go-redis/redis v6.14.2+incompatible github.com/go-redis/redis v6.14.2+incompatible
github.com/go-sql-driver/mysql v1.6.0 github.com/go-sql-driver/mysql v1.6.0
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b
github.com/pkg/errors v0.9.1 github.com/pkg/errors v0.9.1
github.com/rs/xid v1.3.0 github.com/rs/xid v1.3.0
github.com/skip2/go-qrcode v0.0.0-20200617195104-da1b6568686e github.com/skip2/go-qrcode v0.0.0-20200617195104-da1b6568686e

1
go.sum
View File

@@ -57,7 +57,6 @@ github.com/go-sql-driver/mysql v1.6.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LB
github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY=
github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ=
github.com/gogo/protobuf v1.3.1/go.mod h1:SlYgWuQ5SjCEi6WLHjHCa1yvBfUnHcTbrrZtXPKa29o= github.com/gogo/protobuf v1.3.1/go.mod h1:SlYgWuQ5SjCEi6WLHjHCa1yvBfUnHcTbrrZtXPKa29o=
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b h1:VKtxabqXZkF25pY9ekfRL6a582T4P37/31XEstQ5p58=
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q=
github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A=
github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=