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

The regular expression for job categorization should look at the full job name

      The regular expression for the inclusion of jobs looks at the full name of the job including folders, however the regular expression for grouping jobs only looks at the name of the job. That means it's impossible to group jobs based on their folder. For example if I have jobs:

      folder1/subfolder1/job1
      folder1/subfolder1/job2
      folder1/subfolder2/job1
      folder1/subfolder2/job2
      folder2/subfolder1/job1
      folder2/subfolder1/job2
      folder2/subfolder2/job1
      folder2/subfolder2/job2

      In this case I can have a view that shows all builds in folder1 by setting the regular expression to '(folder1)\/.\/.$'

      If I now want to group the builds by subfolder I would imagine that I need to set the categorization regular expression to: '.\/(subfolder2)\/.$'. However that won't work because the categorization regex only works on the build name (i.e. job1 / job2 etc.)

          [JENKINS-41910] The regular expression for job categorization should look at the full job name

          Anders Kielsholm added a comment - - edited

          I also ran into this, but the solution seems pretty simple. In GroupingRule.java there are two methods using TopLevelItem's getName(), but should be using getFullName() in order for this to work.

          Only problem with changing would be that it wouldn't be backward compatible in a lot of cases. I don't know if a solution to that could be prepending .*/ to the regex in the normalizing-steps (if no / are present)?

          Anders Kielsholm added a comment - - edited I also ran into this, but the solution seems pretty simple. In GroupingRule.java there are two methods using TopLevelItem 's getName() , but should be using getFullName() in order for this to work. Only problem with changing would be that it wouldn't be backward compatible in a lot of cases. I don't know if a solution to that could be prepending .*/ to the regex in the normalizing-steps (if no / are present)?

          I have made a fix in the way described in my earlier comment. Note that this also fixes an issue regarding statuses not being correct for Pipeline Jobs since they are a subclass of Job and not AbstractProject. I don't know if it's ready for a Pull Request (I'm not that used to dealing with issues), but the branch can be found here: https://github.com/ordbogen/categorized-view-plugin/tree/pipeline_support

          Anders Kielsholm added a comment - I have made a fix in the way described in my earlier comment. Note that this also fixes an issue regarding statuses not being correct for Pipeline Jobs since they are a subclass of Job and not AbstractProject . I don't know if it's ready for a Pull Request (I'm not that used to dealing with issues), but the branch can be found here: https://github.com/ordbogen/categorized-view-plugin/tree/pipeline_support

            taksan taksan
            petrikvandervelde Petrik van der Velde
            Votes:
            2 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated: