2017-04-04 9 views
6

ここに私が実行しようとしているJenkinsパイプラインがあります。私は次のとおりですthis tutorialJenkinsパイプライン(並列)

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

しかし、次のメッセージでジョブが失敗します。

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 

これがなぜ失敗しているのか誰か助けてもらえますか?

答えて

14

ステージ宣言の後にステップブロックを追加する必要があります。

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

ありがとう、それは – Shahzeb

+1

を働かせましたが、これは段階ではなく、段階的に行います。とにかく、私はまだ良い解決策を見つけていない。 –