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

Possibility to specify if env variables should be filtered or not in npm config file

XMLWordPrintable

    • Icon: Improvement Improvement
    • Resolution: Not A Defect
    • Icon: Major Major
    • nodejs-plugin
    • None
    • Jenkins 2.190.3 (on RHEL7 with openJDK 1.8.0)
      Token Macro Plugin v2.10
      Config FIle Provider Plugin v3.6.2
      NodeJS Plugin 1.3.4

      In a npm configuration file any environment variable (specified by $VARIABLE_NAME or ${VARIABLE_NAME}) is being filtered/replaced by the env varibale value. If the filtering process can't find the env varibale an error message is logged in the build console.

      However, in some cases it would be desirable to keep the "${VARIABLE_NAME}" string in the used npm config file so that npm itself replaces this. One scenario is for authentication, like this:

      registry=http://nexus.acme.org/repository/npm-group/
      //nexus.acme.org/repository/npm-releases/:_authToken=${NPM_TOKEN}
      

      In this case, for security reasons, you don't want the env variable to be expanded/filtered during the copying of the config file but rather have npm fetching the env variable value during the "npm publish" execution.

            Unassigned Unassigned
            ahammar Anders Hammar
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: