浏览代码

更新 'Jenkinsfile'

chenghongxi 4 年之前
父节点
当前提交
ddf4fd1fc2
共有 1 个文件被更改,包括 8 次插入16 次删除
  1. 8 16
      Jenkinsfile

+ 8 - 16
Jenkinsfile

@@ -1,9 +1,10 @@
 def git_auth="d4b4c06c-7a45-4969-a06d-8363858e81cd"
 def git_url="http://10.68.0.122:3000/fanyijian/k8s.git"
-def jenkins_home="/var/jenkins_home/workspace/k8s/"
-def xy_image="registry-vpc.cn-beijing.aliyuncs.com/xinyue-jenkins/"
+def jenkins_home="/var/jenkins_home/workspace/k8s"
+def xy_image="registry-vpc.cn-beijing.aliyuncs.com/xinyue-jenkins"
 def release="${BUILD_NUMBER}"
 def projectList = project_name.split(",")
+def share-v2 = ['mchsrv','sharebms2','sharebms2-nginx','sharesrv2']
 
 ansiColor('xterm') {
 	node {
@@ -14,21 +15,12 @@ ansiColor('xterm') {
 		stage('build images') {
 			for (int i = 0; i < projectList.length ; i++) {
 				echo "\u001B[32m############正在build images,项目名为:${projectList[i]}############\u001B[0m"
-				sh "docker build -t ${xy_image}${projectList[i]}:${release} -f ${jenkins_home}${projectList[i]}/Dockerfile ${jenkins_home}${projectList[i]}"
+					if (${project_name} == ${share-v2}){
+						sh ""docker build -t ${xy_image}/${projectList[i]}:${release} -f ${jenkins_home}/share-v2/${projectList[i]}/Dockerfile ${jenkins_home}/share-v2/${projectList[i]}
+					} else {
+						sh "docker build -t ${xy_image}/${projectList[i]}:${release} -f ${jenkins_home}/${projectList[i]}/Dockerfile ${jenkins_home}/${projectList[i]}"
+                    }
 			}      
 		}
-		stage('push aliyuncs registry') {
-			for (int i = 0; i < projectList.length ; i++) {
-				echo "\u001B[32m############正在推送镜像,项目名为:${projectList[i]}############\u001B[0m" 
-				sh "docker push ${xy_image}${projectList[i]}:${BUILD_NUMBER}"
-			}
-		}
-		stage('push aliyuncs registry') {
-			for (int i = 0; i < projectList.length ; i++) {
-				sh "cd ${jenkins_home}"
-				sh "chmod +x ${jenkins_home}jenkins.py"
-				sh "python3 jenkins.py ${projectList[i]}"
-         	}
-		}
 	}
 }