2017-04-04 35 views
6

Đây là đường ống Jenkins của tôi mà tôi đang cố gắng thực hiện. Tôi đang theo dõi this tutorial:Đường ống Jenkins với song song

pipeline { 
    agent any 
    stages { 
     stage('one') { 
      parallel "first" : {    
        echo "hello"     
      }, 
      "second": {     
        echo "world"    
      } 
     } 
     stage('two') { 
      parallel "first" : {    
        echo "hello"     
      }, 
      "second": {     
        echo "world"    
      } 
     } 
    } 
} 

Nhưng công việc thất bại với thông báo sau.

org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed: 
WorkflowScript: 4: Unknown stage section "parallel". Starting with version 0.5, steps in a stage must be in a steps block. @ line 4, column 9. 
      stage('one') { 
     ^

WorkflowScript: 12: Unknown stage section "parallel". Starting with version 0.5, steps in a stage must be in a steps block. @ line 12, column 9. 
      stage('two') { 
     ^

WorkflowScript: 4: Nothing to execute within stage "one" @ line 4, column 9. 
      stage('one') { 
     ^

WorkflowScript: 12: Nothing to execute within stage "two" @ line 12, column 9. 
      stage('two') { 
     ^

4 errors 

Ai đó có thể vui lòng giúp tôi tại sao điều này không thành công.

Trả lời

14

Bạn cần thêm khối bước sau tuyên bố giai đoạn của mình.

pipeline { 
    agent any 
    stages { 
     stage('one') { 
      steps { 
       parallel("first": { 
        echo "hello" 
       }, 
         "second": { 
          echo "world" 
         } 
       ) 
      } 
     } 
     stage('two') { 
      steps { 
       parallel("first": { 
        echo "hello" 
       }, 
         "second": { 
          echo "world" 
         } 
       ) 
      } 
     } 
    } 
} 
+0

Cảm ơn bạn rất nhiều, nó đã hoạt động – Shahzeb

+1

nhưng điều này làm cho các bước song song chứ không phải các giai đoạn. Dù sao, tôi đã không tìm thấy giải pháp tốt hơn nào được nêu ra. –

Các vấn đề liên quan