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

EnvInjectJobProperty inappropriately offered in PipelineJob

XMLWordPrintable

      If you install both EnvInject and the Workflow plugins, then create a workflow job, EnvInjectJobProperty is offered as an option in the configuration screen. It adds nothing of use for workflows, which can already read and write environment variables at arbitrary points, run Groovy logic, and so on, so it is just a source of confusion.

      EnvInjectJobProperty.DescriptorImpl.isApplicable returns true unconditionally. It does not in fact make any reference to AbstractProject/AbstractBuild. Yet so far as I can tell, all of the other classes which check for the existence of a configured EnvInjectJobProperty are in fact assuming AbstractProject/AbstractBuild and probably could not work otherwise.

      If I am right, then isApplicable should return AbstractProject.class.isAssignableFrom(jobType), and the class declaration should be public class EnvInjectJobProperty extends JobProperty<AbstractProject>. (It is unclear to me why you are currently making this class generic, since it concrete and has no subclasses, meaning it is just an ill-typed synonym of public class EnvInjectJobProperty extends JobProperty<Job>.)

      Probably hudson.model.ExternalJob shows the same issue.

            gbois Gregory Boissinot
            jglick Jesse Glick
            Votes:
            2 Vote for this issue
            Watchers:
            8 Start watching this issue

              Created:
              Updated:
              Resolved: