1 Star 0 Fork 1

李延召/spring-boot-helloWorld

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
Jenkinsfile 2.58 KB
一键复制 编辑 原始数据 按行查看 历史
MageEdu 提交于 2022-12-04 16:50 . update to v0.9.5
pipeline {
agent {
kubernetes {
inheritFrom 'kube-maven'
}
}
triggers {
gitlab(triggerOnPush: true,
triggerOnMergeRequest: true,
branchFilterType: 'All',
secretToken: '9iH0tq33ROMS07przzLiclNmfqSaoIeTOolHYf1E')
}
parameters {
booleanParam(name: "PUSH", defaultValue: true)
}
environment {
GitRepo="http://gitlab.magedu.com/root/spring-boot-helloWorld.git"
HarborServer='hub.magedu.com'
ImageUrl="ikubernetes/spring-boot-helloworld"
ImageTag="latest"
RegistryCredential='harbor-user-credential'
RegistryUrl="https://${HarborServer}"
}
stages {
stage('Source') {
steps {
git branch: 'main', url: "${GitRepo}"
}
}
stage('Build') {
steps {
container('maven') {
sh 'mvn -B -DskipTests clean package'
}
}
}
stage('Test') {
steps {
container('maven') {
sh 'mvn test'
}
}
}
stage("SonarQube Analysis") {
steps {
withSonarQubeEnv('SonarQube-Server') {
container('maven') {
sh 'mvn sonar:sonar'
}
}
}
}
stage("Quality Gate") {
steps {
timeout(time: 30, unit: 'MINUTES') {
waitForQualityGate abortPipeline: true
}
}
}
stage('Build Image') {
steps {
container('dind') {
script {
dockerImage = docker.build("${HarborServer}/${ImageUrl}:${ImageTag}")
}
}
}
}
stage('Push Image') {
when {
expression { params.PUSH }
beforeAgent true
}
steps {
container('dind') {
script {
docker.withRegistry( RegistryUrl, RegistryCredential ) {
dockerImage.push()
}
}
}
}
}
}
post{
always {
mail to: '[email protected]',
subject: "Status of pipeline: ${currentBuild.fullDisplayName}",
body: "${env.BUILD_URL} has result ${currentBuild.result}"
}
}
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/sunrisenan/spring-boot-helloWorld.git
[email protected]:sunrisenan/spring-boot-helloWorld.git
sunrisenan
spring-boot-helloWorld
spring-boot-helloWorld
main

搜索帮助