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

NodeJSInstallation marks "home" parameter as required

XMLWordPrintable

    • 1.3.4

      When configuring a NodeJS installation with the Configuration as Code plugin, the "home" argument of the NodeJSInstallation class constructor is required and its absence prevents the Jenkins instance to start. The bug is that it is not clear from the configuration UI, nor from an export of a working configuration, nor from any documentation that such a value is required, or what should be set to. In fact, just specifying it as an empty string solves the problem.

      Related github issue: https://github.com/jenkinsci/configuration-as-code-plugin/issues/701

      Related code: https://github.com/jenkinsci/nodejs-plugin/blob/2d459b1507a763ef14303b3c7b727863ffd974f2/src/main/java/jenkins/plugins/nodejs/tools/NodeJSInstallation.java#L70

      Steps to reproduce:

      To have a working Jenkins instance using the Configuration as Code plugin, you must use something like the following as configuration for a NodeJS installation:

       

              tool:
                nodejs:
                  installations:
                  - name: "Node 11.14"
                    home: ""
                    properties:
                    - installSource:
                        installers:
                        - nodeJSinstaller:
                            id: "11.14.0"
                            npmPackagesRefreshHours: 72
      

      Without the home: "" value, the instance fails to start with the following error:

      io.jenkins.plugins.casc.ConfiguratorException: home is required to configure class jenkins.plugins.nodejs.tools.NodeJSInstallation
      

      With the empty home value, everything works correctly. The bug is the fact that it is very hard to find (it probably requires inspection of the NodeJS plugin source code) that that value is required, is required in that position, and that an empty value is a correct default.

      Possible solutions:

      1. One possible solution could be to remove the requirement on the parameter, possibly adding another constructor that sets the working empty value
      2. Another solution could be adding some documentation (it's not clear to me where, however) to guide Configuration as Code users so that they are aware of the requirement

            nfalco Nikolas Falco
            mimatn Michele Mauro
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: