Bird
0
0

In a Jenkins declarative pipeline, how do you correctly define a stage named 'Test' that runs a shell command?

easy📝 Syntax Q3 of 15
Spring Boot - Docker and Deployment
In a Jenkins declarative pipeline, how do you correctly define a stage named 'Test' that runs a shell command?
Astage('Test') { steps { sh 'mvn test' } }
Bstage: 'Test' { steps { sh 'mvn test' } }
Cstage('Test') steps { sh 'mvn test' }
Dstage('Test') { sh 'mvn test' }
Step-by-Step Solution
Solution:
  1. Step 1: Recall Jenkins declarative syntax

    Stages are defined with stage('name') { steps { ... } }
  2. Step 2: Identify correct block structure

    Steps must be inside a steps block within the stage.
  3. Final Answer:

    stage('Test') { steps { sh 'mvn test' } } -> Option A
  4. Quick Check:

    Stage needs steps block [OK]
Quick Trick: Stage requires steps block enclosing commands [OK]
Common Mistakes:
  • Omitting steps block
  • Using colon instead of parentheses
  • Placing shell command outside steps

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Spring Boot Quizzes