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

JenkinsRule always returns null in getPluginManager().getPlugin() on new core versions

    Details

    • Similar Issues:

      Description

      Hit it multiple times while running PCT for JEP-200. Some tests retrieve Plugin instances from Jenkins instance using the following commands:

      • getPluginManager().getPlugin("git") - e.g. GitHub plugin
      • Jenkins.getInstance().getPlugin("ownership") - e.g. Ownership plugin. In this case the plugin's production logic fails since it's code accesses the plugin (to be fixed though)

      With recent Jenkins cores / JTH both methods ALWAYS return null, and it breaks tests

        Attachments

          Activity

          Hide
          mkobit Mike Kobit added a comment -

          Job DSL is another plugin that makes use of these APIs

          Show
          mkobit Mike Kobit added a comment - Job DSL is another plugin that makes use of these APIs
          Hide
          mac_ Gyula Varga added a comment - - edited

          Any update or workaround (downgrade jenkins core for tests?) for this? This kind of limits the usage of the jenkins testing harness

           

           

          Show
          mac_ Gyula Varga added a comment - - edited Any update or workaround (downgrade jenkins core for tests?) for this? This kind of limits the usage of the jenkins testing harness    
          Hide
          oleg_nenashev Oleg Nenashev added a comment -

          Gyula Varga Sorry, I got reassigned to another task. No ETA. I will unassign myself

          Show
          oleg_nenashev Oleg Nenashev added a comment - Gyula Varga Sorry, I got reassigned to another task. No ETA. I will unassign myself
          Hide
          anemortalkid Jan Monterrubio added a comment -

          I was able to get around this by defining my own PluginManager. I found that the loading of the plugins was being done by a "shortName" , so github-api instead of github-api-1.4.3.jpi .I had a set of gradle tasks that would write the plugins I wanted to a resource directory and an index file. The UnitTestSupportingPluginManager had this snippet:

          URL index = getClass().getResource("/test-dependencies/index");

          When debugging through it, I noticed that my set of plugins was doing:

          copyBundledPlugin(url, line + ".jpi");
          Where URL was /some/path/on/my/machine/github-api-4.3.jpi  and line was github-api-4.3

          The plugin manager would try to find "github-api" and either load an old version (which caused other plugins to not load) or flat out not find things. 

          I documented a bit more on this PR (which I think linked to this issue): https://github.com/mkobit/jenkins-pipeline-shared-libraries-gradle-plugin/issues/65#issuecomment-668193573

           

          Show
          anemortalkid Jan Monterrubio added a comment - I was able to get around this by defining my own PluginManager. I found that the loading of the plugins was being done by a "shortName" , so github-api instead of github-api-1.4.3.jpi .I had a set of gradle tasks that would write the plugins I wanted to a resource directory and an index file. The UnitTestSupportingPluginManager had this snippet: URL index = getClass().getResource( "/test-dependencies/index" ); When debugging through it, I noticed that my set of plugins was doing: copyBundledPlugin(url, line + ".jpi" ); Where URL was /some/path/on/my/machine/github-api-4.3.jpi and line was github-api-4.3 The plugin manager would try to find "github-api" and either load an old version (which caused other plugins to not load) or flat out not find things.  I documented a bit more on this PR (which I think linked to this issue):  https://github.com/mkobit/jenkins-pipeline-shared-libraries-gradle-plugin/issues/65#issuecomment-668193573  

            People

            • Assignee:
              Unassigned
              Reporter:
              oleg_nenashev Oleg Nenashev
            • Votes:
              3 Vote for this issue
              Watchers:
              6 Start watching this issue

              Dates

              • Created:
                Updated: