Browse Source

更新 'Jenkinsfile'

chenghongxi 4 years ago
parent
commit
c4c3509347
1 changed files with 15 additions and 22 deletions
  1. 15 22
      Jenkinsfile

+ 15 - 22
Jenkinsfile

@@ -7,28 +7,21 @@ def projectList = project_name.split(",")
 
 ansiColor('xterm') {
 	node {
-    	stage('pull code') {
-                echo "\u001B[32m开始拉取代码\u001B[0m"
-                checkout([$class: 'GitSCM', branches: [[name: '*/master']], doGenerateSubmoduleConfigurations: false, extensions: [], submoduleCfg: [], userRemoteConfigs: [[credentialsId: "${git_auth}", url: "${git_url}"]]])
+		stage('pull code') {
+			echo "\u001B[32m开始拉取代码\u001B[0m"
+			checkout([$class: 'GitSCM', branches: [[name: '*/master']], doGenerateSubmoduleConfigurations: false, extensions: [], submoduleCfg: [], userRemoteConfigs: [[credentialsId: "${git_auth}", url: "${git_url}"]]])
+		}
+		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]}"
+			}      
+		}
+		stage('push aliyuncs registry') {
+			for (int i = 0; i < projectList.length ; i++) {
+				echo "正在推送镜像,项目名为:${projectList[i]} " 
+				sh "docker push ${xy_image}${projectList[i]}:${BUILD_NUMBER}"
+			}
 		}
-        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]}"
-       		}      
-    	}
-    	stage('push aliyuncs registry') {
-         	for (int i = 0; i < projectList.length ; i++) {
-                echo "正在推送镜像,项目名为:${projectList[i]} " 
-                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]}"
-        	 }
-   	 	}
 	}
 }