From the course: Jenkins Essential Training

Unlock the full course today

Join today to access over 24,000 courses taught by industry experts.

Use variables in a pipeline

Use variables in a pipeline - Jenkins Tutorial

From the course: Jenkins Essential Training

Use variables in a pipeline

- [Instructor] Variables let us use dynamic values in our pipelines. Jenkins exposes three different types of variables that we can use: environment variables, current build variables, and parameters. This lesson will focus on environment variables, and current build variables. We'll use another lesson to discuss parameters. The usual practice is to use all capitals for environment variable names, so anyone reading the code can tell the variables apart from the keywords, which are usually lowercase. Environment variables can be scoped globally for an entire pipeline, or they can be scoped locally in a stage. Using an environment block at the beginning of a pipeline exposes the variables to all pipeline steps. Using an environment block at the beginning of a stage only exposes variables to steps within that stage. Environment variables can be referenced in a few different ways in a pipeline, depending on how they're…

Contents