Commit dc9d0865 by Administrator

Update Jenkinsfile

parent 6aafb9d3
Pipeline #86 failed with stage
in 0 seconds
pipeline {
agent any
stages {
stage('build') {
when { branch 'dev' }
steps {
sh '/apache-maven-3.6.3/bin/mvn clean package -Dmaven.test.skip=true -U'
}
post {
success {
sh "/usr/local/bin/workwechatctl -p ${env.JOB_NAME} -n 沈涛 -c 项目编译成功进行下一阶段"
}
failure {
step([$class: 'Mailer',
notifyEveryUnstableBuild: true,
recipients: "shentao@zhiweidata.com",
sendToIndividuals: true])
}
}
}
stage('build image') {
when { branch 'dev' }
steps {
sh "sudo docker build -t harbor.docker.zhiweireach.com/application/qbjc:${env.BUILD_NUMBER} . "
}
post {
success {
sh "/usr/local/bin/workwechatctl -p ${env.JOB_NAME} -n 张金晓 -c 镜像构建成功进行下一阶段"
}
}
}
stage('push image') {
when { branch 'dev' }
steps {
sh "sudo docker login --username admin --password JinxiaoZhang...701 harbor.docker.zhiweireach.com"
sh "sudo docker push harbor.docker.zhiweireach.com/application/qbjc:${env.BUILD_NUMBER}"
}
post {
success {
sh "/usr/local/bin/workwechatctl -p ${env.JOB_NAME} -n 张金晓 -c 镜像push成功进行下一阶段"
}
}
}
stage('deploy') {
when { branch 'dev' }
steps {
sh "/usr/local/bin/kubectl version"
sh "/usr/local/bin/kubectl set image deployment/qbjc-background qbjc-background=harbor.docker.zhiweireach.com/application/qbjc:${env.BUILD_NUMBER} --record"
}
post {
success {
sh "/usr/local/bin/workwechatctl -p ${env.JOB_NAME} -n 张金晓 -c k8spod已部署更新成功"
node {
stage('SonarQube analysis') {
withSonarQubeEnv('sonar') {
sh 'mvn clean package sonar:sonar'
}
}
}
stage("Quality Gate"){
timeout(1) {
def qg = waitForQualityGate('sonar')
if (qg.status != 'OK') {
error "Pipeline aborted due to quality gate failure: ${qg.status}"
}
}
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment