Use one agent for parallel stages

This issue is archived. You can view it, but you can't modify it. Learn more

XMLWordPrintable

      When using top-level agent definition parallel steps running fine as separate processes on the same agent, but when using top-level "agent none" and trying to set agent for a stage which has 2 parallel stages defined getting the error:

       

      "agent" is not allowed in stage "Test" as it contains parallel stages

      What the difference? I want to be able to run parallel stages on one agent defined not on the top level.

       

       

      pipeline {
          agent none
          
          stages {
              stage('Test') {
                  agent { label "agent1" }
                  parallel {
                      stage('Build1') {
                          steps {
                              echo "Test Build1"
                          }
                      }
                      stage('Build2') {
                          steps {
                              echo "Test Build2"
                          }
                      }
                          
                  }
              }
          }
      }
      

            Assignee:
            Unassigned
            Reporter:
            Taras Postument
            Archiver:
            Jenkins Service Account

              Created:
              Updated:
              Archived: