代码拉取完成,页面将自动刷新
同步操作将从 若依/RuoYi-Cloud 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
pipeline {
agent {
node {
label 'maven'
}
}
stages {
stage('拉取代码') {
agent none
steps {
container('maven') {
git(url: 'https://gitee.com/fulinzhongguo/RuoYi-Cloud.git', branch: 'master', changelog: true, poll: false)
sh 'ls'
}
}
}
stage('打包构建') {
agent none
steps {
container('maven') {
sh 'mvn clean package -Dmaven.test.skip=true '
sh 'ls ruoyi-modules/ruoyi-system/target/'
}
}
}
stage('构建镜像 & 上传镜像') {
parallel {
stage('ruoyi-system') {
agent none
steps {
container('maven') {
sh 'docker build -f ruoyi-modules/ruoyi-system/Dockerfile -t $REGISTRY/$DOCKERHUB_NAMESPACE/ruoyi-system:$BUILD_NUMBER ruoyi-modules/ruoyi-system/'
withCredentials([usernamePassword(credentialsId : 'dockerhub-id' ,usernameVariable : 'DOCKER_USERNAME' ,passwordVariable : 'DOCKER_PASSWORD' ,)]) {
sh 'echo "$DOCKER_PASSWORD" | docker login $REGISTRY -u "$DOCKER_USERNAME" --password-stdin'
sh 'docker images | grep ruoyi-system'
sh 'docker push $REGISTRY/$DOCKERHUB_NAMESPACE/ruoyi-system:$BUILD_NUMBER'
}
}
}
}
stage('ruoyi-job') {
agent none
steps {
container('maven') {
sh 'docker build -f ruoyi-modules/ruoyi-job/Dockerfile -t $REGISTRY/$DOCKERHUB_NAMESPACE/ruoyi-job:$BUILD_NUMBER ruoyi-modules/ruoyi-job/'
withCredentials([usernamePassword(credentialsId : 'dockerhub-id' ,usernameVariable : 'DOCKER_USERNAME' ,passwordVariable : 'DOCKER_PASSWORD' ,)]) {
sh 'echo "$DOCKER_PASSWORD" | docker login $REGISTRY -u "$DOCKER_USERNAME" --password-stdin'
sh 'docker images | grep ruoyi-job'
sh 'docker push $REGISTRY/$DOCKERHUB_NAMESPACE/ruoyi-job:$BUILD_NUMBER'
}
}
}
}
stage('ruoyi-gen') {
agent none
steps {
container('maven') {
sh 'docker build -f ruoyi-modules/ruoyi-gen/Dockerfile -t $REGISTRY/$DOCKERHUB_NAMESPACE/ruoyi-gen:$BUILD_NUMBER ruoyi-modules/ruoyi-gen/'
withCredentials([usernamePassword(credentialsId : 'dockerhub-id' ,usernameVariable : 'DOCKER_USERNAME' ,passwordVariable : 'DOCKER_PASSWORD' ,)]) {
sh 'echo "$DOCKER_PASSWORD" | docker login $REGISTRY -u "$DOCKER_USERNAME" --password-stdin'
sh 'docker images | grep ruoyi-gen'
sh 'docker push $REGISTRY/$DOCKERHUB_NAMESPACE/ruoyi-gen:$BUILD_NUMBER'
}
}
}
}
stage('ruoyi-file') {
agent none
steps {
container('maven') {
sh 'docker build -f ruoyi-modules/ruoyi-file/Dockerfile -t $REGISTRY/$DOCKERHUB_NAMESPACE/ruoyi-file:$BUILD_NUMBER ruoyi-modules/ruoyi-file/'
withCredentials([usernamePassword(credentialsId : 'dockerhub-id' ,usernameVariable : 'DOCKER_USERNAME' ,passwordVariable : 'DOCKER_PASSWORD' ,)]) {
sh 'echo "$DOCKER_PASSWORD" | docker login $REGISTRY -u "$DOCKER_USERNAME" --password-stdin'
sh 'docker images | grep ruoyi-file'
sh 'docker push $REGISTRY/$DOCKERHUB_NAMESPACE/ruoyi-file:$BUILD_NUMBER'
}
}
}
}
stage('ruoyi-monitor') {
agent none
steps {
container('maven') {
sh 'docker build -f ruoyi-visual/ruoyi-monitor/Dockerfile -t $REGISTRY/$DOCKERHUB_NAMESPACE/ruoyi-monitor:$BUILD_NUMBER ruoyi-visual/ruoyi-monitor/'
withCredentials([usernamePassword(credentialsId : 'dockerhub-id' ,usernameVariable : 'DOCKER_USERNAME' ,passwordVariable : 'DOCKER_PASSWORD' ,)]) {
sh 'echo "$DOCKER_PASSWORD" | docker login $REGISTRY -u "$DOCKER_USERNAME" --password-stdin'
sh 'docker images | grep ruoyi-monitor'
sh 'docker push $REGISTRY/$DOCKERHUB_NAMESPACE/ruoyi-monitor:$BUILD_NUMBER'
}
}
}
}
stage('ruoyi-auth') {
agent none
steps {
container('maven') {
sh 'docker build -f ruoyi-auth/Dockerfile -t $REGISTRY/$DOCKERHUB_NAMESPACE/ruoyi-auth:$BUILD_NUMBER ruoyi-auth/'
withCredentials([usernamePassword(credentialsId : 'dockerhub-id' ,usernameVariable : 'DOCKER_USERNAME' ,passwordVariable : 'DOCKER_PASSWORD' ,)]) {
sh 'echo "$DOCKER_PASSWORD" | docker login $REGISTRY -u "$DOCKER_USERNAME" --password-stdin'
sh 'docker images | grep ruoyi-auth'
sh 'docker push $REGISTRY/$DOCKERHUB_NAMESPACE/ruoyi-auth:$BUILD_NUMBER'
}
}
}
}
stage('ruoyi-gateway') {
agent none
steps {
container('maven') {
sh 'docker build -f ruoyi-gateway/Dockerfile -t $REGISTRY/$DOCKERHUB_NAMESPACE/ruoyi-gateway:$BUILD_NUMBER ruoyi-gateway/'
withCredentials([usernamePassword(credentialsId : 'dockerhub-id' ,usernameVariable : 'DOCKER_USERNAME' ,passwordVariable : 'DOCKER_PASSWORD' ,)]) {
sh 'echo "$DOCKER_PASSWORD" | docker login $REGISTRY -u "$DOCKER_USERNAME" --password-stdin'
sh 'docker images | grep ruoyi-gateway'
sh 'docker push $REGISTRY/$DOCKERHUB_NAMESPACE/ruoyi-gateway:$BUILD_NUMBER'
}
}
}
}
}
}
stage('default-3') {
parallel {
stage('部署 ruoyi-system') {
agent none
steps {
container ('maven') {
input(message: '''@admin
部署吗''', submitter: 'admin')
stage ("deploy ${service}") {
println "即将部署的服务是$APP_NAME"
withCredentials([
kubeconfigFile(
credentialsId: env.KUBECONFIG_CREDENTIAL_ID,
variable: 'KUBECONFIG')
]) {
//ruoyi-gateway/deploy/deployment.yaml
//sh "envsubst < deploy/${params.Environments}/devops.yaml | kubectl apply -f -"
sh "ls -lh"
sh "pwd"
sh "envsubst < ruoyi-modules/ruoyi-system/deploy/deployment.yaml | kubectl apply -f -"
}
}
echo 'ruoyi-system 部署成功'
}
}
}
stage('部署 ruoyi-job') {
agent none
steps {
input(message: '''@admin
部署吗''', submitter: 'admin')
kubernetesDeploy(enableConfigSubstitution: true, deleteResource: false, kubeconfigId: 'demo-kubeconfig', configs: 'ruoyi-modules/ruoyi-job/deploy/**')
echo 'ruoyi-job 部署成功'
}
}
stage('部署 ruoyi-gen') {
agent none
steps {
input(message: '''@admin
部署吗''', submitter: 'admin')
kubernetesDeploy(enableConfigSubstitution: true, deleteResource: false, kubeconfigId: 'demo-kubeconfig', configs: 'ruoyi-modules/ruoyi-gen/deploy/**')
echo 'ruoyi-gen 部署成功'
}
}
stage('部署 ruoyi-file') {
agent none
steps {
input(message: '''@admin
部署吗''', submitter: 'admin')
kubernetesDeploy(enableConfigSubstitution: true, deleteResource: false, kubeconfigId: 'demo-kubeconfig', configs: 'ruoyi-modules/ruoyi-file/deploy/**')
echo 'ruoyi-file 部署成功'
}
}
stage('部署 ruoyi-monitor') {
agent none
steps {
input(message: '''@admin
部署吗''', submitter: 'admin')
kubernetesDeploy(enableConfigSubstitution: true, deleteResource: false, kubeconfigId: 'demo-kubeconfig', configs: 'ruoyi-visual/ruoyi-monitor/deploy/**')
echo 'ruoyi-monitor 部署成功'
}
}
stage('部署 ruoyi-auth') {
agent none
steps {
input(message: '''@admin
部署吗''', submitter: 'admin')
kubernetesDeploy(enableConfigSubstitution: true, deleteResource: false, kubeconfigId: 'demo-kubeconfig', configs: 'ruoyi-auth/deploy/**')
echo 'ruoyi-auth 部署成功'
}
}
stage('部署 ruoyi-gateway') {
agent none
steps {
input(message: '''@admin
部署吗''', submitter: 'admin')
kubernetesDeploy(enableConfigSubstitution: true, deleteResource: false, kubeconfigId: 'demo-kubeconfig', configs: 'ruoyi-gateway/deploy/**')
echo 'ruoyi-gateway 部署成功'
}
}
}
}
stage('发送邮件') {
agent none
steps {
mail(to: '755907724@qq.com', cc: 'fulinzhongguo@163.com', subject: "$APP_NAME 部署成功", body: "$APP_NAME - $BRANCH_NAME 分支 部署成功")
}
}
stage('是否要部署到生产环境') {
agent none
when {
branch 'master'
}
steps {
input(message: '@admin 是否要部署到生产环境', submitter: 'admin')
}
}
}
environment {
DOCKER_CREDENTIAL_ID = 'dockerhub-id'
GITHUB_CREDENTIAL_ID = 'github-id'
KUBECONFIG_CREDENTIAL_ID = 'demo-kubeconfig'
REGISTRY = 'harbor.yunzhicloud.com:3443'
DOCKERHUB_NAMESPACE = 'ruoyi'
GITHUB_ACCOUNT = 'kubesphere'
APP_NAME = 'unify-user-dev'
BRANCH_NAME = 'master'
}
parameters {
string(name: 'TAG_NAME', defaultValue: '', description: '')
}
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。