代码拉取完成,页面将自动刷新
同步操作将从 lengleng/pig 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
pipeline {
agent any
parameters {
choice(
choices: [
'pig-gateway',
'pig-auth',
'pig-register',
'pig-upms-biz',
'pig-codegen',
'pig-monitor',
'pig-sentinel-dashboard',
'pig-xxl-job-admin',
'all'
],
name: 'ServicesDeploy',
description: '请选择要构建的服务,支持单个服务发布或全部服务发布'
)
}
environment {
HARBOR_CREDENTIAL_ID = 'aliyun-harbor'
GITLAB_CREDENTIAL_ID = 'gitlab'
REGISTRY = 'registry.cn-shenzhen.aliyuncs.com'
HARBOR_NAMESPACE = 'bill_k8s'
K8s_NAMESPACE = 'default'
}
stages {
stage('代码审查') {
steps {
script {
scannerHome = tool 'sonar'
// 设置为全局工具配置中Scanner的名称
}
withSonarQubeEnv('sonar') {
// 上面的SonarQub为系统配置中的Sonar的服务器名称
sh "${scannerHome}/bin/sonar-scanner -Dsonar.sourceEncoding=UTF-8 -Dsonar.projectKey=ui${BUILD_ID} -Dsonar.java.binaries=${WORKSPACE}"
}
}
}
stage('maven打包') {
steps {
//sh "mvn -Dmaven.test.skip=true clean package"
//sh "mvn clean verify sonar:sonar -Dsonar.projectKey=pig -Dsonar.host.url=http://175.24.181.244:9000 Dsonar.login=sqp_02291498fadce7bbb0a1e5df2de6685560562a27"
sh "echo '${ServicesDeploy} 进行maven构建'"
}
}
stage('构建镜像') {
steps {
script {
if (env.ServicesDeploy == "pig-upms-biz") {
sh "cd pig-upms/pig-upms-biz/ && docker build -f Dockerfile -t $REGISTRY/$HARBOR_NAMESPACE/${ServicesDeploy}:$BUILD_NUMBER ."
} else if (env.ServicesDeploy == "pig-codegen") {
sh "cd pig-visual/pig-codegen/ && docker build -f Dockerfile -t $REGISTRY/$HARBOR_NAMESPACE/${ServicesDeploy}:$BUILD_NUMBER ."
} else if (env.ServicesDeploy == "pig-monitor") {
sh "cd pig-visual/pig-monitor/ && docker build -f Dockerfile -t $REGISTRY/$HARBOR_NAMESPACE/${ServicesDeploy}:$BUILD_NUMBER ."
} else if (env.ServicesDeploy == "pig-sentinel-dashboard") {
sh "cd pig-visual/pig-sentinel-dashboard/ && docker build -f Dockerfile -t $REGISTRY/$HARBOR_NAMESPACE/${ServicesDeploy}:$BUILD_NUMBER ."
} else if (env.ServicesDeploy == "pig-xxl-job-admin") {
sh "cd pig-visual/pig-xxl-job-admin/ && docker build -f Dockerfile -t $REGISTRY/$HARBOR_NAMESPACE/${ServicesDeploy}:$BUILD_NUMBER ."
} else {
sh "cd ${ServicesDeploy} && docker build -f Dockerfile -t $REGISTRY/$HARBOR_NAMESPACE/${ServicesDeploy}:$BUILD_NUMBER ."
}
}
}
}
stage('推送镜像') {
steps {
withCredentials([
usernamePassword(
passwordVariable: 'HARBOR_PASSWORD',
usernameVariable: 'HARBOR_USERNAME',
credentialsId: "$HARBOR_CREDENTIAL_ID"
)
]) {
sh 'echo "$HARBOR_PASSWORD" | docker login $REGISTRY -u "$HARBOR_USERNAME" --password-stdin'
sh "docker push $REGISTRY/$HARBOR_NAMESPACE/${ServicesDeploy}:$BUILD_NUMBER"
sh "docker rmi $REGISTRY/$HARBOR_NAMESPACE/${ServicesDeploy}:$BUILD_NUMBER"
}
}
}
stage('更新镜像') {
steps {
sh "/usr/local/bin/kubectl set image Deployment ${ServicesDeploy} ${ServicesDeploy}=$REGISTRY/$HARBOR_NAMESPACE/${ServicesDeploy}:$BUILD_NUMBER --record"
}
}
}
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。