When using top level agents and timeouts, provisioning time is not accounted for

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

XMLWordPrintable

      When using the following pipeline,

      pipeline {
          agent any
          options {
              timeout(time: 10, unit: "MINUTES")
          }
          stages {
              stage("foo") {
                  steps {
                      echo "hello"
                  }
              }
              stage("boo") {
                  steps {
                      echo "hello buddy"
                  }
              }
          }
      }
      

      Provisioning time is not accounted for in the timeout, this is the script generated:

      3  node [{label=null}]
      4   { []
      5   timeout [{unit=MINUTES, time=10}]
      6    { []
      7    stage [{name=foo}]
      8     { (foo) []
      9     echo [{message=hello}]
      10    } []
      11    // stage []
      12    stage [{name=boo}]
      13     { (boo) []
      14     echo [{message=hello buddy}]
      15    } []
      16    // stage []
      17   } []
      18   // timeout []
      19  } []
      20  // node []
      

      Proposal:

      Only should work iff top level agent (agent not none) and timeout in top level option, as stage level timeout

      pipeline {
          agent any
          options {
              timeout(time: 10, unit: "MINUTES")
          }
          stages {
              stage("foo") {
                  steps {
                      echo "hello"
                  }
              }
              stage("boo") {
                  steps {
                      echo "hello buddy"
                  }
              }
          }
      }
      

      would produce a top level timeout script

      3  timeout {unit=MINUTES, time=10}
      4   { 
      5   node {label=null}
      6    { 
      7    stage {name=foo}
      8     { (foo) 
      9     echo {message=hello}
      10    } 
      11    // stage 
      12    stage {name=boo}
      13     { (boo) 
      14     echo {message=hello buddy}
      15    } 
      16    // stage 
      17   } 
      18   // node 
      19  } 
      20  // timeout 
      
      

            Assignee:
            Unassigned
            Reporter:
            Jose Blas Camacho Taboada
            Archiver:
            Jenkins Service Account

              Created:
              Updated:
              Archived: