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

view-job-filters-plugin regex filter fails to match any jobs from folders

      While the plugin is able to correctly display all jobs including those in folders, the regex match does not seem to match any of the jobs from subfolders.

      it is very easy to test:

      • Create folder
      • Move job to folder
      • Check view with regex filter, job will not be there, even if the pattern is ".*"

      Update: After some extra digging I tried a more advanced regex like `\p{all}foo.` which also failed.

      The only way to add folder jobs to this view was to manually check them in the job tree above the regex field, which is an unmaintainable solution, especially as all our jobs are configured and managed programaterly.

          [JENKINS-49305] view-job-filters-plugin regex filter fails to match any jobs from folders

          Sorin Sbarnea created issue -
          Sorin Sbarnea made changes -
          Description Original: While the plugin is able to correctly display all jobs including those in folders, the regex match does not seem to match any of the jobs from subfolders.

          it is very easy to test:
           * Create folder
           * Move job to folder
           * Check view with regex filter, job will not be there, even if the pattern is "{color:#ff0000}*.**{color}"

           
          New: While the plugin is able to correctly display all jobs including those in folders, the regex match does not seem to match any of the jobs from subfolders.

          it is very easy to test:
           * Create folder
           * Move job to folder
           * Check view with regex filter, job will not be there, even if the pattern is "{color:#ff0000}*.**{color}"

          Update: After some extra digging I tried a more advanced regex like `{color:#ff0000}\p\{all}*foo.*{color}` which has a very interesting result. It did return a job from inside a folder but not the correct one. The one returned had nothing to do with the pattern mentioned, is like it did return about value.

          The one returned was looking like "util » xxx » master" which happened to be the master branch of the multijob names xxx from under the util folder. 

          It seems to be too much of a coincidence the only one job was matched but the wrong one. Looks like match returned a previous job from the loop of something like this.

           
          Sorin Sbarnea made changes -
          Description Original: While the plugin is able to correctly display all jobs including those in folders, the regex match does not seem to match any of the jobs from subfolders.

          it is very easy to test:
           * Create folder
           * Move job to folder
           * Check view with regex filter, job will not be there, even if the pattern is "{color:#ff0000}*.**{color}"

          Update: After some extra digging I tried a more advanced regex like `{color:#ff0000}\p\{all}*foo.*{color}` which has a very interesting result. It did return a job from inside a folder but not the correct one. The one returned had nothing to do with the pattern mentioned, is like it did return about value.

          The one returned was looking like "util » xxx » master" which happened to be the master branch of the multijob names xxx from under the util folder. 

          It seems to be too much of a coincidence the only one job was matched but the wrong one. Looks like match returned a previous job from the loop of something like this.

           
          New: While the plugin is able to correctly display all jobs including those in folders, the regex match does not seem to match any of the jobs from subfolders.

          it is very easy to test:
           * Create folder
           * Move job to folder
           * Check view with regex filter, job will not be there, even if the pattern is "{color:#ff0000}*.**{color}"

          Update: After some extra digging I tried a more advanced regex like `{color:#ff0000}\p\{all}*foo.*{color}` which also failed.

          The only way to add folder jobs to this view was to manually check them in the job tree above the regex field, which is an unmaintainable solution, especially as all our jobs are configured and managed programaterly.

          Joshua Olson added a comment -

          Under "Job Filters" have you tried checking the "Recurse in subfolders" box?

          I'm using the jenkins dsl plugin, and the code below works for me.

          #######################################

          buildMonitorView("Failed-Jobs") {
            recurse()
            jobFilters {
            }}{{  }}{{status {
            }}{{  }}{{  }}{{matchType(MatchType.INCLUDE_MATCHED)
            }}{{  }}{{  }}{{status(Status.FAILED)
            }}{{  }}{{  }}{{status(Status.UNSTABLE)
            }}{{  }}{
            }}{{  }}{{regex {
            }}{{  }}{{  }}{{matchType(MatchType.EXCLUDE_MATCHED)
            }}{{  }}{{  }}{{matchValue(RegexMatchValue.NAME) // https://jenkinsci.github.io/job-dsl-plugin/#path/buildMonitorView-jobFilters-regex-matchValue
            }}{{  }}{{  }}{{regex('.RMQ.')
            }}{{  }}{
            } // jobFilters
          } // buildMonitorView{{}}

          Joshua Olson added a comment - Under "Job Filters" have you tried checking the "Recurse in subfolders" box? I'm using the jenkins dsl plugin, and the code below works for me. ####################################### buildMonitorView("Failed-Jobs") {   recurse()   jobFilters {   }}{{  }}{{status {   }}{{  }}{{  }}{{matchType(MatchType.INCLUDE_MATCHED)   }}{{  }}{{  }}{{status(Status.FAILED)   }}{{  }}{{  }}{{status(Status.UNSTABLE)   }}{{  }}{   }}{{  }}{{regex {   }}{{  }}{{  }}{{matchType(MatchType.EXCLUDE_MATCHED)   }}{{  }}{{  }}{{matchValue(RegexMatchValue.NAME) // https://jenkinsci.github.io/job-dsl-plugin/#path/buildMonitorView-jobFilters-regex-matchValue   }}{{  }}{{  }}{{regex('. RMQ. ')   }}{{  }}{   } // jobFilters } //  buildMonitorView {{}}

          Joshua Olson added a comment - Reference info: https://wiki.jenkins.io/display/JENKINS/View+Job+Filters https://wiki.jenkins.io/display/JENKINS/Using+the+View+Job+Filters+Match+Type https://www.cloudbees.com/blog/controlling-what-you-see-view-job-filters-jenkins-plugin

          Problem is most likely that the "Recurse in subfolders" checkbox is not checked as Joshua already pointed out.

          The 2.1.0 release now also includes options to match the full path and folder name of jobs, so that might help as well.

          If the problem still persists, please reopen ticket with instructions to reproduce.

          Sven Schoenung added a comment - Problem is most likely that the "Recurse in subfolders" checkbox is not checked as Joshua already pointed out. The 2.1.0 release now also includes options to match the full path and folder name of jobs, so that might help as well. If the problem still persists, please reopen ticket with instructions to reproduce.
          Sven Schoenung made changes -
          Released As New: https://github.com/jenkinsci/view-job-filters-plugin/releases/tag/view-job-filters-2.1.0
          Resolution New: Fixed [ 1 ]
          Status Original: Open [ 1 ] New: Resolved [ 5 ]

            jacob_robertson Jacob Robertson
            ssbarnea Sorin Sbarnea
            Votes:
            2 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: