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?
Suggested Answer: E
Get Premium 701-100 Questions
as Interactive Web-Based Practice Test or PDF
Real Exam Format
Detailed Explanations
Instant Access
Get Your Practice Test
42 comments · newest first
LA
Laura
11 months ago
Wait, why isn't A the right choice? That seems weird.
KA
Kassandra
11 months ago
100% agree, D is the correct answer!
CA
Carlee
12 months ago
Surprised that it's not just $ENV{TargetEnvironment}.
MA
Malcolm
12 months ago
I thought it was $TargetEnvironment, but I guess not.
AV
Avery
12 months ago
It's definitely ${params.TargetEnvironment} for accessing parameters!
MI
Miesha
1 year ago
I feel like I've seen `$ENV{TargetEnvironment}` in other contexts, but it doesn't seem right for this Jenkins pipeline.
MA
Matthew
1 year ago
I practiced a similar question, and I believe the correct syntax is `${params.TargetEnvironment}`. It seems to match what I learned.
HE
Hector
1 year ago
I remember something about using `$` for variables, but I can't recall if it's just `$TargetEnvironment` or if it needs the `params` prefix.
JO
Johnetta
1 year ago
I think we use `${params.TargetEnvironment}` to access pipeline parameters, but I'm not completely sure.
AM
Amber
1 year ago
This seems straightforward to me. The question is clearly asking for the control that enables the AI-powered keyword and description suggestions, so the answer must be the Knowledge Suggestion Section.
JI
Jina
1 year ago
I'm a bit confused here. Increasing the Change Number of Copies to Start for the step doesn't seem like it would address the performance issue. I'm leaning towards splitting the step into multiple consecutive steps, but I'm not 100% sure that's the right approach.
FA
Fairy
1 year ago
I'm a bit unsure about this one. The question mentions "these", so I'll need to make sure I understand what the dladm command is responsible for managing. Let me re-read the options carefully.
VI
Virgina
1 year ago
Option E is clearly the answer - $ENV{TargetEnvironment} is the way to go, because everyone knows Jenkins pipelines are just glorified shell scripts, right? Right??
HO
Hollis
1 year ago
Option E is clearly the answer - $ENV{TargetEnvironment} is the way to go, because everyone knows Jenkins pipelines are just glorified shell scripts, right? Right??
CA
Catalina
1 year ago
E) $ENV{TargetEnvironment}
XU
Xuan
1 year ago
D) ${params.TargetEnvironment}
DA
Daryl
1 year ago
C) %TargetEnvironment%
JU
Judy
1 year ago
B) $TargetEnvironment
LO
Louisa
1 year ago
A) {{TargetEnvironment}}
MA
Marguerita
1 year ago
I'm just going to go with D and hope the exam gods smile upon me. Though, I have to admit, option E with the $ENV{TargetEnvironment} looks like it could be from a Perl script. This exam is getting confusing!
RY
Ryan
1 year ago
Haha, option C with the %TargetEnvironment% looks like something from a Windows batch script. This is definitely a Jenkins pipeline, so D is the right answer.
CA
Carmelina
1 year ago
I agree, D) ${params.TargetEnvironment} is the correct syntax to use the value provided for TargetEnvironment.
CA
Carolann
1 year ago
Yeah, using ${params.TargetEnvironment} is the standard way to access the value in a Jenkins pipeline.
LE
Leota
1 year ago
Option D) ${params.TargetEnvironment} is the correct way to use the value provided for TargetEnvironment.
DE
Deandrea
1 year ago
I was tempted to go with option B, but that's more of a shell variable syntax. The Jenkins pipeline syntax uses the params object, so D is the way to go.
JO
Joye
1 year ago
Good to know, thanks for clarifying!
KA
Kayleigh
1 year ago
Yes, you're right. The params object is used in Jenkins pipeline syntax.
LE
Leota
1 year ago
I think D) ${params.TargetEnvironment} is the correct way to access the value.
AS
Asuncion
1 year ago
I think option D is correct, as it uses the params object to access the TargetEnvironment parameter.
KA
Kandis
1 year ago
Definitely, ${params.TargetEnvironment} is the way to go to access the parameter value.
RO
Rosio
1 year ago
I think option D is the most appropriate choice in this scenario.
CA
Carolynn
1 year ago
Yes, using ${params.TargetEnvironment} allows the task to use the value provided for TargetEnvironment.
CA
Carry
1 year ago
I agree, option D is the correct way to access the value of TargetEnvironment parameter.
DE
Deja
1 year ago
That's a good choice. It's important to correctly access the parameters in a declarative Jenkins pipeline.
LO
Louvenia
1 year ago
Thanks for confirming. I will make sure to use ${params.TargetEnvironment} in my tasks.
CO
Corrina
1 year ago
Yes, you are right. Option D is the correct way to use the value provided for TargetEnvironment.
TH
Theola
1 year ago
D) ${params.TargetEnvironment}
EI
Eileen
1 year ago
I believe option D is correct, it accesses the TargetEnvironment parameter using the params object.
TI
Tiera
1 year ago
A) {{TargetEnvironment}}
ER
Erinn
2 years ago
I'm not sure, but I think it might be E) $ENV{TargetEnvironment}
SH
Shawnee
2 years ago
I agree with Raina, D) ${params.TargetEnvironment} makes sense because it references the parameter value
RA
Raina
2 years ago
I think the correct answer is D) ${params.TargetEnvironment}