Deal of The Day! Hurry Up, Grab the Special Discount - Save 25% - Ends In 00:00:00 Coupon code: SAVE25
Welcome to Pass4Success

- Free Preparation Discussions

CloudBees CJE Exam - Topic 2 Question 100 Discussion

Posted by Ben on Oct 20, 2024 at 02:16 PM

You have a stage called "Promote to Green," and you only want to run it when "development" is the current branch in a multibranch pipeline. How would you use the "when" declarative to accomplish this?

Suggested Answer: D

Authorization and authentication are different but related concepts. They don't vary or indicate a level of strictness.


Get Premium CJE Questions as Interactive Web-Based Practice Test or PDF Real Exam Format Detailed Explanations Instant Access Get Your Practice Test
31 comments · newest first
JA
Janessa 11 months ago
D looks wrong to me, just a string without context.
HU
Hubert 11 months ago
Wait, is B really an option? That seems off.
JE
Jerrod 11 months ago
Definitely A, no doubt about it!
EM
Emilio 11 months ago
I think C could work too, but not sure.
JE
Jeanice 11 months ago
A is the correct syntax for that!
SA
Salena 12 months ago
I have a vague memory of using "when" in a different context, but I can't recall if option D is valid syntax.
LE
Leatha 12 months ago
I practiced a similar question, and I think it was about checking branches. I might lean towards option A as the best choice.
CE
Cecil 12 months ago
I'm not entirely sure, but I feel like option C could be right too, since it uses a condition.
HO
Horace 1 year ago
I remember studying the "when" directive, and I think option A looks correct since it specifies the branch directly.
LO
Lorean 1 year ago
The key here is using the "when" declarative to check the current branch. Based on the options, I think A is the correct answer - "when { branch 'development' }". It's a simple and direct way to achieve the desired behavior.
CA
Carissa 1 year ago
I'm a little confused by the wording of the question. Is it asking for the specific syntax to use in the "when" declarative, or is it asking for the overall approach to accomplish this? I want to make sure I understand the question fully before answering.
EV
Evangelina 1 year ago
Okay, let me think this through. We want to run the "Promote to Green" stage only when the current branch is "development", so I'm guessing the answer is either A or C. I'm leaning towards A since it looks more straightforward.
GE
Gerry 1 year ago
Hmm, I'm a bit unsure about this one. I know we need to use the "when" declarative, but I'm not sure if the syntax is exactly "when { branch 'development' }" or if there's something else I'm missing.
RE
Reid 1 year ago
I'm pretty confident this one. I think the answer is A - "when { branch 'development' }".
LA
Latrice 1 year ago
I wonder if they have a 'Promote to Chartreuse' stage as well. Or maybe a 'Demote to Mauve' option for those special occasions.
VA
Vallie 1 year ago
Option D is just a bit too simple, don't you think? 'when 'development'' doesn't really give us the control we need. I'll stick with Option A for this one.
DE
Delmy 1 year ago
↳ replying to Vallie
Let's go with Option A for this one.
VA
Val 1 year ago
↳ replying to Vallie
Using 'when { branch 'development' }' gives us the control we need.
FE
Felix 1 year ago
↳ replying to Vallie
I think Option A is the best choice here.
MI
Micaela 1 year ago
↳ replying to Vallie
I agree, Option D is too simple.
TO
Toi 1 year ago
Ooh, Option C is interesting. Using a script-style condition with a variable is a bit more advanced. But I think Option A is the cleaner, more declarative solution.
NA
Nathalie 1 year ago
↳ replying to Toi
User 3: I agree, Option A is more declarative and easier to understand.
LY
Lynda 1 year ago
↳ replying to Toi
User 2: Yeah, using 'branch' to specify the condition seems cleaner.
VE
Veronica 1 year ago
↳ replying to Toi
User 1: I think Option A is the way to go.
CH
Chu 1 year ago
Hmm, Option B is a bit off the mark. Checking for the 'master' branch when we want 'development' seems like a mistake. I'd steer clear of that one.
MO
Mona 1 year ago
Ah, the classic 'Promote to Green' question. Option A looks like the winner to me - using the 'branch' declarative to check for the 'development' branch. Nice and straightforward!
TA
Tamar 1 year ago
↳ replying to Mona
User 2: Yeah, that seems like the most logical choice. Let's go with that.
RO
Ronny 1 year ago
↳ replying to Mona
User 1: I think option A is the way to go, checking for the 'development' branch.
OW
Owen 2 years ago
I'm not sure, but I think C) when( $branch == 'development') could also work if you define the variable 'branch' correctly in the pipeline script.
AN
Andrew 2 years ago
I agree with Mabelle. Using branch condition in the 'when' declarative is the right way to ensure the stage runs only on the 'development' branch.
MA
Mabelle 2 years ago
I think the correct answer is A) when { branch 'development' } because it specifies the branch condition.
0/2000 characters

Save Cancel