Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-60994

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

      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 
      
      

          [JENKINS-60994] When using top level agents and timeouts, provisioning time is not accounted for

          Jose Blas Camacho Taboada created issue -
          Jose Blas Camacho Taboada made changes -
          Status Original: Open [ 1 ] New: In Progress [ 3 ]
          Jose Blas Camacho Taboada made changes -
          Description Original: When using the following pipeline,
          {code:groovy}
          pipeline {
              agent any
              options {
                  timeout(time: 10, unit: "MINUTES")
              }
              stages {
                  stage("foo") {
                      steps {
                          echo "hello"
                      }
                  }
              }
          }
          {code}

          Provisioning time is not accounted for in the timeout, this is the script generated:
          {code:groovy}
          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 []
          {code}

          h1. *Proposal:*
          Only should work iff top level agent (agent not none) and timeout in top level option.

          {code:groovy}
          pipeline {
              agent any
              options {
                  provisioningTimeout()
                  timeout(time: 10, unit: "MINUTES")
              }
              stages {
                  stage("foo") {
                      steps {
                          echo "hello"
                      }
                  }
                  stage("boo") {
                      steps {
                          echo "hello"
                      }
                  }
              }
          }
          {code}
           would produce a top level timeout script

          {code:groovy}
          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

          {code}
          New: When using the following pipeline,
          {code:groovy}
          pipeline {
              agent any
              options {
                  timeout(time: 10, unit: "MINUTES")
              }
              stages {
                  stage("foo") {
                      steps {
                          echo "hello"
                      }
                  }
                  stage("boo") {
                      steps {
                          echo "hello buddy"
                      }
                  }
              }
          }
          {code}

          Provisioning time is not accounted for in the timeout, this is the script generated:
          {code:groovy}
          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 []
          {code}

          h1. *Proposal:*
          Only should work iff top level agent (agent not none) and timeout in top level option.

          {code:groovy}
          pipeline {
              agent any
              options {
                  provisioningTimeout()
                  timeout(time: 10, unit: "MINUTES")
              }
              stages {
                  stage("foo") {
                      steps {
                          echo "hello"
                      }
                  }
                  stage("boo") {
                      steps {
                          echo "hello buddy"
                      }
                  }
              }
          }
          {code}
           would produce a top level timeout script

          {code:groovy}
          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

          {code}
          Jose Blas Camacho Taboada made changes -
          Description Original: When using the following pipeline,
          {code:groovy}
          pipeline {
              agent any
              options {
                  timeout(time: 10, unit: "MINUTES")
              }
              stages {
                  stage("foo") {
                      steps {
                          echo "hello"
                      }
                  }
                  stage("boo") {
                      steps {
                          echo "hello buddy"
                      }
                  }
              }
          }
          {code}

          Provisioning time is not accounted for in the timeout, this is the script generated:
          {code:groovy}
          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 []
          {code}

          h1. *Proposal:*
          Only should work iff top level agent (agent not none) and timeout in top level option.

          {code:groovy}
          pipeline {
              agent any
              options {
                  provisioningTimeout()
                  timeout(time: 10, unit: "MINUTES")
              }
              stages {
                  stage("foo") {
                      steps {
                          echo "hello"
                      }
                  }
                  stage("boo") {
                      steps {
                          echo "hello buddy"
                      }
                  }
              }
          }
          {code}
           would produce a top level timeout script

          {code:groovy}
          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

          {code}
          New: When using the following pipeline,
          {code:groovy}
          pipeline {
              agent any
              options {
                  timeout(time: 10, unit: "MINUTES")
              }
              stages {
                  stage("foo") {
                      steps {
                          echo "hello"
                      }
                  }
                  stage("boo") {
                      steps {
                          echo "hello buddy"
                      }
                  }
              }
          }
          {code}

          Provisioning time is not accounted for in the timeout, this is the script generated:
          {code:groovy}
          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 []
          {code}

          h1. *Proposal:*
          Only should work iff top level agent (agent not none) and timeout in top level option.

          {code:groovy}
          pipeline {
              agent any
              options {
                  timeout(time: 10, unit: "MINUTES")
              }
              stages {
                  stage("foo") {
                      steps {
                          echo "hello"
                      }
                  }
                  stage("boo") {
                      steps {
                          echo "hello buddy"
                      }
                  }
              }
          }
          {code}
           would produce a top level timeout script

          {code:groovy}
          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

          {code}
          Jose Blas Camacho Taboada made changes -
          Issue Type Original: New Feature [ 2 ] New: Bug [ 1 ]
          Jose Blas Camacho Taboada made changes -
          Description Original: When using the following pipeline,
          {code:groovy}
          pipeline {
              agent any
              options {
                  timeout(time: 10, unit: "MINUTES")
              }
              stages {
                  stage("foo") {
                      steps {
                          echo "hello"
                      }
                  }
                  stage("boo") {
                      steps {
                          echo "hello buddy"
                      }
                  }
              }
          }
          {code}

          Provisioning time is not accounted for in the timeout, this is the script generated:
          {code:groovy}
          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 []
          {code}

          h1. *Proposal:*
          Only should work iff top level agent (agent not none) and timeout in top level option.

          {code:groovy}
          pipeline {
              agent any
              options {
                  timeout(time: 10, unit: "MINUTES")
              }
              stages {
                  stage("foo") {
                      steps {
                          echo "hello"
                      }
                  }
                  stage("boo") {
                      steps {
                          echo "hello buddy"
                      }
                  }
              }
          }
          {code}
           would produce a top level timeout script

          {code:groovy}
          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

          {code}
          New: When using the following pipeline,
          {code:groovy}
          pipeline {
              agent any
              options {
                  timeout(time: 10, unit: "MINUTES")
              }
              stages {
                  stage("foo") {
                      steps {
                          echo "hello"
                      }
                  }
                  stage("boo") {
                      steps {
                          echo "hello buddy"
                      }
                  }
              }
          }
          {code}

          Provisioning time is not accounted for in the timeout, this is the script generated:
          {code:groovy}
          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 []
          {code}

          h1. *Proposal:*
          Only should work iff top level agent (agent not none) and timeout in top level option, as stage level timeout

          {code:groovy}
          pipeline {
              agent any
              options {
                  timeout(time: 10, unit: "MINUTES")
              }
              stages {
                  stage("foo") {
                      steps {
                          echo "hello"
                      }
                  }
                  stage("boo") {
                      steps {
                          echo "hello buddy"
                      }
                  }
              }
          }
          {code}
           would produce a top level timeout script

          {code:groovy}
          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

          {code}
          Jose Blas Camacho Taboada made changes -
          Status Original: In Progress [ 3 ] New: Open [ 1 ]
          Jose Blas Camacho Taboada made changes -
          Assignee Original: Jose Blas Camacho Taboada [ jtaboada ]

            Unassigned Unassigned
            jtaboada Jose Blas Camacho Taboada
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: