1 Star 0 Fork 14.9K

付志远/不死神王后端

forked from 若依/RuoYi-Cloud 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
Jenkinsfile 4.59 KB
一键复制 编辑 原始数据 按行查看 历史
付志远 提交于 2024-02-16 16:54 . 创建流水线文件
pipeline {
agent {
node {
label 'mavenjdk17'
}
}
stages {
stage('拉取代码') {
agent none
steps {
git(credentialsId: 'gitee', url: 'https://gitee.com/mayade5664/busishenwang-java-service.git', branch: 'dev', changelog: true, poll: false)
}
}
stage('单元测试') {
agent none
steps {
container('maven') {
sh 'mvn clean test'
}
}
}
stage('代码分析') {
agent none
steps {
container('maven') {
withCredentials([string(credentialsId : 'sonar-token' ,variable : 'SONAR_TOKEN' ,)]) {
withSonarQubeEnv('sonar') {
sh 'mvn sonar:sonar -Dsonar.login=$SONAR_TOKEN'
}
}
timeout(unit: 'HOURS', activity: true, time: 1) {
waitForQualityGate 'true'
}
}
}
}
stage('构建打包') {
agent none
steps {
container('maven') {
sh 'mvn -Dmaven.test.skip=true clean package'
sh '''
cp ./ruoyi-gateway/target/ruoyi-gateway.jar ./docker/ruoyi/gateway/jar
cp ./ruoyi-auth/target/ruoyi-auth.jar ./docker/ruoyi/auth/jar
cp ./ruoyi-visual/ruoyi-monitor/target/ruoyi-visual-monitor.jar ./docker/ruoyi/visual/monitor/jar
cp ./ruoyi-modules/ruoyi-system/target/ruoyi-modules-system.jar ./docker/ruoyi/modules/system/jar
cp ./ruoyi-modules/ruoyi-file/target/ruoyi-modules-file.jar ./docker/ruoyi/modules/file/jar
cp ./ruoyi-modules/ruoyi-job/target/ruoyi-modules-job.jar ./docker/ruoyi/modules/job/jar
cp ./ruoyi-modules/ruoyi-gen/target/ruoyi-modules-gen.jar ./docker/ruoyi/modules/gen/jar
cp ./ruoyi-modules/busishenwang-novel/target/busishenwang-novel.jar ./docker/ruoyi/modules/novel/jar
cp ./ruoyi-modules/busishenwang-search/target/busishenwang-search.jar ./docker/ruoyi/modules/search/jar'''
}
}
}
stage('构建镜像-推送镜像') {
agent none
steps {
container('maven') {
sh '''docker build -t mayadebi/ruoyi-auth:v$BUILD_NUMBER ./docker/ruoyi/auth
docker build -t mayadebi/ruoyi-auth:latest ./docker/ruoyi/auth
docker build -t mayadebi/ruoyi-gateway:v$BUILD_NUMBER ./docker/ruoyi/gateway
docker build -t mayadebi/ruoyi-gateway:latest ./docker/ruoyi/gateway
docker build -t mayadebi/ruoyi-file:v$BUILD_NUMBER ./docker/ruoyi/modules/file
docker build -t mayadebi/ruoyi-file:latest ./docker/ruoyi/modules/file
docker build -t mayadebi/ruoyi-gen:v$BUILD_NUMBER ./docker/ruoyi/modules/gen
docker build -t mayadebi/ruoyi-gen:latest ./docker/ruoyi/modules/gen
docker build -t mayadebi/ruoyi-job:v$BUILD_NUMBER ./docker/ruoyi/modules/job
docker build -t mayadebi/ruoyi-job:latest ./docker/ruoyi/modules/job
docker build -t mayadebi/busishenwang-novel:v$BUILD_NUMBER ./docker/ruoyi/modules/novel
docker build -t mayadebi/busishenwang-novel:latest ./docker/ruoyi/modules/novel
docker build -t mayadebi/busishenwang-search:v$BUILD_NUMBER ./docker/ruoyi/modules/search
docker build -t mayadebi/busishenwang-search:latest ./docker/ruoyi/modules/search
docker build -t mayadebi/ruoyi-monitor:v$BUILD_NUMBER ./docker/ruoyi/visual/monitor
docker build -t mayadebi/ruoyi-monitor:latest ./docker/ruoyi/visual/monitor'''
withCredentials([usernamePassword(credentialsId : 'dockerhub-id' ,passwordVariable : 'DOCKER_PASSWORD' ,usernameVariable : 'DOCKER_USERNAME' ,)]) {
sh 'docker login -u fzyqetuo5664@gmail.com -p fzy123456'
sh '''docker push mayadebi/busishenwang-search:latest
docker push mayadebi/ruoyi-auth:latest
docker push mayadebi/ruoyi-gateway:latest
docker push mayadebi/ruoyi-file:latest
docker push mayadebi/ruoyi-gen:latest
docker push mayadebi/ruoyi-job:latest
docker push mayadebi/busishenwang-novel:latest
docker push mayadebi/ruoyi-monitor:latest
docker push mayadebi/ruoyi-auth:v$BUILD_NUMBER
docker push mayadebi/ruoyi-gateway:v$BUILD_NUMBER
docker push mayadebi/ruoyi-file:v$BUILD_NUMBER
docker push mayadebi/ruoyi-gen:v$BUILD_NUMBER
docker push mayadebi/ruoyi-job:v$BUILD_NUMBER
docker push mayadebi/busishenwang-novel:v$BUILD_NUMBER
docker push mayadebi/busishenwang-search:v$BUILD_NUMBER
docker push mayadebi/ruoyi-monitor:v$BUILD_NUMBER
'''
}
}
}
}
stage('推送版本到git') {
agent none
steps {
container('maven') {
sh 'git config --global user.email "503991583@qq.com" '
sh 'git config --global user.name "mayadebi" '
sh 'git tag -a v$BUILD_NUMBER -m "v$BUILD_NUMBER" '
sh 'git push http://17689411237:fzy123456@gitee.com/mayade5664/busishenwang-java-service.git --tags --ipv4'
}
}
}
}
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Java
1
https://gitee.com/mayade5664/busishenwang-java-service.git
git@gitee.com:mayade5664/busishenwang-java-service.git
mayade5664
busishenwang-java-service
不死神王后端
master

搜索帮助

0d507c66 1850385 C8b1a773 1850385