0
0
Jenkinsdevops~10 mins

CircleCI comparison in Jenkins - 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 Jenkins pipeline stage that runs tests.

Jenkins
stage('Test') {
    steps {
        [1] 'runTests.sh'
    }
}
Drag options to blanks, or click blank then click option'
Ash
Brun
Cexecute
Dscript
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'run' instead of 'sh' causes an error.
Using 'execute' is not a Jenkins step.
2fill in blank
medium

Complete the code to configure SCM polling with a cron schedule.

Jenkins
pipeline {
    agent any
    triggers {
        pollSCM('[1]')
    }
}
Drag options to blanks, or click blank then click option'
AH/5 * * * *
Bmain
C*/5 * * * *
Drefs/heads/main
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'main' or 'refs/heads/main' does not work; those are branch specifiers configured in SCM settings.
Cron schedules trigger polling regardless of branch; branch filters are set separately.
3fill in blank
hard

Fix the error in the Jenkinsfile to archive test results.

Jenkins
post {
    always {
        [1] artifacts: '**/test-results/*.xml', allowEmptyArchive: true
    }
}
Drag options to blanks, or click blank then click option'
AarchiveFiles
BarchiveArtifacts
Carchive
DsaveArtifacts
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'archive' causes a syntax error.
Using 'saveArtifacts' is not a Jenkins step.
4fill in blank
hard

Fill both blanks to define a Jenkins pipeline with environment variables and a build step.

Jenkins
pipeline {
    agent any
    environment {
        APP_ENV = '[1]'
    }
    stages {
        stage('Build') {
            steps {
                [2] 'build.sh'
            }
        }
    }
}
Drag options to blanks, or click blank then click option'
Aproduction
Bsh
Cdevelopment
Drun
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'run' instead of 'sh' causes errors.
Setting APP_ENV to 'development' is valid but not the expected answer here.
5fill in blank
hard

Fill all three blanks to create a Jenkins pipeline that checks out code, runs tests, and archives results.

Jenkins
pipeline {
    agent any
    stages {
        stage('Checkout') {
            steps {
                [1] scm
            }
        }
        stage('Test') {
            steps {
                [2] 'runTests.sh'
            }
        }
    }
    post {
        always {
            [3] artifacts: '**/test-results/*.xml'
        }
    }
}
Drag options to blanks, or click blank then click option'
Acheckout
Bsh
CarchiveArtifacts
Drun
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'run' instead of 'sh' causes errors.
Using 'archive' instead of 'archiveArtifacts' causes errors.