def git_address = "http://gitlab.rb.com/qwer/tegent.git" def git_auth = "cf922df0-38c4-46b4-a556-fa0604138e20" //构建版本的名称 def tag = "latest" //Harbor私服地址 def harbor_url = "harbor.od.com" //Harbor的项目名称 def harbor_project_name = "tensquare" //Harbor的凭证 def harbor_auth = "bbcb94c0-8f1d-4214-bd3c-76edf52cd244" //k8s的凭证 def k8s_auth = "1d425ea5-f25a-44c1-bfde-e9bcd311a8b8" //定义k8s-harbor的凭证 def secret_name = "kubernetes-admin-token-d5snf" def file = "tegent-file" def system = "tegent-system" def file_with_module = "tegent-modules-file" def system_with_module = "tegent-modules-system" def parent = "tegent-modules" def api = "tegent-api" def common = "tegent-common" //pod模板 podTemplate(label: 'jenkins-slave', cloud: 'kubernetes', containers: [ containerTemplate( name: 'jnlp', image: "harbor.od.com/public/jenkin-with-maven:v3.6.2" ), containerTemplate( name: 'docker', image: "docker:stable", ttyEnabled: true, command: 'cat' ), ], volumes: [ hostPathVolume(mountPath: '/var/run/docker.sock', hostPath: '/var/run/docker.sock'), nfsVolume(mountPath: '/usr/local/apache-maven/repo', serverAddress: '192.168.0.153' , serverPath: '/opt/nfs/maven'), ], ) { node("jenkins-slave"){ // 第一步 stage('拉取代码'){ checkout([$class: 'GitSCM', branches: [[name: '${branch}']], userRemoteConfigs: [[credentialsId: "${git_auth}", url: "${git_address}"]]]) } // 第二步 stage('代码编译'){ sh "mvn clean install -pl ${common} -am -Dmaven.test.skip=true -Ddockerfile.skip" } // 第三步 stage('构建镜像,部署项目'){ //把选择的项目信息转为数组 def selectedProjects = "${project_name}".split(',') def home = "$PWD" def destination = 'src/main/resources' def docker_file_home = '' def login_num = '1' for(int i=0;i欢迎分享,转载请注明来源:内存溢出
Jenkins流水线脚本
脚本一
赞
(0)
打赏
微信扫一扫
支付宝扫一扫
Java入门 - 数组进阶
上一篇
2022-12-16
SpringBoot项目中的application.yml没有小绿叶解决方案(idea)
下一篇
2022-12-16
评论列表(0条)