代码拉取完成,页面将自动刷新
pipeline {
agent {
node {
label 'maven'
}
}
stages {
stage('拉取代码') {
agent none
steps {
container('maven') {
git(url: 'https://gitee.com/afumu/ruoyi-cloud.git', changelog: true, poll: false)
sh 'ls -l'
}
}
}
stage('项目编译') {
agent none
steps {
container('maven') {
sh 'ls -l'
sh 'mvn package'
}
}
}
stage('default-2') {
parallel {
stage('1.构建ruoyi-auth镜像') {
agent none
steps {
container('maven') {
sh 'ls ruoyi-auth -l'
sh 'docker build -t ruoyi-auth:latest -f ruoyi-auth/dockerfile ruoyi-auth'
}
}
}
stage('2.构建ruoyi-file镜像') {
agent none
steps {
container('maven') {
sh 'ls ruoyi-modules/ruoyi-file -l'
sh 'docker build -t ruoyi-file:latest -f ruoyi-modules/ruoyi-file/dockerfile ruoyi-modules/ruoyi-file'
}
}
}
stage('3.构建ruoyi-gateway镜像') {
agent none
steps {
container('maven') {
sh 'ls ruoyi-gateway -l'
sh 'docker build -t ruoyi-gateway:latest -f ruoyi-gateway/dockerfile ruoyi-gateway'
}
}
}
stage('4.构建ruoyi-job镜像') {
agent none
steps {
container('maven') {
sh 'ls ruoyi-modules/ruoyi-job -l'
sh 'docker build -t ruoyi-job:latest -f ruoyi-modules/ruoyi-job/dockerfile ruoyi-modules/ruoyi-job'
}
}
}
stage('5.构建ruoyi-monitor镜像') {
agent none
steps {
container('maven') {
sh 'ls ruoyi-visual/ruoyi-monitor -l'
sh 'docker build -t ruoyi-monitor:latest -f ruoyi-visual/ruoyi-monitor/dockerfile ruoyi-visual/ruoyi-monitor'
}
}
}
stage('6.构建ruoyi-system镜像') {
agent none
steps {
container('maven') {
sh 'ls ruoyi-modules/ruoyi-system -l'
sh 'docker build -t ruoyi-system:latest -f ruoyi-modules/ruoyi-system/dockerfile ruoyi-modules/ruoyi-system'
}
}
}
}
}
stage('default-3') {
parallel {
stage('1.推送ruoyi-auth镜像') {
agent none
steps {
container('maven') {
sh 'docker tag ruoyi-auth:latest $REGISTRY/$DOCKERHUB_NAMESPACE/ruoyi-auth:SNAPSHOT-$BUILD_NUMBER'
sh 'docker push $REGISTRY/$DOCKERHUB_NAMESPACE/ruoyi-auth:SNAPSHOT-$BUILD_NUMBER'
}
}
}
stage('2.推送ruoyi-file镜像') {
agent none
steps {
container('maven') {
sh 'docker tag ruoyi-file:latest $REGISTRY/$DOCKERHUB_NAMESPACE/ruoyi-file:SNAPSHOT-$BUILD_NUMBER'
sh 'docker push $REGISTRY/$DOCKERHUB_NAMESPACE/ruoyi-file:SNAPSHOT-$BUILD_NUMBER'
}
}
}
stage('3.推送ruoyi-gateway镜像') {
agent none
steps {
container('maven') {
sh 'docker tag ruoyi-gateway:latest $REGISTRY/$DOCKERHUB_NAMESPACE/ruoyi-gateway:SNAPSHOT-$BUILD_NUMBER'
sh 'docker push $REGISTRY/$DOCKERHUB_NAMESPACE/ruoyi-gateway:SNAPSHOT-$BUILD_NUMBER'
}
}
}
stage('4.推送ruoyi-job镜像') {
agent none
steps {
container('maven') {
sh 'docker tag ruoyi-job:latest $REGISTRY/$DOCKERHUB_NAMESPACE/ruoyi-job:SNAPSHOT-$BUILD_NUMBER'
sh 'docker push $REGISTRY/$DOCKERHUB_NAMESPACE/ruoyi-job:SNAPSHOT-$BUILD_NUMBER'
}
}
}
stage('5.推送ruoyi-monitor镜像') {
agent none
steps {
container('maven') {
sh 'docker tag ruoyi-monitor:latest $REGISTRY/$DOCKERHUB_NAMESPACE/ruoyi-monitor:SNAPSHOT-$BUILD_NUMBER'
sh 'docker push $REGISTRY/$DOCKERHUB_NAMESPACE/ruoyi-monitor:SNAPSHOT-$BUILD_NUMBER'
}
}
}
stage('6.推送ruoyi-system镜像') {
agent none
steps {
container('maven') {
sh 'docker tag ruoyi-system:latest $REGISTRY/$DOCKERHUB_NAMESPACE/ruoyi-system:SNAPSHOT-$BUILD_NUMBER'
sh 'docker push $REGISTRY/$DOCKERHUB_NAMESPACE/ruoyi-system:SNAPSHOT-$BUILD_NUMBER'
}
}
}
}
}
stage('default-4') {
parallel {
stage('1.部署ruoyi-monitor服务') {
agent none
steps {
container('maven') {
withCredentials([kubeconfigContent(credentialsId : 'demo-kubeconfig' ,variable : '' ,)]) {
sh 'mkdir -p ~/.kube/'
sh 'echo "$KUBECONFIG_CONFIG" > ~/.kube/config'
sh 'envsubst < ruoyi-visual/ruoyi-monitor/deploy/deploy.yml | kubectl apply -f -'
}
}
}
}
stage('2.部署ruoyi-system服务') {
agent none
steps {
container('maven') {
withCredentials([kubeconfigContent(credentialsId : 'demo-kubeconfig' ,variable : '' ,)]) {
sh 'mkdir -p ~/.kube/'
sh 'echo "$KUBECONFIG_CONFIG" > ~/.kube/config'
sh 'envsubst < ruoyi-modules/ruoyi-system/deploy/deploy.yml | kubectl apply -f -'
}
}
}
}
stage('3.部署ruoyi-job服务') {
agent none
steps {
container('maven') {
withCredentials([kubeconfigContent(credentialsId : 'demo-kubeconfig' ,variable : '' ,)]) {
sh 'mkdir -p ~/.kube/'
sh 'echo "$KUBECONFIG_CONFIG" > ~/.kube/config'
sh 'envsubst < ruoyi-modules/ruoyi-job/deploy/deploy.yml | kubectl apply -f -'
}
}
}
}
stage('4.部署ruoyi-gateway服务') {
agent none
steps {
container('maven') {
withCredentials([kubeconfigContent(credentialsId : 'demo-kubeconfig' ,variable : '' ,)]) {
sh 'mkdir -p ~/.kube/'
sh 'echo "$KUBECONFIG_CONFIG" > ~/.kube/config'
sh 'envsubst < ruoyi-gateway/deploy/deploy.yml | kubectl apply -f -'
}
}
}
}
stage('5.部署ruoyi-modules服务') {
agent none
steps {
container('maven') {
withCredentials([kubeconfigContent(credentialsId : 'demo-kubeconfig' ,variable : '' ,)]) {
sh 'mkdir -p ~/.kube/'
sh 'echo "$KUBECONFIG_CONFIG" > ~/.kube/config'
sh 'envsubst < ruoyi-modules/ruoyi-file/deploy/deploy.yml | kubectl apply -f -'
}
}
}
}
stage('6.部署ruoyi-auth服务') {
agent none
steps {
container('maven') {
withCredentials([kubeconfigContent(credentialsId : 'demo-kubeconfig' ,variable : '' ,)]) {
sh 'mkdir -p ~/.kube/'
sh 'echo "$KUBECONFIG_CONFIG" > ~/.kube/config'
sh 'envsubst < ruoyi-auth/deploy/deploy.yml | kubectl apply -f -'
}
}
}
}
}
}
}
environment {
DOCKER_CREDENTIAL_ID = 'dockerhub-id'
GITHUB_CREDENTIAL_ID = 'github-id'
KUBECONFIG_CREDENTIAL_ID = 'demo-kubeconfig'
REGISTRY = '192.168.1.10:5000'
DOCKERHUB_NAMESPACE = 'ruoyi'
GITHUB_ACCOUNT = 'kubesphere'
APP_NAME = 'devops-java-sample'
}
parameters {
string(name: 'TAG_NAME', defaultValue: '', description: '')
}
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。