Fix this declarative Jenkinsfile
QuizEasy-MediumAsked in: Capgemini, Infosys
Jenkins rejects this Jenkinsfile before running it:
pipeline {
agent any
stages {
stage('Test') {
sh 'mvn -B test'
}
}
}
What is wrong?
- Steps inside a stage must be wrapped in a steps { } block
- agent any is not allowed
- Stage names cannot contain capital letters
- sh must be written as shell
This question is part of Pro+
Pro+ opens every question in Interview Prep and the mock interview. Every article and the first 2 questions of each topic stay free. Hands-on Selenium and API tasks follow their course lesson's own lock.