0
0
Spring Bootframework~10 mins

CI/CD pipeline basics in Spring Boot - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to define a basic Jenkins pipeline stage named 'Build'.

Spring Boot
stage('Build') {
    steps {
        [1] 'mvn clean package'
    }
}
Drag options to blanks, or click blank then click option'
Ash
Brun
Cexecute
Dcommand
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'run' or 'execute' instead of 'sh' causes errors.
2fill in blank
medium

Complete the code to trigger the pipeline on SCM changes using polling.

Spring Boot
pipeline {
    agent any
    triggers {
        [1] 'H/5 * * * *'
    }
}
Drag options to blanks, or click blank then click option'
AbranchFilter
BwhenBranch
CpollSCM
Dbranch
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'branchFilter' or 'whenBranch' are not valid Jenkins triggers.
3fill in blank
hard

Fix the error in the Jenkins pipeline snippet to archive the build artifact 'target/app.jar'.

Spring Boot
post {
    success {
        [1] artifacts: 'target/app.jar'
    }
}
Drag options to blanks, or click blank then click option'
AarchiveArtifacts
BstoreArtifacts
CsaveArtifacts
DarchiveFiles
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'archiveFiles' or 'saveArtifacts' causes pipeline errors.
4fill in blank
hard

Fill both blanks to define a stage that deploys the app only if the branch is 'main'.

Spring Boot
stage('Deploy') {
    when {
        [1] '[2]'
    }
    steps {
        echo 'Deploying application'
    }
}
Drag options to blanks, or click blank then click option'
Abranch
Bmain
Cdevelop
Denvironment
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'environment' or wrong branch names causes the stage to skip or error.
5fill in blank
hard

Fill all three blanks to create a pipeline that builds, tests, and deploys with proper stages.

Spring Boot
pipeline {
    agent any
    stages {
        stage('Build') {
            steps {
                [1] 'mvn clean package'
            }
        }
        stage('Test') {
            steps {
                [2] 'mvn test'
            }
        }
        stage('Deploy') {
            steps {
                echo '[3]'
            }
        }
    }
}
Drag options to blanks, or click blank then click option'
Ash
CDeploying application
Drun
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'run' instead of 'sh' causes errors.
Not echoing a message in deploy stage misses feedback.