Skip to content

npmExecute

Parameters

name mandatory default possible values
defaultNpmRegistry no
dockerEnvVars no
dockerImage no node:lts-buster
dockerOptions no
dockerWorkspace no
npmCommand no
script yes
  • defaultNpmRegistry - URL of default NPM registry
  • dockerEnvVars - Environment variables to set in the container, e.g. [http_proxy: 'proxy:8080'].
  • dockerImage - Name of the docker image that should be used, in which node should be installed and configured.
  • dockerOptions - Docker options to be set when starting the container.
  • dockerWorkspace - Kubernetes only: Specifies a dedicated user home directory for the container which will be passed as value for environment variable HOME.
  • npmCommand - Which NPM command should be executed.
  • script - The common script environment of the Jenkinsfile running. Typically the reference to the script calling the pipeline step is provided with the this parameter, as in script: this. This allows the function to access the commonPipelineEnvironment for retrieving, e.g. configuration parameters.

Step configuration

We recommend to define values of step parameters via config.yml file.

In following sections of the config.yml the configuration is possible:

parameter general step/stage
defaultNpmRegistry X
dockerEnvVars X
dockerImage X
dockerOptions X
dockerWorkspace X
npmCommand X
script

Dependencies

The step depends on the following Jenkins plugins

The kubernetes plugin is only used if running in a kubernetes environment. Transitive dependencies are omitted.

The list might be incomplete.

Consider using the ppiper/jenkins-master docker image. This images comes with preinstalled plugins.

Exceptions

None

Examples

npmExecute script: this, dockerImage: 'node:8-stretch', npmCommand: 'run build'