3 Star 3 Fork 11

南山/spring-boot-helloworld

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
Jenkinsfile 1.94 KB
一键复制 编辑 原始数据 按行查看 历史
wang 提交于 2023-02-02 16:19 +08:00 . init
pipeline {
environment {
appName = "spring-boot-helloworld"
appVersion = "v0.9.0"
//registry = "http://harbor.wang.org:8082"
registry = "http(s)://YOUR_REGISTRY_HOST:PORT"
//registryCredential = "nexus_admin"
registryCredential = "YOUR_REGISTRY_USER_CREDENTIAL"
dockerImage = ""
}
agent {
kubernetes {
label 'maven-and-docker'
}
}
stages {
stage('Source') {
steps {
git branch: 'master', url: 'http://gitlab.gitlab.svc.cluster.local/root/spring-boot-helloworld.git'
}
}
stage('Build') {
steps {
container('maven') {
sh 'mvn clean test package'
}
}
}
stage('Building app image') {
steps {
container('docker') {
script {
dockerImage = docker.build appName + ":" + appVersion
}
}
}
}
stage('Push app image') {
steps {
container('docker') {
script {
docker.withRegistry( registry, registryCredential ) {
dockerImage.push()
}
}
}
}
}
stage('Deploy') {
steps {
container('kubectl') {
withKubeConfig([credentialsId: 'k8s-cluster-admin-kubeconfig-file'
]) {
sh 'kubectl apply -f deploy/'
}
}
}
}
}
post {
failure {
updateGitlabCommitStatus name: 'build', state: 'failed'
}
success {
updateGitlabCommitStatus name: 'build', state: 'success'
}
}
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/lbtooth/spring-boot-helloworld.git
git@gitee.com:lbtooth/spring-boot-helloworld.git
lbtooth
spring-boot-helloworld
spring-boot-helloworld
main

搜索帮助