🚀 添加ci/cd自动化部署程序,修复获取面额相关
This commit is contained in:
42
Jenkinsfile
vendored
42
Jenkinsfile
vendored
@@ -7,46 +7,10 @@ pipeline {
|
|||||||
script {
|
script {
|
||||||
try {
|
try {
|
||||||
echo 'Start Build'
|
echo 'Start Build'
|
||||||
sh 'docker compose -f docker-compose.yaml down'
|
sh "docker ps -a --format '{{.ID}} {{.Names}}' | awk '{if (\$2 !~ /^1Panel-jenkins/) print \$1}' | xargs -r docker stop"
|
||||||
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'
|
sh 'docker compose -f docker-compose.yaml up -d --build'
|
||||||
|
sh 'docker start \$(docker ps -a -q)'
|
||||||
|
sh "docker restart \$(docker ps -a | grep kami_ | awk '{print \$1}')"
|
||||||
echo 'Build success'
|
echo 'Build success'
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
echo err.getMessage()
|
echo err.getMessage()
|
||||||
|
|||||||
63
Jenkinsfile.bak
Normal file
63
Jenkinsfile.bak
Normal 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 stop $(docker ps -q --filter "status=running" --filter "name!=jenkins*")'
|
||||||
|
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...'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -266,7 +266,6 @@ func (c *UserInfo) QueryAllowedMM() {
|
|||||||
_ = c.ServeJSON()
|
_ = c.ServeJSON()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
us := c.GetSession(enum.UserSession)
|
us := c.GetSession(enum.UserSession)
|
||||||
u := us.(merchant.MerchantInfo)
|
u := us.(merchant.MerchantInfo)
|
||||||
if u.Id == 0 {
|
if u.Id == 0 {
|
||||||
@@ -278,12 +277,31 @@ func (c *UserInfo) QueryAllowedMM() {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
result := service.QueryAllowedDeployInfoMM(u.MerchantUid, roadPool.RoadUid)
|
result := service.QueryAllowedDeployInfoMM(u.MerchantUid, roadPool.RoadUid)
|
||||||
|
returnList := make([]struct {
|
||||||
|
ShowLabel float64 `json:"showLabel"`
|
||||||
|
}, 0)
|
||||||
|
for _, margin := range result {
|
||||||
|
isInList := false
|
||||||
|
for _, s := range returnList {
|
||||||
|
if s.ShowLabel == margin.ShowLabel {
|
||||||
|
// 存在
|
||||||
|
isInList = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if !isInList {
|
||||||
|
returnList = append(returnList, struct {
|
||||||
|
ShowLabel float64 `json:"showLabel"`
|
||||||
|
}{
|
||||||
|
ShowLabel: margin.ShowLabel,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
c.Data["json"] = response.CommonResWithData{
|
c.Data["json"] = response.CommonResWithData{
|
||||||
CommonRes: response.CommonRes{
|
CommonRes: response.CommonRes{
|
||||||
Msg: "成功",
|
Msg: "成功",
|
||||||
Code: 0,
|
Code: 0,
|
||||||
},
|
},
|
||||||
Data: result,
|
Data: returnList,
|
||||||
}
|
}
|
||||||
_ = c.ServeJSON()
|
_ = c.ServeJSON()
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user