DevOps Tools Engineer (LPIC-OT 701) — Question 17

A declarative Jenkins pipeline contains the following excerpt: parameters { string (name: "˜TargetEnvironment', defaultValue: "˜staging', description: "˜Target environment')
}
How can a task use the value provided for TargetEnvironment?

Answer options

Correct answer: D

Explanation

The correct way to access the value of a parameter in a Jenkins pipeline is by using the syntax ${params.TargetEnvironment}, which correctly references the parameter defined in the pipeline. The other options are incorrect because they either use invalid syntax for Jenkins or reference the variable in a way that is not recognized by the pipeline structure.