1 Star 0 Fork 51

ustcck/xuxiaowei-cloud

forked from xuxiaowei-cloud/xuxiaowei-cloud
暂停
 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
shell-service.yml 31.56 KB
一键复制 编辑 原始数据 按行查看 历史
徐晓伟 提交于 2023-02-24 14:28 . :construction_worker:流水线服务增加名称前缀
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675
#
# shell 发布网关服务
shell-service-gateway:
stage: shell-service
needs:
- job: shell-package
artifacts: true
script:
- JAR_PATH=/home/gitlab-runner/jar/$CI_COMMIT_BRANCH
- echo JAR_PATH:$JAR_PATH
- if [ ! -f $JAR_PATH ]; then sudo mkdir $JAR_PATH -p && echo 创建发布文件夹完成; fi
- MODULE='gateway'
- echo MODULE:$MODULE
- ARTIFACT_ID=`mvn -e -U help:evaluate -pl $MODULE -Dexpression=project.artifactId -q -DforceStdout`
- VERSION=`mvn help:evaluate -pl $MODULE -Dexpression=project.version -q -DforceStdout`
- PACKAGING=`mvn help:evaluate -pl $MODULE -Dexpression=project.packaging -q -DforceStdout`
- APP_NAME=$ARTIFACT_ID-$VERSION.$PACKAGING
- echo APP_NAME:$APP_NAME
- cp $MODULE/target/$APP_NAME $JAR_PATH/$APP_NAME && echo 复制新jar包完成
- SERVICE=/usr/lib/systemd/system/xxw-$MODULE.service
- echo SERVICE:$SERVICE
- JAVA_HOME=/software/dragonwell-8.14.15
- echo JAVA_HOME:$JAVA_HOME
- echo "" > $SERVICE
- echo "[Unit]" >> $SERVICE
- echo "Description=$MODULE" >> $SERVICE
- echo "After=syslog.target" >> $SERVICE
- echo "" >> $SERVICE
- echo "[Service]" >> $SERVICE
- echo "EnvironmentFile=/etc/profile" >> $SERVICE
- echo "ExecStart=$JAVA_HOME/bin/java -jar $JAR_PATH/$APP_NAME --spring.profiles.active=prod" >> $SERVICE
- echo "" >> $SERVICE
- echo "[Install]" >> $SERVICE
- echo "WantedBy=multi-user.target" >> $SERVICE
- echo "" >> $SERVICE
- echo 创建新启动脚本完成
- sudo systemctl enable xxw-$MODULE.service && echo 设置开机启动完成
- sudo systemctl daemon-reload
- sudo systemctl restart xxw-$MODULE.service && echo 重启项目完成
- sudo systemctl status xxw-$MODULE.service && MODULE_STATUS=1
- if [ "$MODULE_STATUS" == "1" ]; then echo '查看项目状态成功'; else echo '查看项目状态失败' && xxxx; fi
- MODULE_STATUS=0
- sleep 30 && echo 增加延时
- sudo systemctl status xxw-$MODULE.service && MODULE_STATUS=1
- if [ "$MODULE_STATUS" == "1" ]; then echo '延时查看项目状态成功'; else echo '查看项目状态失败' && xxxx; fi
rules:
# 仅在 shell 分支中执行
# 此处禁用 gitlab.com、jihulab.com、gitcode.net 上的流水线,仅在个人搭建的 gitlab 上运行
- if: $CI_COMMIT_BRANCH == "shell" && $CI_SERVER_HOST != 'gitlab.com' && $CI_SERVER_HOST != 'jihulab.com' && $CI_SERVER_HOST != 'gitcode.net'
tags:
# 仅在 tags 名称为 shell 的执行器上执行
- shell
#
# shell 发布监控(管理)服务
shell-service-admin-server:
stage: shell-service
needs:
- job: shell-package
artifacts: true
script:
- JAR_PATH=/home/gitlab-runner/jar/$CI_COMMIT_BRANCH
- echo JAR_PATH:$JAR_PATH
- if [ ! -f $JAR_PATH ]; then sudo mkdir $JAR_PATH -p && echo 创建发布文件夹完成; fi
- MODULE='admin-server'
- echo MODULE:$MODULE
- ARTIFACT_ID=`mvn -e -U help:evaluate -pl $MODULE -Dexpression=project.artifactId -q -DforceStdout`
- VERSION=`mvn help:evaluate -pl $MODULE -Dexpression=project.version -q -DforceStdout`
- PACKAGING=`mvn help:evaluate -pl $MODULE -Dexpression=project.packaging -q -DforceStdout`
- APP_NAME=$ARTIFACT_ID-$VERSION.$PACKAGING
- echo APP_NAME:$APP_NAME
- cp $MODULE/target/$APP_NAME $JAR_PATH/$APP_NAME && echo 复制新jar包完成
- SERVICE=/usr/lib/systemd/system/xxw-$MODULE.service
- echo SERVICE:$SERVICE
- JAVA_HOME=/software/dragonwell-8.14.15
- echo JAVA_HOME:$JAVA_HOME
- echo "" > $SERVICE
- echo "[Unit]" >> $SERVICE
- echo "Description=$MODULE" >> $SERVICE
- echo "After=syslog.target" >> $SERVICE
- echo "" >> $SERVICE
- echo "[Service]" >> $SERVICE
- echo "EnvironmentFile=/etc/profile" >> $SERVICE
- echo "ExecStart=$JAVA_HOME/bin/java -jar $JAR_PATH/$APP_NAME --spring.profiles.active=prod" >> $SERVICE
- echo "" >> $SERVICE
- echo "[Install]" >> $SERVICE
- echo "WantedBy=multi-user.target" >> $SERVICE
- echo "" >> $SERVICE
- echo 创建新启动脚本完成
- sudo systemctl enable xxw-$MODULE.service && echo 设置开机启动完成
- sudo systemctl daemon-reload
- sudo systemctl restart xxw-$MODULE.service && echo 重启项目完成
- sudo systemctl status xxw-$MODULE.service && MODULE_STATUS=1
- if [ "$MODULE_STATUS" == "1" ]; then echo '查看项目状态成功'; else echo '查看项目状态失败' && xxxx; fi
- MODULE_STATUS=0
- sleep 30 && echo 增加延时
- sudo systemctl status xxw-$MODULE.service && MODULE_STATUS=1
- if [ "$MODULE_STATUS" == "1" ]; then echo '延时查看项目状态成功'; else echo '查看项目状态失败' && xxxx; fi
rules:
# 仅在 shell 分支中执行
# 此处禁用 gitlab.com、jihulab.com、gitcode.net 上的流水线,仅在个人搭建的 gitlab 上运行
- if: $CI_COMMIT_BRANCH == "shell" && $CI_SERVER_HOST != 'gitlab.com' && $CI_SERVER_HOST != 'jihulab.com' && $CI_SERVER_HOST != 'gitcode.net'
tags:
# 仅在 tags 名称为 shell 的执行器上执行
- shell
#
# shell 发布登录服务
shell-service-passport:
stage: shell-service
needs:
- job: shell-package
artifacts: true
script:
- JAR_PATH=/home/gitlab-runner/jar/$CI_COMMIT_BRANCH
- echo JAR_PATH:$JAR_PATH
- if [ ! -f $JAR_PATH ]; then sudo mkdir $JAR_PATH -p && echo 创建发布文件夹完成; fi
- MODULE='passport'
- echo MODULE:$MODULE
- ARTIFACT_ID=`mvn -e -U help:evaluate -pl $MODULE -Dexpression=project.artifactId -q -DforceStdout`
- VERSION=`mvn help:evaluate -pl $MODULE -Dexpression=project.version -q -DforceStdout`
- PACKAGING=`mvn help:evaluate -pl $MODULE -Dexpression=project.packaging -q -DforceStdout`
- APP_NAME=$ARTIFACT_ID-$VERSION.$PACKAGING
- echo APP_NAME:$APP_NAME
- cp $MODULE/target/$APP_NAME $JAR_PATH/$APP_NAME && echo 复制新jar包完成
- SERVICE=/usr/lib/systemd/system/xxw-$MODULE.service
- echo SERVICE:$SERVICE
- JAVA_HOME=/software/dragonwell-8.14.15
- echo JAVA_HOME:$JAVA_HOME
- echo "" > $SERVICE
- echo "[Unit]" >> $SERVICE
- echo "Description=$MODULE" >> $SERVICE
- echo "After=syslog.target" >> $SERVICE
- echo "" >> $SERVICE
- echo "[Service]" >> $SERVICE
- echo "EnvironmentFile=/etc/profile" >> $SERVICE
- echo "ExecStart=$JAVA_HOME/bin/java -jar $JAR_PATH/$APP_NAME --spring.profiles.active=prod" >> $SERVICE
- echo "" >> $SERVICE
- echo "[Install]" >> $SERVICE
- echo "WantedBy=multi-user.target" >> $SERVICE
- echo "" >> $SERVICE
- echo 创建新启动脚本完成
- sudo systemctl enable xxw-$MODULE.service && echo 设置开机启动完成
- sudo systemctl daemon-reload
- sudo systemctl restart xxw-$MODULE.service && echo 重启项目完成
- sudo systemctl status xxw-$MODULE.service && MODULE_STATUS=1
- if [ "$MODULE_STATUS" == "1" ]; then echo '查看项目状态成功'; else echo '查看项目状态失败' && xxxx; fi
- MODULE_STATUS=0
- sleep 30 && echo 增加延时
- sudo systemctl status xxw-$MODULE.service && MODULE_STATUS=1
- if [ "$MODULE_STATUS" == "1" ]; then echo '延时查看项目状态成功'; else echo '查看项目状态失败' && xxxx; fi
rules:
# 仅在 shell 分支中执行
# 此处禁用 gitlab.com、jihulab.com、gitcode.net 上的流水线,仅在个人搭建的 gitlab 上运行
- if: $CI_COMMIT_BRANCH == "shell" && $CI_SERVER_HOST != 'gitlab.com' && $CI_SERVER_HOST != 'jihulab.com' && $CI_SERVER_HOST != 'gitcode.net'
tags:
# 仅在 tags 名称为 shell 的执行器上执行
- shell
#
# shell 发布MySQL二进制订阅服务
shell-service-canal:
stage: shell-service
needs:
- job: shell-package
artifacts: true
script:
- JAR_PATH=/home/gitlab-runner/jar/$CI_COMMIT_BRANCH
- echo JAR_PATH:$JAR_PATH
- if [ ! -f $JAR_PATH ]; then sudo mkdir $JAR_PATH -p && echo 创建发布文件夹完成; fi
- cd resource-services-parent
- pwd
- MODULE='canal'
- echo MODULE:$MODULE
- ARTIFACT_ID=`mvn -e -U help:evaluate -pl $MODULE -Dexpression=project.artifactId -q -DforceStdout`
- VERSION=`mvn help:evaluate -pl $MODULE -Dexpression=project.version -q -DforceStdout`
- PACKAGING=`mvn help:evaluate -pl $MODULE -Dexpression=project.packaging -q -DforceStdout`
- APP_NAME=$ARTIFACT_ID-$VERSION.$PACKAGING
- echo APP_NAME:$APP_NAME
- cp $MODULE/target/$APP_NAME $JAR_PATH/$APP_NAME && echo 复制新jar包完成
- SERVICE=/usr/lib/systemd/system/xxw-$MODULE.service
- echo SERVICE:$SERVICE
- JAVA_HOME=/software/dragonwell-8.14.15
- echo JAVA_HOME:$JAVA_HOME
- echo "" > $SERVICE
- echo "[Unit]" >> $SERVICE
- echo "Description=$MODULE" >> $SERVICE
- echo "After=syslog.target" >> $SERVICE
- echo "" >> $SERVICE
- echo "[Service]" >> $SERVICE
- echo "EnvironmentFile=/etc/profile" >> $SERVICE
- echo "ExecStart=$JAVA_HOME/bin/java -jar $JAR_PATH/$APP_NAME --spring.profiles.active=prod" >> $SERVICE
- echo "" >> $SERVICE
- echo "[Install]" >> $SERVICE
- echo "WantedBy=multi-user.target" >> $SERVICE
- echo "" >> $SERVICE
- echo 创建新启动脚本完成
- sudo systemctl enable xxw-$MODULE.service && echo 设置开机启动完成
- sudo systemctl daemon-reload
- sudo systemctl restart xxw-$MODULE.service && echo 重启项目完成
- sudo systemctl status xxw-$MODULE.service && MODULE_STATUS=1
- if [ "$MODULE_STATUS" == "1" ]; then echo '查看项目状态成功'; else echo '查看项目状态失败' && xxxx; fi
- MODULE_STATUS=0
- sleep 30 && echo 增加延时
- sudo systemctl status xxw-$MODULE.service && MODULE_STATUS=1
- if [ "$MODULE_STATUS" == "1" ]; then echo '延时查看项目状态成功'; else echo '查看项目状态失败' && xxxx; fi
rules:
# 仅在 shell 分支中执行
# 此处禁用 gitlab.com、jihulab.com、gitcode.net 上的流水线,仅在个人搭建的 gitlab 上运行
- if: $CI_COMMIT_BRANCH == "shell" && $CI_SERVER_HOST != 'gitlab.com' && $CI_SERVER_HOST != 'jihulab.com' && $CI_SERVER_HOST != 'gitcode.net'
tags:
# 仅在 tags 名称为 shell 的执行器上执行
- shell
#
# shell 发布用户服务
shell-service-user:
stage: shell-service
needs:
- job: shell-package
artifacts: true
script:
- JAR_PATH=/home/gitlab-runner/jar/$CI_COMMIT_BRANCH
- echo JAR_PATH:$JAR_PATH
- if [ ! -f $JAR_PATH ]; then sudo mkdir $JAR_PATH -p && echo 创建发布文件夹完成; fi
- cd resource-services-parent
- pwd
- MODULE='user'
- echo MODULE:$MODULE
- ARTIFACT_ID=`mvn -e -U help:evaluate -pl $MODULE -Dexpression=project.artifactId -q -DforceStdout`
- VERSION=`mvn help:evaluate -pl $MODULE -Dexpression=project.version -q -DforceStdout`
- PACKAGING=`mvn help:evaluate -pl $MODULE -Dexpression=project.packaging -q -DforceStdout`
- APP_NAME=$ARTIFACT_ID-$VERSION.$PACKAGING
- echo APP_NAME:$APP_NAME
- cp $MODULE/target/$APP_NAME $JAR_PATH/$APP_NAME && echo 复制新jar包完成
- SERVICE=/usr/lib/systemd/system/xxw-$MODULE.service
- echo SERVICE:$SERVICE
- JAVA_HOME=/software/dragonwell-8.14.15
- echo JAVA_HOME:$JAVA_HOME
- echo "" > $SERVICE
- echo "[Unit]" >> $SERVICE
- echo "Description=$MODULE" >> $SERVICE
- echo "After=syslog.target" >> $SERVICE
- echo "" >> $SERVICE
- echo "[Service]" >> $SERVICE
- echo "EnvironmentFile=/etc/profile" >> $SERVICE
- echo "ExecStart=$JAVA_HOME/bin/java -jar $JAR_PATH/$APP_NAME --spring.profiles.active=prod" >> $SERVICE
- echo "" >> $SERVICE
- echo "[Install]" >> $SERVICE
- echo "WantedBy=multi-user.target" >> $SERVICE
- echo "" >> $SERVICE
- echo 创建新启动脚本完成
- sudo systemctl enable xxw-$MODULE.service && echo 设置开机启动完成
- sudo systemctl daemon-reload
- sudo systemctl restart xxw-$MODULE.service && echo 重启项目完成
- sudo systemctl status xxw-$MODULE.service && MODULE_STATUS=1
- if [ "$MODULE_STATUS" == "1" ]; then echo '查看项目状态成功'; else echo '查看项目状态失败' && xxxx; fi
- MODULE_STATUS=0
- sleep 30 && echo 增加延时
- sudo systemctl status xxw-$MODULE.service && MODULE_STATUS=1
- if [ "$MODULE_STATUS" == "1" ]; then echo '延时查看项目状态成功'; else echo '查看项目状态失败' && xxxx; fi
rules:
# 仅在 shell 分支中执行
# 此处禁用 gitlab.com、jihulab.com、gitcode.net 上的流水线,仅在个人搭建的 gitlab 上运行
- if: $CI_COMMIT_BRANCH == "shell" && $CI_SERVER_HOST != 'gitlab.com' && $CI_SERVER_HOST != 'jihulab.com' && $CI_SERVER_HOST != 'gitcode.net'
tags:
# 仅在 tags 名称为 shell 的执行器上执行
- shell
#
# shell 发布主数据服务
shell-service-master-data:
stage: shell-service
needs:
- job: shell-package
artifacts: true
script:
- JAR_PATH=/home/gitlab-runner/jar/$CI_COMMIT_BRANCH
- echo JAR_PATH:$JAR_PATH
- if [ ! -f $JAR_PATH ]; then sudo mkdir $JAR_PATH -p && echo 创建发布文件夹完成; fi
- cd resource-services-parent
- pwd
- MODULE='master-data'
- echo MODULE:$MODULE
- ARTIFACT_ID=`mvn -e -U help:evaluate -pl $MODULE -Dexpression=project.artifactId -q -DforceStdout`
- VERSION=`mvn help:evaluate -pl $MODULE -Dexpression=project.version -q -DforceStdout`
- PACKAGING=`mvn help:evaluate -pl $MODULE -Dexpression=project.packaging -q -DforceStdout`
- APP_NAME=$ARTIFACT_ID-$VERSION.$PACKAGING
- echo APP_NAME:$APP_NAME
- cp $MODULE/target/$APP_NAME $JAR_PATH/$APP_NAME && echo 复制新jar包完成
- SERVICE=/usr/lib/systemd/system/xxw-$MODULE.service
- echo SERVICE:$SERVICE
- JAVA_HOME=/software/dragonwell-8.14.15
- echo JAVA_HOME:$JAVA_HOME
- echo "" > $SERVICE
- echo "[Unit]" >> $SERVICE
- echo "Description=$MODULE" >> $SERVICE
- echo "After=syslog.target" >> $SERVICE
- echo "" >> $SERVICE
- echo "[Service]" >> $SERVICE
- echo "EnvironmentFile=/etc/profile" >> $SERVICE
- echo "ExecStart=$JAVA_HOME/bin/java -jar $JAR_PATH/$APP_NAME --spring.profiles.active=prod" >> $SERVICE
- echo "" >> $SERVICE
- echo "[Install]" >> $SERVICE
- echo "WantedBy=multi-master-data.target" >> $SERVICE
- echo "" >> $SERVICE
- echo 创建新启动脚本完成
- sudo systemctl enable xxw-$MODULE.service && echo 设置开机启动完成
- sudo systemctl daemon-reload
- sudo systemctl restart xxw-$MODULE.service && echo 重启项目完成
- sudo systemctl status xxw-$MODULE.service && MODULE_STATUS=1
- if [ "$MODULE_STATUS" == "1" ]; then echo '查看项目状态成功'; else echo '查看项目状态失败' && xxxx; fi
- MODULE_STATUS=0
- sleep 30 && echo 增加延时
- sudo systemctl status xxw-$MODULE.service && MODULE_STATUS=1
- if [ "$MODULE_STATUS" == "1" ]; then echo '延时查看项目状态成功'; else echo '查看项目状态失败' && xxxx; fi
rules:
# 仅在 shell 分支中执行
# 此处禁用 gitlab.com、jihulab.com、gitcode.net 上的流水线,仅在个人搭建的 gitlab 上运行
- if: $CI_COMMIT_BRANCH == "shell" && $CI_SERVER_HOST != 'gitlab.com' && $CI_SERVER_HOST != 'jihulab.com' && $CI_SERVER_HOST != 'gitcode.net'
tags:
# 仅在 tags 名称为 shell 的执行器上执行
- shell
#
# shell 发布WebSocket服务
shell-service-websocket:
stage: shell-service
needs:
- job: shell-package
artifacts: true
script:
- JAR_PATH=/home/gitlab-runner/jar/$CI_COMMIT_BRANCH
- echo JAR_PATH:$JAR_PATH
- if [ ! -f $JAR_PATH ]; then sudo mkdir $JAR_PATH -p && echo 创建发布文件夹完成; fi
- cd resource-services-parent
- pwd
- MODULE='websocket'
- echo MODULE:$MODULE
- ARTIFACT_ID=`mvn -e -U help:evaluate -pl $MODULE -Dexpression=project.artifactId -q -DforceStdout`
- VERSION=`mvn help:evaluate -pl $MODULE -Dexpression=project.version -q -DforceStdout`
- PACKAGING=`mvn help:evaluate -pl $MODULE -Dexpression=project.packaging -q -DforceStdout`
- APP_NAME=$ARTIFACT_ID-$VERSION.$PACKAGING
- echo APP_NAME:$APP_NAME
- cp $MODULE/target/$APP_NAME $JAR_PATH/$APP_NAME && echo 复制新jar包完成
- SERVICE=/usr/lib/systemd/system/xxw-$MODULE.service
- echo SERVICE:$SERVICE
- JAVA_HOME=/software/dragonwell-8.14.15
- echo JAVA_HOME:$JAVA_HOME
- echo "" > $SERVICE
- echo "[Unit]" >> $SERVICE
- echo "Description=$MODULE" >> $SERVICE
- echo "After=syslog.target" >> $SERVICE
- echo "" >> $SERVICE
- echo "[Service]" >> $SERVICE
- echo "EnvironmentFile=/etc/profile" >> $SERVICE
- echo "ExecStart=$JAVA_HOME/bin/java -jar $JAR_PATH/$APP_NAME --spring.profiles.active=prod" >> $SERVICE
- echo "" >> $SERVICE
- echo "[Install]" >> $SERVICE
- echo "WantedBy=multi-user.target" >> $SERVICE
- echo "" >> $SERVICE
- echo 创建新启动脚本完成
- sudo systemctl enable xxw-$MODULE.service && echo 设置开机启动完成
- sudo systemctl daemon-reload
- sudo systemctl restart xxw-$MODULE.service && echo 重启项目完成
- sudo systemctl status xxw-$MODULE.service && MODULE_STATUS=1
- if [ "$MODULE_STATUS" == "1" ]; then echo '查看项目状态成功'; else echo '查看项目状态失败' && xxxx; fi
- MODULE_STATUS=0
- sleep 30 && echo 增加延时
- sudo systemctl status xxw-$MODULE.service && MODULE_STATUS=1
- if [ "$MODULE_STATUS" == "1" ]; then echo '延时查看项目状态成功'; else echo '查看项目状态失败' && xxxx; fi
rules:
# 仅在 shell 分支中执行
# 此处禁用 gitlab.com、jihulab.com、gitcode.net 上的流水线,仅在个人搭建的 gitlab 上运行
- if: $CI_COMMIT_BRANCH == "shell" && $CI_SERVER_HOST != 'gitlab.com' && $CI_SERVER_HOST != 'jihulab.com' && $CI_SERVER_HOST != 'gitcode.net'
tags:
# 仅在 tags 名称为 shell 的执行器上执行
- shell
#
# shell 发布WebService服务
shell-service-webservice:
stage: shell-service
needs:
- job: shell-package
artifacts: true
script:
- JAR_PATH=/home/gitlab-runner/jar/$CI_COMMIT_BRANCH
- echo JAR_PATH:$JAR_PATH
- if [ ! -f $JAR_PATH ]; then sudo mkdir $JAR_PATH -p && echo 创建发布文件夹完成; fi
- cd resource-services-parent
- pwd
- MODULE='webservice'
- echo MODULE:$MODULE
- ARTIFACT_ID=`mvn -e -U help:evaluate -pl $MODULE -Dexpression=project.artifactId -q -DforceStdout`
- VERSION=`mvn help:evaluate -pl $MODULE -Dexpression=project.version -q -DforceStdout`
- PACKAGING=`mvn help:evaluate -pl $MODULE -Dexpression=project.packaging -q -DforceStdout`
- APP_NAME=$ARTIFACT_ID-$VERSION.$PACKAGING
- echo APP_NAME:$APP_NAME
- cp $MODULE/target/$APP_NAME $JAR_PATH/$APP_NAME && echo 复制新jar包完成
- SERVICE=/usr/lib/systemd/system/xxw-$MODULE.service
- echo SERVICE:$SERVICE
- JAVA_HOME=/software/dragonwell-8.14.15
- echo JAVA_HOME:$JAVA_HOME
- echo "" > $SERVICE
- echo "[Unit]" >> $SERVICE
- echo "Description=$MODULE" >> $SERVICE
- echo "After=syslog.target" >> $SERVICE
- echo "" >> $SERVICE
- echo "[Service]" >> $SERVICE
- echo "EnvironmentFile=/etc/profile" >> $SERVICE
- echo "ExecStart=$JAVA_HOME/bin/java -jar $JAR_PATH/$APP_NAME --spring.profiles.active=prod" >> $SERVICE
- echo "" >> $SERVICE
- echo "[Install]" >> $SERVICE
- echo "WantedBy=multi-user.target" >> $SERVICE
- echo "" >> $SERVICE
- echo 创建新启动脚本完成
- sudo systemctl enable xxw-$MODULE.service && echo 设置开机启动完成
- sudo systemctl daemon-reload
- sudo systemctl restart xxw-$MODULE.service && echo 重启项目完成
- sudo systemctl status xxw-$MODULE.service && MODULE_STATUS=1
- if [ "$MODULE_STATUS" == "1" ]; then echo '查看项目状态成功'; else echo '查看项目状态失败' && xxxx; fi
- MODULE_STATUS=0
- sleep 30 && echo 增加延时
- sudo systemctl status xxw-$MODULE.service && MODULE_STATUS=1
- if [ "$MODULE_STATUS" == "1" ]; then echo '延时查看项目状态成功'; else echo '查看项目状态失败' && xxxx; fi
rules:
# 仅在 shell 分支中执行
# 此处禁用 gitlab.com、jihulab.com、gitcode.net 上的流水线,仅在个人搭建的 gitlab 上运行
- if: $CI_COMMIT_BRANCH == "shell" && $CI_SERVER_HOST != 'gitlab.com' && $CI_SERVER_HOST != 'jihulab.com' && $CI_SERVER_HOST != 'gitcode.net'
tags:
# 仅在 tags 名称为 shell 的执行器上执行
- shell
#
# shell 发布微信小程序服务
shell-service-wechat-miniprogram:
stage: shell-service
needs:
- job: shell-package
artifacts: true
script:
- JAR_PATH=/home/gitlab-runner/jar/$CI_COMMIT_BRANCH
- echo JAR_PATH:$JAR_PATH
- if [ ! -f $JAR_PATH ]; then sudo mkdir $JAR_PATH -p && echo 创建发布文件夹完成; fi
- cd resource-services-parent
- pwd
- MODULE='wechat-miniprogram'
- echo MODULE:$MODULE
- ARTIFACT_ID=`mvn -e -U help:evaluate -pl $MODULE -Dexpression=project.artifactId -q -DforceStdout`
- VERSION=`mvn help:evaluate -pl $MODULE -Dexpression=project.version -q -DforceStdout`
- PACKAGING=`mvn help:evaluate -pl $MODULE -Dexpression=project.packaging -q -DforceStdout`
- APP_NAME=$ARTIFACT_ID-$VERSION.$PACKAGING
- echo APP_NAME:$APP_NAME
- cp $MODULE/target/$APP_NAME $JAR_PATH/$APP_NAME && echo 复制新jar包完成
- SERVICE=/usr/lib/systemd/system/xxw-$MODULE.service
- echo SERVICE:$SERVICE
- JAVA_HOME=/software/dragonwell-8.14.15
- echo JAVA_HOME:$JAVA_HOME
- echo "" > $SERVICE
- echo "[Unit]" >> $SERVICE
- echo "Description=$MODULE" >> $SERVICE
- echo "After=syslog.target" >> $SERVICE
- echo "" >> $SERVICE
- echo "[Service]" >> $SERVICE
- echo "EnvironmentFile=/etc/profile" >> $SERVICE
- echo "ExecStart=$JAVA_HOME/bin/java -jar $JAR_PATH/$APP_NAME --spring.profiles.active=prod" >> $SERVICE
- echo "" >> $SERVICE
- echo "[Install]" >> $SERVICE
- echo "WantedBy=multi-user.target" >> $SERVICE
- echo "" >> $SERVICE
- echo 创建新启动脚本完成
- sudo systemctl enable xxw-$MODULE.service && echo 设置开机启动完成
- sudo systemctl daemon-reload
- sudo systemctl restart xxw-$MODULE.service && echo 重启项目完成
- sudo systemctl status xxw-$MODULE.service && MODULE_STATUS=1
- if [ "$MODULE_STATUS" == "1" ]; then echo '查看项目状态成功'; else echo '查看项目状态失败' && xxxx; fi
- MODULE_STATUS=0
- sleep 30 && echo 增加延时
- sudo systemctl status xxw-$MODULE.service && MODULE_STATUS=1
- if [ "$MODULE_STATUS" == "1" ]; then echo '延时查看项目状态成功'; else echo '查看项目状态失败' && xxxx; fi
rules:
# 仅在 shell 分支中执行
# 此处禁用 gitlab.com、jihulab.com、gitcode.net 上的流水线,仅在个人搭建的 gitlab 上运行
- if: $CI_COMMIT_BRANCH == "shell" && $CI_SERVER_HOST != 'gitlab.com' && $CI_SERVER_HOST != 'jihulab.com' && $CI_SERVER_HOST != 'gitcode.net'
tags:
# 仅在 tags 名称为 shell 的执行器上执行
- shell
#
# shell 发布微信公众号服务
shell-service-wechat-offiaccount:
stage: shell-service
needs:
- job: shell-package
artifacts: true
script:
- JAR_PATH=/home/gitlab-runner/jar/$CI_COMMIT_BRANCH
- echo JAR_PATH:$JAR_PATH
- if [ ! -f $JAR_PATH ]; then sudo mkdir $JAR_PATH -p && echo 创建发布文件夹完成; fi
- cd resource-services-parent
- pwd
- MODULE='wechat-offiaccount'
- echo MODULE:$MODULE
- ARTIFACT_ID=`mvn -e -U help:evaluate -pl $MODULE -Dexpression=project.artifactId -q -DforceStdout`
- VERSION=`mvn help:evaluate -pl $MODULE -Dexpression=project.version -q -DforceStdout`
- PACKAGING=`mvn help:evaluate -pl $MODULE -Dexpression=project.packaging -q -DforceStdout`
- APP_NAME=$ARTIFACT_ID-$VERSION.$PACKAGING
- echo APP_NAME:$APP_NAME
- cp $MODULE/target/$APP_NAME $JAR_PATH/$APP_NAME && echo 复制新jar包完成
- SERVICE=/usr/lib/systemd/system/xxw-$MODULE.service
- echo SERVICE:$SERVICE
- JAVA_HOME=/software/dragonwell-8.14.15
- echo JAVA_HOME:$JAVA_HOME
- echo "" > $SERVICE
- echo "[Unit]" >> $SERVICE
- echo "Description=$MODULE" >> $SERVICE
- echo "After=syslog.target" >> $SERVICE
- echo "" >> $SERVICE
- echo "[Service]" >> $SERVICE
- echo "EnvironmentFile=/etc/profile" >> $SERVICE
- echo "ExecStart=$JAVA_HOME/bin/java -jar $JAR_PATH/$APP_NAME --spring.profiles.active=prod" >> $SERVICE
- echo "" >> $SERVICE
- echo "[Install]" >> $SERVICE
- echo "WantedBy=multi-user.target" >> $SERVICE
- echo "" >> $SERVICE
- echo 创建新启动脚本完成
- sudo systemctl enable xxw-$MODULE.service && echo 设置开机启动完成
- sudo systemctl daemon-reload
- sudo systemctl restart xxw-$MODULE.service && echo 重启项目完成
- sudo systemctl status xxw-$MODULE.service && MODULE_STATUS=1
- if [ "$MODULE_STATUS" == "1" ]; then echo '查看项目状态成功'; else echo '查看项目状态失败' && xxxx; fi
- MODULE_STATUS=0
- sleep 30 && echo 增加延时
- sudo systemctl status xxw-$MODULE.service && MODULE_STATUS=1
- if [ "$MODULE_STATUS" == "1" ]; then echo '延时查看项目状态成功'; else echo '查看项目状态失败' && xxxx; fi
rules:
# 仅在 shell 分支中执行
# 此处禁用 gitlab.com、jihulab.com、gitcode.net 上的流水线,仅在个人搭建的 gitlab 上运行
- if: $CI_COMMIT_BRANCH == "shell" && $CI_SERVER_HOST != 'gitlab.com' && $CI_SERVER_HOST != 'jihulab.com' && $CI_SERVER_HOST != 'gitcode.net'
tags:
# 仅在 tags 名称为 shell 的执行器上执行
- shell
#
# shell 发布文件服务
shell-service-file:
stage: shell-service
needs:
- job: shell-package
artifacts: true
script:
- JAR_PATH=/home/gitlab-runner/jar/$CI_COMMIT_BRANCH
- echo JAR_PATH:$JAR_PATH
- if [ ! -f $JAR_PATH ]; then sudo mkdir $JAR_PATH -p && echo 创建发布文件夹完成; fi
- cd resource-services-parent
- pwd
- MODULE='file'
- echo MODULE:$MODULE
- ARTIFACT_ID=`mvn -e -U help:evaluate -pl $MODULE -Dexpression=project.artifactId -q -DforceStdout`
- VERSION=`mvn help:evaluate -pl $MODULE -Dexpression=project.version -q -DforceStdout`
- PACKAGING=`mvn help:evaluate -pl $MODULE -Dexpression=project.packaging -q -DforceStdout`
- APP_NAME=$ARTIFACT_ID-$VERSION.$PACKAGING
- echo APP_NAME:$APP_NAME
- cp $MODULE/target/$APP_NAME $JAR_PATH/$APP_NAME && echo 复制新jar包完成
- SERVICE=/usr/lib/systemd/system/xxw-$MODULE.service
- echo SERVICE:$SERVICE
- JAVA_HOME=/software/dragonwell-8.14.15
- echo JAVA_HOME:$JAVA_HOME
- echo "" > $SERVICE
- echo "[Unit]" >> $SERVICE
- echo "Description=$MODULE" >> $SERVICE
- echo "After=syslog.target" >> $SERVICE
- echo "" >> $SERVICE
- echo "[Service]" >> $SERVICE
- echo "EnvironmentFile=/etc/profile" >> $SERVICE
- echo "ExecStart=$JAVA_HOME/bin/java -jar $JAR_PATH/$APP_NAME --spring.profiles.active=prod" >> $SERVICE
- echo "" >> $SERVICE
- echo "[Install]" >> $SERVICE
- echo "WantedBy=multi-user.target" >> $SERVICE
- echo "" >> $SERVICE
- echo 创建新启动脚本完成
- sudo systemctl enable xxw-$MODULE.service && echo 设置开机启动完成
- sudo systemctl daemon-reload
- sudo systemctl restart xxw-$MODULE.service && echo 重启项目完成
- sudo systemctl status xxw-$MODULE.service && MODULE_STATUS=1
- if [ "$MODULE_STATUS" == "1" ]; then echo '查看项目状态成功'; else echo '查看项目状态失败' && xxxx; fi
- MODULE_STATUS=0
- sleep 30 && echo 增加延时
- sudo systemctl status xxw-$MODULE.service && MODULE_STATUS=1
- if [ "$MODULE_STATUS" == "1" ]; then echo '延时查看项目状态成功'; else echo '查看项目状态失败' && xxxx; fi
rules:
# 仅在 shell 分支中执行
# 此处禁用 gitlab.com、jihulab.com、gitcode.net 上的流水线,仅在个人搭建的 gitlab 上运行
- if: $CI_COMMIT_BRANCH == "shell" && $CI_SERVER_HOST != 'gitlab.com' && $CI_SERVER_HOST != 'jihulab.com' && $CI_SERVER_HOST != 'gitcode.net'
tags:
# 仅在 tags 名称为 shell 的执行器上执行
- shell
#
# shell 发布 XXL Job
shell-service-xxl-job-admin:
stage: shell-service
needs:
- job: shell-package
artifacts: true
script:
- JAR_PATH=/home/gitlab-runner/jar/$CI_COMMIT_BRANCH
- echo JAR_PATH:$JAR_PATH
- if [ ! -f $JAR_PATH ]; then sudo mkdir $JAR_PATH -p && echo 创建发布文件夹完成; fi
- MODULE='xxl-job-admin'
- echo MODULE:$MODULE
- ARTIFACT_ID=`mvn -e -U help:evaluate -pl $MODULE -Dexpression=project.artifactId -q -DforceStdout`
- VERSION=`mvn help:evaluate -pl $MODULE -Dexpression=project.version -q -DforceStdout`
- PACKAGING=`mvn help:evaluate -pl $MODULE -Dexpression=project.packaging -q -DforceStdout`
- APP_NAME=$ARTIFACT_ID-$VERSION.$PACKAGING
- echo APP_NAME:$APP_NAME
- cp $MODULE/target/$APP_NAME $JAR_PATH/$APP_NAME && echo 复制新jar包完成
- SERVICE=/usr/lib/systemd/system/xxw-$MODULE.service
- echo SERVICE:$SERVICE
- JAVA_HOME=/software/dragonwell-8.14.15
- echo JAVA_HOME:$JAVA_HOME
- echo "" > $SERVICE
- echo "[Unit]" >> $SERVICE
- echo "Description=$MODULE" >> $SERVICE
- echo "After=syslog.target" >> $SERVICE
- echo "" >> $SERVICE
- echo "[Service]" >> $SERVICE
- echo "EnvironmentFile=/etc/profile" >> $SERVICE
- echo "ExecStart=$JAVA_HOME/bin/java -jar $JAR_PATH/$APP_NAME --spring.profiles.active=prod" >> $SERVICE
- echo "" >> $SERVICE
- echo "[Install]" >> $SERVICE
- echo "WantedBy=multi-user.target" >> $SERVICE
- echo "" >> $SERVICE
- echo 创建新启动脚本完成
- sudo systemctl enable xxw-$MODULE.service && echo 设置开机启动完成
- sudo systemctl daemon-reload
- sudo systemctl restart xxw-$MODULE.service && echo 重启项目完成
- sudo systemctl status xxw-$MODULE.service && MODULE_STATUS=1
- if [ "$MODULE_STATUS" == "1" ]; then echo '查看项目状态成功'; else echo '查看项目状态失败' && xxxx; fi
- MODULE_STATUS=0
- sleep 30 && echo 增加延时
- sudo systemctl status xxw-$MODULE.service && MODULE_STATUS=1
- if [ "$MODULE_STATUS" == "1" ]; then echo '延时查看项目状态成功'; else echo '查看项目状态失败' && xxxx; fi
rules:
# 仅在 shell 分支中执行
# 此处禁用 gitlab.com、jihulab.com、gitcode.net 上的流水线,仅在个人搭建的 gitlab 上运行
- if: $CI_COMMIT_BRANCH == "shell" && $CI_SERVER_HOST != 'gitlab.com' && $CI_SERVER_HOST != 'jihulab.com' && $CI_SERVER_HOST != 'gitcode.net'
tags:
# 仅在 tags 名称为 shell 的执行器上执行
- shell
#
# shell 发布UI服务
shell-service-ui:
stage: shell-service
needs:
- job: shell-package
artifacts: true
script:
- MODULE='ui'
- echo MODULE:$MODULE
- RELEASE_PATH=/home/gitlab-runner/node/$MODULE
- if [ ! -f $RELEASE_PATH ]; then sudo mkdir $RELEASE_PATH -p && echo 创建文件夹完成; fi
- echo RELEASE_PATH:$RELEASE_PATH
- if [ ! -f $RELEASE_PATH ]; then sudo mkdir $RELEASE_PATH -p && echo 创建发布文件夹完成; fi
- cp -r ./$MODULE/dist/* $RELEASE_PATH && echo 复制新文件夹完成
rules:
# 仅在 shell 分支中执行
# 此处禁用 gitlab.com、jihulab.com、gitcode.net 上的流水线,仅在个人搭建的 gitlab 上运行
- if: $CI_COMMIT_BRANCH == "shell" && $CI_SERVER_HOST != 'gitlab.com' && $CI_SERVER_HOST != 'jihulab.com' && $CI_SERVER_HOST != 'gitcode.net'
tags:
# 仅在 tags 名称为 shell 的执行器上执行
- shell
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Java
1
https://gitee.com/ustcck/xuxiaowei-cloud.git
git@gitee.com:ustcck/xuxiaowei-cloud.git
ustcck
xuxiaowei-cloud
xuxiaowei-cloud
main

搜索帮助

0d507c66 1850385 C8b1a773 1850385