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

Add groovy postbuild manager method to check if a file exists

XMLWordPrintable

      It would be useful if the groovy postbuild plugin had a method to check if a file with a given pattern existed in the jenkins workspace. This could be used to easily determine the state of a build by looking for marker files.

      Possible interface (If Jenkins has some concept of a FileTree / FileCollection that could be used):

       

      // searches the entire workspace for file names that match regexp
      fileExists(String regexp)
       
      // searches for files in dir recursively for file names that match regexp
      fileExists(File dir, String regexp)
      

       

      Example:

       

      if (manager.fileExists(new File("build/customverification/"), ".*\\.failed")) {
          manager.addBadge(...)
          manager.buildUnstable();
          ...
      }
      

       

            wolfs Stefan Wolf
            mrichar2 Mark R
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: