0
0
Jenkinsdevops~20 mins

System configuration management in Jenkins - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Jenkins System Configuration Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
💻 Command Output
intermediate
2:00remaining
Jenkins CLI: List all installed plugins
What is the output of the following Jenkins CLI command when run on a Jenkins server with plugins installed?
Jenkins
java -jar jenkins-cli.jar -s http://localhost:8080/ list-plugins
ALists all plugins with their versions and enabled/disabled status
BShows an error: 'list-plugins' is not a valid command
COutputs only the names of plugins without versions
DReturns an empty list even if plugins are installed
Attempts:
2 left
💡 Hint
Think about what the 'list-plugins' command is designed to show in Jenkins CLI.
Configuration
intermediate
2:00remaining
Jenkins Pipeline: Correct syntax for environment variables
Which Jenkins Pipeline snippet correctly sets environment variables for use in the pipeline?
Jenkins
pipeline {
  agent any
  environment {
    VAR1 = 'value1'
    VAR2 = 'value2'
  }
  stages {
    stage('Example') {
      steps {
        echo "VAR1 is ${VAR1} and VAR2 is ${VAR2}"
      }
    }
  }
}
A
environment {
  VAR1 => 'value1'
  VAR2 => 'value2'
}
B
environment {
  VAR1: 'value1'
  VAR2: 'value2'
}
C
environment {
  'VAR1' = 'value1'
  'VAR2' = 'value2'
}
D
environment {
  VAR1 = 'value1'
  VAR2 = 'value2'
}
Attempts:
2 left
💡 Hint
Look at the correct syntax for environment variables in Jenkins declarative pipeline.
🔀 Workflow
advanced
2:30remaining
Jenkins Job DSL: Creating a freestyle job with parameters
Which Job DSL script correctly creates a freestyle Jenkins job named 'BuildApp' with a string parameter 'BRANCH' defaulting to 'main'?
A
job('BuildApp') {
  parameters {
    stringParameter('BRANCH', 'main', 'Git branch to build')
  }
}
B
job('BuildApp') {
  parameters {
    string('BRANCH', 'main', 'Git branch to build')
  }
}
C
job('BuildApp') {
  parameters {
    stringParam('BRANCH', 'main', 'Git branch to build')
  }
}
D
job('BuildApp') {
  parameters {
    paramString('BRANCH', 'main', 'Git branch to build')
  }
}
Attempts:
2 left
💡 Hint
Check the exact method name for string parameters in Jenkins Job DSL.
Troubleshoot
advanced
2:30remaining
Jenkins Pipeline: Diagnosing a syntax error in a scripted pipeline
Given this Jenkins scripted pipeline snippet, what error will Jenkins report?
Jenkins
node {
  stage('Build') {
    echo 'Building...'
  }
  stage('Test')
    echo 'Testing...'
  }
}
ANo error, pipeline runs successfully
BSyntaxError: expecting '{' after stage declaration
CRuntimeException: stage 'Test' not found
DGroovyCastException: Cannot cast String to Closure
Attempts:
2 left
💡 Hint
Look carefully at the braces and structure after the 'stage('Test')' line.
Best Practice
expert
3:00remaining
Jenkins Configuration as Code (JCasC): Correct YAML snippet for global security
Which YAML snippet correctly disables Jenkins security using Configuration as Code (JCasC)?
A
jenkins:
  securityRealm:
    none: {}
  authorizationStrategy:
    anyoneCanDoAnything: {}
B
jenkins:
  securityRealm:
    local:
      allowsSignup: true
      users: []
  authorizationStrategy:
    anyoneCanDoAnything: false
C
jenkins:
  securityRealm:
    local:
      allowsSignup: false
      users: []
  authorizationStrategy:
    loggedInUsersCanDoAnything: false
D
jenkins:
  securityRealm:
    none: {}
  authorizationStrategy:
    loggedInUsersCanDoAnything: true
Attempts:
2 left
💡 Hint
Disabling security means no authentication required and full access for anyone including anonymous users.