代码拉取完成,页面将自动刷新
同步操作将从 纵遇/cloud_api 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
pipeline {
agent {
node {
label 'maven'
}
}
stages {
stage('拉取代码') {
agent none
steps {
container('maven') {
git(url: 'https://gitee.com/yswyn_admin/cloud_api.git', credentialsId: 'gitee', branch: 'master', changelog: true, poll: false)
sh 'ls -al'
}
}
}
stage('项目编译') {
agent none
steps {
container('maven') {
sh 'ls'
sh 'mvn clean'
sh 'mvn install'
}
}
}
stage('构建镜像') {
parallel {
stage('构建cloud-admin镜像') {
agent none
steps {
container('maven') {
sh 'docker build -t cloud-admin:latest -f ./cloud_admin/Dockerfile ./cloud-admin/'
}
}
}
stage('构建cloud_data镜像') {
agent none
steps {
container('maven') {
sh 'docker build -t cloud_data:latest -f ./cloud_data/Dockerfile ./cloud_data/'
}
}
}
stage('构建cloud_gateway镜像') {
agent none
steps {
container('maven') {
sh 'docker build -t cloud_gateway:latest -f ./cloud_gateway/Dockerfile ./cloud_gateway/'
}
}
}
stage('构建cloud_log镜像') {
agent none
steps {
container('maven') {
sh 'docker build -t cloud_log:latest -f ./cloud_log/Dockerfile ./cloud_log/'
}
}
}
stage('构建cloud_login镜像') {
agent none
steps {
container('maven') {
sh 'docker build -t cloud_login:latest -f ./cloud_login/Dockerfile ./cloud_login/'
}
}
}
stage('构建cloud_party镜像') {
agent none
steps {
container('maven') {
sh 'docker build -t cloud_party:latest -f ./cloud_party/Dockerfile ./cloud_party/'
}
}
}
stage('构建cloud_production镜像') {
agent none
steps {
container('maven') {
sh 'docker build -t cloud_production:latest -f ./cloud_production/Dockerfile ./cloud_production/'
}
}
}
stage('构建cloud_ouath镜像') {
agent none
steps {
container('maven') {
sh 'docker build -t cloud_ouath:latest -f ./cloud_ouath/Dockerfile ./cloud_ouath/'
}
}
}
}
}
stage('推送镜像') {
parallel {
stage('推送cloud_admin镜像') {
agent none
steps {
container('maven') {
withCredentials([usernamePassword(credentialsId : 'aliyun-docker-registry' ,usernameVariable : 'DOCKER_USERNAME' ,passwordVariable : 'DOCKER_PASSWORD' ,)]) {
sh 'echo "$DOCKER_PASSWORD" | docker login $REGISTRY -u "$DOCKER_USERNAME" --password-stdin'
sh 'docker tag cloud_admin:latest $REGISTRY/$DOCKERHUB_NAMESPACE/cloud_admin:SNAPSHOT-$BUILD_NUMBER'
sh 'docker push $REGISTRY/$DOCKERHUB_NAMESPACE/cloud_admin:SNAPSHOT-$BUILD_NUMBER'
}
}
}
}
stage('推送cloud_data镜像') {
agent none
steps {
container('maven') {
withCredentials([usernamePassword(credentialsId : 'aliyun-docker-registry' ,usernameVariable : 'DOCKER_USERNAME' ,passwordVariable : 'DOCKER_PASSWORD' ,)]) {
sh 'echo "$DOCKER_PASSWORD" | docker login $REGISTRY -u "$DOCKER_USERNAME" --password-stdin'
sh 'docker tag cloud_data:latest $REGISTRY/$DOCKERHUB_NAMESPACE/cloud_data:SNAPSHOT-$BUILD_NUMBER'
sh 'docker push $REGISTRY/$DOCKERHUB_NAMESPACE/cloud_data:SNAPSHOT-$BUILD_NUMBER'
}
}
}
}
stage('推送cloud_gateway镜像') {
agent none
steps {
container('maven') {
withCredentials([usernamePassword(credentialsId : 'aliyun-docker-registry' ,usernameVariable : 'DOCKER_USERNAME' ,passwordVariable : 'DOCKER_PASSWORD' ,)]) {
sh 'echo "$DOCKER_PASSWORD" | docker login $REGISTRY -u "$DOCKER_USERNAME" --password-stdin'
sh 'docker tag cloud_gateway:latest $REGISTRY/$DOCKERHUB_NAMESPACE/cloud_gateway:SNAPSHOT-$BUILD_NUMBER'
sh 'docker push $REGISTRY/$DOCKERHUB_NAMESPACE/cloud_gateway:SNAPSHOT-$BUILD_NUMBER'
}
}
}
}
stage('推送cloud_log镜像') {
agent none
steps {
container('maven') {
withCredentials([usernamePassword(credentialsId : 'aliyun-docker-registry' ,usernameVariable : 'DOCKER_USERNAME' ,passwordVariable : 'DOCKER_PASSWORD' ,)]) {
sh 'echo "$DOCKER_PASSWORD" | docker login $REGISTRY -u "$DOCKER_USERNAME" --password-stdin'
sh 'docker tag cloud_log:latest $REGISTRY/$DOCKERHUB_NAMESPACE/cloud_log:SNAPSHOT-$BUILD_NUMBER'
sh 'docker push $REGISTRY/$DOCKERHUB_NAMESPACE/cloud_log:SNAPSHOT-$BUILD_NUMBER'
}
}
}
}
stage('推送cloud_login镜像') {
agent none
steps {
container('maven') {
withCredentials([usernamePassword(credentialsId : 'aliyun-docker-registry' ,usernameVariable : 'DOCKER_USERNAME' ,passwordVariable : 'DOCKER_PASSWORD' ,)]) {
sh 'echo "$DOCKER_PASSWORD" | docker login $REGISTRY -u "$DOCKER_USERNAME" --password-stdin'
sh 'docker tag cloud_login:latest $REGISTRY/$DOCKERHUB_NAMESPACE/cloud_login:SNAPSHOT-$BUILD_NUMBER'
sh 'docker push $REGISTRY/$DOCKERHUB_NAMESPACE/cloud_login:SNAPSHOT-$BUILD_NUMBER'
}
}
}
}
stage('推送cloud_party镜像') {
agent none
steps {
container('maven') {
withCredentials([usernamePassword(credentialsId : 'aliyun-docker-registry' ,usernameVariable : 'DOCKER_USERNAME' ,passwordVariable : 'DOCKER_PASSWORD' ,)]) {
sh 'echo "$DOCKER_PASSWORD" | docker login $REGISTRY -u "$DOCKER_USERNAME" --password-stdin'
sh 'docker tag cloud_party:latest $REGISTRY/$DOCKERHUB_NAMESPACE/cloud_party:SNAPSHOT-$BUILD_NUMBER'
sh 'docker push $REGISTRY/$DOCKERHUB_NAMESPACE/cloud_party:SNAPSHOT-$BUILD_NUMBER'
}
}
}
}
stage('推送cloud_ouath镜像') {
agent none
steps {
container('maven') {
withCredentials([usernamePassword(credentialsId : 'aliyun-docker-registry' ,usernameVariable : 'DOCKER_USERNAME' ,passwordVariable : 'DOCKER_PASSWORD' ,)]) {
sh 'echo "$DOCKER_PASSWORD" | docker login $REGISTRY -u "$DOCKER_USERNAME" --password-stdin'
sh 'docker tag cloud_ouath:latest $REGISTRY/$DOCKERHUB_NAMESPACE/cloud_ouath:SNAPSHOT-$BUILD_NUMBER'
sh 'docker push $REGISTRY/$DOCKERHUB_NAMESPACE/cloud_ouath:SNAPSHOT-$BUILD_NUMBER'
}
}
}
}
}
}
stage('部署到dev环境') {
parallel {
stage('部署cloud_admin到dev环境') {
agent none
steps {
kubernetesDeploy(enableConfigSubstitution: true, deleteResource: false, kubeconfigId: 'demo-kubeconfig', configs: 'cloud_admin/deploy/**')
}
}
stage('部署cloud_data到dev环境') {
agent none
steps {
kubernetesDeploy(enableConfigSubstitution: true, deleteResource: false, kubeconfigId: 'demo-kubeconfig', configs: 'cloud_data/deploy/**')
}
}
stage('部署cloud_gateway到dev环境') {
agent none
steps {
kubernetesDeploy(enableConfigSubstitution: true, deleteResource: false, kubeconfigId: 'demo-kubeconfig', configs: 'cloud_gateway/deploy/**')
}
}
stage('部署cloud_log到dev环境') {
agent none
steps {
kubernetesDeploy(enableConfigSubstitution: true, deleteResource: false, kubeconfigId: 'demo-kubeconfig', configs: 'cloud_log/deploy/**')
}
}
stage('部署cloud_login到dev环境') {
agent none
steps {
kubernetesDeploy(enableConfigSubstitution: true, deleteResource: false, kubeconfigId: 'demo-kubeconfig', configs: 'cloud_login/deploy/**')
}
}
stage('部署cloud_party到dev环境') {
agent none
steps {
kubernetesDeploy(enableConfigSubstitution: true, deleteResource: false, kubeconfigId: 'demo-kubeconfig', configs: 'cloud_party/deploy/**')
}
}
stage('部署cloud_production到dev环境') {
agent none
steps {
kubernetesDeploy(enableConfigSubstitution: true, deleteResource: false, kubeconfigId: 'demo-kubeconfig', configs: 'cloud_production/deploy/**')
}
}
stage('部署cloud_ouath到dev环境') {
agent none
steps {
kubernetesDeploy(enableConfigSubstitution: true, deleteResource: false, kubeconfigId: 'demo-kubeconfig', configs: 'cloud_ouath/deploy/**')
}
}
}
}
stage('发送确认邮件') {
agent none
steps {
mail(to: '15994054231@163.com', subject: '构建结果:', body: '构建成功了')
}
}
}
environment {
DOCKER_CREDENTIAL_ID = 'docker-aliyun-acr'
GITHUB_CREDENTIAL_ID = 'gitee'
KUBECONFIG_CREDENTIAL_ID = 'k8s-config-ks'
REGISTRY = 'registry.cn-hangzhou.aliyuncs.com'
DOCKERHUB_NAMESPACE = 'mycentos'
GITHUB_ACCOUNT = 'jeecg'
APP_NAME = 'cloud_api'
ALIYUNHUB_NAMESPACE = 'hhxx'
}
parameters {
string(name: 'TAG_NAME', defaultValue: '', description: '')
}
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。