A. stage names inside parallel must be unique; rename stages
B. parallel block cannot contain nested stage blocks directly; use map syntax with branches
C. parallel block requires agent declaration inside each stage
D. steps block cannot contain echo commands
Solution
Step 1: Identify parallel block syntax rules
The parallel directive expects a map of branch names to closures containing steps, not loose stage blocks inside {}.
Step 2: Fix the pipeline structure
Change to parallel( "Unit": { echo 'Unit tests' }, "Integration": { echo 'Integration tests' } ) to fix the syntax error.
Final Answer:
parallel block cannot contain nested stage blocks directly; use map syntax with branches -> Option B
Quick Check:
parallel uses branch map syntax [OK]
Hint: parallel must be outside steps block, directly under stage [OK]
Common Mistakes:
Placing parallel inside steps block
Ignoring pipeline syntax hierarchy
Assuming echo commands cause error
5. You want to run three tasks in parallel: 'Build', 'Test', and 'Deploy'. The 'Deploy' stage should only run if both 'Build' and 'Test' succeed. How do you structure the Jenkins pipeline to achieve this?
hard
A. Use parallel for 'Build' and 'Test' stages, then a separate 'Deploy' stage after parallel block
B. Put all three stages inside a single parallel block
C. Run 'Deploy' inside parallel block with 'Build' and 'Test' but add a condition to skip if others fail
D. Run 'Deploy' before 'Build' and 'Test' in parallel block
Solution
Step 1: Understand dependency requirements
'Deploy' must wait for 'Build' and 'Test' to finish successfully, so it cannot run in parallel with them.
Step 2: Structure pipeline accordingly
Run 'Build' and 'Test' inside a parallel block, then add a separate 'Deploy' stage after that block to run only if previous succeed.
Final Answer:
Use parallel for 'Build' and 'Test' stages, then a separate 'Deploy' stage after parallel block -> Option A
Quick Check:
Dependent stage runs after parallel block [OK]
Hint: Run dependent stages after parallel block, not inside it [OK]
Common Mistakes:
Putting dependent stage inside parallel block
Running deploy before build and test
Trying to conditionally skip stages inside parallel
Recommended
Ready to prove it?
Pass the test and this pattern moves unknownstrongwhile earning +1 Grip toward your certificate.