Skip to content

setupCommonPipelineEnvironment

Description

Initializes the commonPipelineEnvironment, which is used throughout the complete pipeline.

Tip

This step needs to run at the beginning of a pipeline right after the SCM checkout. Then subsequent pipeline steps consume the information from commonPipelineEnvironment; it does not need to be passed to pipeline steps explicitly.

Prerequisites

  • A configuration file with properties. The property values are used as default values in many pipeline steps.

Parameters

name mandatory default possible values
collectTelemetryData no true
configFile no
customDefaults no
customDefaultsCredentialsId no
customDefaultsFromFiles no
inferBuildTool no
script yes
  • collectTelemetryData -
  • configFile - Path to the pipeline configuration file defining project specific settings.
  • customDefaults - A list of file names which will be extracted from library resources and which serve as source for default values for the pipeline configuration. These are merged with and override built-in defaults, with a parameter supplied by the last resource file taking precedence over the same parameter supplied in an earlier resource file or built-in default.
  • customDefaultsCredentialsId - Credentials (username and password) used to download custom defaults if access is secured.
  • customDefaultsFromFiles - A list of file paths or URLs which must point to YAML content. These work exactly like customDefaults, but from local or remote files instead of library resources. They are merged with and take precedence over customDefaults.
  • inferBuildTool - Enable automatic inference of build tool (maven, npm, mta) based on existing project files. If this is set to true, it is not required to set the build tool by hand for those cases.
  • 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
collectTelemetryData X
configFile
customDefaults
customDefaultsCredentialsId X
customDefaultsFromFiles
inferBuildTool X
script

Dependencies

The step depends on the following Jenkins plugins

Transitive dependencies are omitted.

The list might be incomplete.

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

Side effects

none

Exceptions

none

Example

setupCommonPipelineEnvironment script: this