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

EnvInject plugin can add null to global env

    Details

    • Similar Issues:

      Description

      When setting the checkbox "Envronment Variables" in global configuration without adding list of variables - `buildEnvironment` in `Computer` and many other actions starts throwing null pointer exception.

       

      I think the problem is in here:

       

       

      // Computer.java
      for (NodeProperty nodeProperty: Jenkins.getInstance().getGlobalNodeProperties()) {
      nodeProperty.buildEnvVars(env,listener);
      }
      
      // EnvironmentVariablesNodeProperty.java
      @Override 
      public void buildEnvVars(EnvVars env, TaskListener listener) throws IOException, InterruptedException {
           env.putAll(envVars);
      } 

       

      getGlobalProperties returns NodeProperty with `envVars` that is null.

       

      I think we should either remove the checkbox on save when no variable was added or think of a better UI for it. 

      Also in server side we should add protection against this issue as this completely blocked all my builds until I figured out what was the problem

       

       

       

        Attachments

          Activity

          There are no comments yet on this issue.

            People

            • Assignee:
              Unassigned
              Reporter:
              orshachar Or Shachar
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated: