pipeline {
agent {
kubernetes {
inheritFrom 'maven'
containerTemplate{
name 'maven'
image 'jenkins_pipiline_base:latest'
}
}
}
stages {
stage('构建发布') {
steps {
container('maven') {
script {
// 设置 Git 配置
sh 'git config --global http.postBuffer 524288000' // 将缓冲区大小设置为500MB
}
checkout([
$class: 'GitSCM',
branches: [[name: '*/master']],
doGenerateSubmoduleConfigurations: false,
extensions: [
[$class: 'CloneOption', depth: 1, shallow: true] // 使用浅克隆
],
userRemoteConfigs: [[
url: 'giturl,
credentialsId: 'git_user'
]]
])
withCredentials([
usernamePassword(passwordVariable : 'DOCKERHUB_PASSWORD' ,usernameVariable :'DOCKERHUB_USERNAME',credentialsId : "admin"),
kubeconfigFile(credentialsId: 'k8s_user',variable: 'KUBECONFIG')]) {
sh 'docker push kubespheredev/builder-maven'
}
}
}
}
}
environment {
IMAGES_NAME = 'demo-esen-etl'
DOCKER_FILE_NAME = 'EsenEtlDockerfile'
TAG_NAME = "SNAPSHOT-$BUILD_NUMBER"
NAME_SPACE = "eshine"
}
}