701-100 Exam QuestionsBrowse all questions from this exam

701-100 Exam - Question 4


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?

Show Answer
Correct Answer: BD

In a Jenkins declarative pipeline, when defining parameters, you access their values using the `params` object. For the given parameter `TargetEnvironment`, the correct way to reference its value in the pipeline is `${params.TargetEnvironment}`.

Discussion

3 comments
Sign in to comment
hmagrounOption: D
Mar 21, 2020

"D" see: https://jenkins.io/doc/book/pipeline/jenkinsfile/#handling-parameters

wo7andOption: D
Mar 8, 2022

D is correct answer, the question is about declarative pipeline, which written in Groovy. Correct way to call a parameter is ${params.<param_name>}

drinkwaterOption: D
Jul 3, 2021

D is the right answer