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

List view section: Job Statuses Filter on disabled doesn't work for pipeline jobs

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Minor Minor
    • 2.2

      Since JENKINS-27299 has been resolved, pipeline jobs can be disabled. But unfortunately filtering on disabled pipeline jobs with the Job Statuses Filter in a List View Section of a Sectioned View does not work, i.e. only non-pipeline jobs are shown.

      Remarks:

      • I tried it only with a normal pipeline job, not with a multi-pipeline, since currently I don't use those. I didn' try the other job statuses either.
      • Filtering on Stable and Unstable seem to work, didn't try Failed and Aborted.

          [JENKINS-51143] List view section: Job Statuses Filter on disabled doesn't work for pipeline jobs

          Moritz Knolle added a comment - - edited

          Moritz Knolle added a comment - - edited https://github.com/jenkinsci/view-job-filters-plugin/pull/11 opened PR with a fix

          Great, thanks!

          Works like a charm

          Joerg Schwaerzler added a comment - Great, thanks! Works like a charm

          Looks like the pull request from knolle came little bit late so it needs a merge first. As knolle currently won't have time to do the merge I discussed with him and will take over the PR and do the merge.

          Joerg Schwaerzler added a comment - Looks like the pull request from knolle came little bit late so it needs a merge first. As knolle currently won't have time to do the merge I discussed with him and will take over the PR and do the merge.

          tbingaman, svenschoenung: We're still preparing the PR which initially was created by knolle - we're almost done. Wonder whether so else is working on that topic as well. Please let us know.

          Joerg Schwaerzler added a comment - tbingaman , svenschoenung : We're still preparing the PR which initially was created by knolle - we're almost done. Wonder whether so else is working on that topic as well. Please let us know.

          As chance would have it I actually looked at this issue and the pull request just yesterday.

          The actual code fix is pretty straightforward. It's the minimum required Jenkins version that makes me hesitate.

          When I fixed the broken build I made sure not to increase the minimum required Jenkins version by too much. It's 1.625.3 right now and it seems fixing this will increase that number to 2.62. There's quite a few versions in between those two where people are using this plugin. Right now it seems like they are not updating the plugin anyway, but it might to too early to tell.

          There's always the option of fixing this through reflection without increasing the required Jenkins version (as was done here), but that's complicated, ugly, hard to test, etc...

          Sven Schoenung added a comment - As chance would have it I actually looked at this issue and the pull request just yesterday. The actual code fix is pretty straightforward. It's the minimum required Jenkins version that makes me hesitate. When I fixed the broken build I made sure not to increase the minimum required Jenkins version by too much. It's 1.625.3 right now and it seems fixing this will increase that number to 2.62. There's quite a few versions in between those two where people are using this plugin . Right now it seems like they are not updating the plugin anyway, but it might to too early to tell. There's always the option of fixing this through reflection without increasing the required Jenkins version (as was done here ), but that's complicated, ugly, hard to test, etc...

          daten zauberer added a comment - svenschoenung Please have a look at https://github.com/jenkinsci/view-job-filters-plugin/pull/12

          Jesse Glick added a comment -

          #11 has the right fix (replace AbstractProject with ParameterizedJob) but is not mergeable as is. Trying to do some preparatory cleanup in separate PRs.

          Jesse Glick added a comment - #11 has the right fix (replace AbstractProject with ParameterizedJob ) but is not mergeable as is. Trying to do some preparatory cleanup in separate PRs.

          jglick Thanks for picking this up
          BTW: If I‘m not wrong #12 was a continuation of #11 trying to get it mergeable. Maybe that helps.

          Joerg Schwaerzler added a comment - jglick Thanks for picking this up BTW: If I‘m not wrong #12 was a continuation of #11 trying to get it mergeable. Maybe that helps.

          Jesse Glick added a comment -

          #12 was a continuation of #11

          Yes, but actually the three lines of code in #11 which actually fixed this issue were right, and #12 did something different and unnecessarily complex.

          Jesse Glick added a comment - #12 was a continuation of #11 Yes, but actually the three lines of code in #11 which actually fixed this issue were right, and #12 did something different and unnecessarily complex.

          Jesse Glick added a comment -

          Since I do not much trust the mock-based tests in this plugin, here is my interactive verification:

          • Run 2.222.1, setup wizard to get admin user but skipping plugin installation. From Available, install view-job-filters (from UC: 2.1.1), workflow-basic-steps, workflow-cps, workflow-job.
          • Create an enabled freestyle project, a disabled one, an enabled Pipeline project, and a disabled one. (Otherwise empty—no need for build steps or any builds.)
          • Create a custom list view using the core Status Filter of Disabled jobs only, selecting also Use a regular expression to include jobs into the view with .+; and another with Enabled jobs only. These views correctly show the disabled or enabled freestyle and Pipeline projects, respectively.
          • Create a custom list view using the plugin-provided Job Statuses Filter with Disabled checked and Include Matched - Add jobs that match this filter; and another with Include Unmatched - Add jobs that don't match this filter. Note that the former includes the disabled freestyle project yet omits the disabled Pipeline project, while the latter omits the disabled freestyle project yet includes the disabled Pipeline project, reproducing the bug.
          • Build view-job-filter.hpi from #18, install via Plugin Manager » Advanced, restart. Now running 2.2-SNAPSHOT.
          • See that the plugin-based views now correctly handle the disabled Pipeline project, matching the behavior of the core-based views.

          Jesse Glick added a comment - Since I do not much trust the mock-based tests in this plugin, here is my interactive verification: Run 2.222.1, setup wizard to get admin user but skipping plugin installation. From Available , install view-job-filters (from UC: 2.1.1), workflow-basic-steps , workflow-cps , workflow-job . Create an enabled freestyle project, a disabled one, an enabled Pipeline project, and a disabled one. (Otherwise empty—no need for build steps or any builds.) Create a custom list view using the core Status Filter of Disabled jobs only , selecting also Use a regular expression to include jobs into the view with .+ ; and another with Enabled jobs only . These views correctly show the disabled or enabled freestyle and Pipeline projects, respectively. Create a custom list view using the plugin-provided Job Statuses Filter with Disabled checked and Include Matched - Add jobs that match this filter ; and another with Include Unmatched - Add jobs that don't match this filter . Note that the former includes the disabled freestyle project yet omits the disabled Pipeline project, while the latter omits the disabled freestyle project yet includes the disabled Pipeline project, reproducing the bug. Build view-job-filter.hpi from #18, install via Plugin Manager » Advanced , restart. Now running 2.2-SNAPSHOT . See that the plugin-based views now correctly handle the disabled Pipeline project, matching the behavior of the core-based views.

            jglick Jesse Glick
            wolfgangk Wolfgang Kiendl
            Votes:
            4 Vote for this issue
            Watchers:
            9 Start watching this issue

              Created:
              Updated:
              Resolved: