• Icon: New Feature New Feature
    • Resolution: Fixed
    • Icon: Major Major
    • pipeline
    • None

      WatchYourStep (in test sources) is actually similar to something that has been requested: a way to wait until a named file appears in the workspace, or until the content of a file has changed, etc. All these things could be handled by a step like this:

      waitForCond {
          readFile 'flag'
      }
      

      or

      waitForCond {
          readFile('flag') == 'ready'
      }
      

      Roughly similar to retry, it would run its block, and if the block either throws an exception or returns false, it would run it again. Or it might be more intuitive to expect only a boolean return value and force the first example to be written as

      waitForCond {
          try {
              readFile 'flag'
              return true
          } catch (FileNotFoundException _) {
              return false
          }
      }
      

      (Even if an exception is permitted as a synonym for false, InterruptedException should be thrown up.)

      Unlike retry there would not need to be any limit to the number of retries, and there would be an exponentially increasing delay between successive retries: run the first time immediately, then retry after 100ms, then continue to multiply the delay by a factor of 1.3 or something like that (perhaps up to some maximum delay like DurableTaskStep has).

          [JENKINS-25570] Wait-for-condition step

          Jesse Glick created issue -
          Jesse Glick made changes -
          Priority Original: Minor [ 4 ] New: Major [ 3 ]
          Jesse Glick made changes -
          Status Original: Open [ 1 ] New: In Progress [ 3 ]
          Jesse Glick made changes -
          Link New: This issue depends on JENKINS-26148 [ JENKINS-26148 ]
          Jesse Glick made changes -
          Link New: This issue depends on JENKINS-26163 [ JENKINS-26163 ]
          SCM/JIRA link daemon made changes -
          Resolution New: Fixed [ 1 ]
          Status Original: In Progress [ 3 ] New: Resolved [ 5 ]
          Jesse Glick made changes -
          Link New: This issue is related to JENKINS-27127 [ JENKINS-27127 ]
          Jesse Glick made changes -
          Link New: This issue depends on JENKINS-27129 [ JENKINS-27129 ]
          R. Tyler Croy made changes -
          Workflow Original: JNJira [ 159542 ] New: JNJira + In-Review [ 196118 ]
          Andrew Bayer made changes -
          Component/s New: pipeline-general [ 21692 ]
          Andrew Bayer made changes -
          Component/s Original: workflow-plugin [ 18820 ]

            jglick Jesse Glick
            jglick Jesse Glick
            Votes:
            1 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved: