Parcourir la source

更新 'Jenkinsfile'

chenghongxi il y a 4 ans
Parent
commit
f43233d935
1 fichiers modifiés avec 2 ajouts et 3 suppressions
  1. 2 3
      Jenkinsfile

+ 2 - 3
Jenkinsfile

@@ -3,16 +3,15 @@ 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 release="${BUILD_NUMBER}"
+def projectList = project_name.split(",")
 
 node {
     stage('pull code') {
         checkout([$class: 'GitSCM', branches: [[name: '*/master']], doGenerateSubmoduleConfigurations: false, extensions: [], submoduleCfg: [], userRemoteConfigs: [[credentialsId: 'd4b4c06c-7a45-4969-a06d-8363858e81cd', url: 'http://10.68.0.122:3000/fanyijian/k8s.git']]])}
     stage('build images') {
-        def projectList = project_name.split(",") 
-        
         for (int i = 0; i < projectList.length ; i++) {
              echo "${projectList[i]}"
-             script: "sh cd ${jenkins_home}${projectList[i]}"
+             sh "echo 正在build images,项目名为:${projectList[i]} "
              sh "docker build -t ${xy_image}${projectList[i]}:${release} -f ${jenkins_home}${projectList[i]}/Dockerfile ${jenkins_home}${projectList[i]}"
         }      
     }