0
0
Jenkinsdevops~20 mins

Jenkins configuration as code (JCasC) - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
JCasC Mastery Badge
Get all challenges correct to earn this badge!
Test your skills under time pressure!
💻 Command Output
intermediate
2:00remaining
JCasC YAML Loading Behavior
Given this Jenkins Configuration as Code (JCasC) YAML snippet, what will be the output when Jenkins loads it?
jenkins:
  systemMessage: "Welcome to Jenkins"
  numExecutors: 3
  securityRealm:
    local:
      allowsSignup: false
      users:
        - id: "admin"
          password: "admin123"
AJenkins fails to load the configuration due to missing 'authorizationStrategy' section and throws an error.
BJenkins ignores the 'numExecutors' setting and uses default 2 executors, but sets system message and user correctly.
CJenkins sets system message to 'Welcome to Jenkins', number of executors to 3, and creates a local user 'admin' with password 'admin123'.
DJenkins sets system message and executors but does not create any users because 'users' list is empty.
Attempts:
2 left
💡 Hint
Check if the YAML defines required fields for system message, executors, and local users.
Troubleshoot
intermediate
2:00remaining
Troubleshooting JCasC Plugin Failure
You applied a JCasC YAML file to Jenkins but the configuration did not apply and Jenkins logs show:
java.lang.IllegalArgumentException: No enum constant jenkins.security.s2m.AdminWhitelistRule

What is the most likely cause?
AThe YAML file contains an invalid value for the 'authorizationStrategy' field.
BThe Jenkins instance is missing the JCasC plugin entirely.
CThe Jenkins home directory is not writable by the Jenkins process.
DThe YAML file is missing the 'jenkins' root key.
Attempts:
2 left
💡 Hint
Look at the error mentioning 'No enum constant' related to security.
Configuration
advanced
2:00remaining
Configuring Jenkins Global Tools with JCasC
Which YAML snippet correctly configures a JDK installation named 'jdk11' with JAVA_HOME '/usr/lib/jvm/java-11-openjdk' using Jenkins Configuration as Code?
A
tool:
  jdk:
    installations:
      - name: "jdk11"
        home: "/usr/lib/jvm/java-11-openjdk"
B
jenkins:
  tools:
    jdk:
      installations:
        - name: "jdk11"
          home: "/usr/lib/jvm/java-11-openjdk"
C
jenkins:
  tool:
    jdk:
      installations:
        - name: "jdk11"
          home: "/usr/lib/jvm/java-11-openjdk"
D
tools:
  jdk:
    installations:
      - name: "jdk11"
        home: "/usr/lib/jvm/java-11-openjdk"
Attempts:
2 left
💡 Hint
Global tools are configured under the 'jenkins' root key and 'tools' section.
🔀 Workflow
advanced
2:00remaining
JCasC and Pipeline Job Creation
You want to create a Jenkins pipeline job named 'build-app' using JCasC. Which approach is correct?
AUse JCasC to configure Jenkins system only; jobs must be created manually.
BJCasC does not support job creation; use Job DSL or REST API instead.
CCreate a seed job with Job DSL and then export its configuration to JCasC YAML.
DDefine the pipeline job under 'jobs:' section in JCasC YAML with its pipeline script inline.
Attempts:
2 left
💡 Hint
JCasC supports job definitions under a specific section.
Best Practice
expert
2:00remaining
Best Practice for Managing Secrets in JCasC
What is the recommended way to manage sensitive credentials when using Jenkins Configuration as Code (JCasC)?
AUse Jenkins Credentials Plugin and reference credentials by ID in JCasC YAML without storing secrets in the YAML.
BStore all secrets directly in the JCasC YAML file encrypted with a custom key.
CEmbed secrets as plain text in the JCasC YAML but restrict file system permissions tightly.
DUse environment variables in the JCasC YAML to inject secrets at runtime.
Attempts:
2 left
💡 Hint
Consider security best practices for secret management in Jenkins.