0
0
Jenkinsdevops~20 mins

Credentials plugin for secrets in Jenkins - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Jenkins Credentials Mastery
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate
1:30remaining
Understanding Jenkins Credentials Plugin Usage

Which of the following best describes the primary purpose of the Jenkins Credentials plugin?

ATo securely store and manage sensitive information like passwords and tokens for Jenkins jobs.
BTo provide a user interface for configuring Jenkins build triggers.
CTo monitor Jenkins system logs and alert on errors.
DTo automate Jenkins plugin updates without manual intervention.
Attempts:
2 left
💡 Hint

Think about what 'credentials' usually mean in software tools.

💻 Command Output
intermediate
1:30remaining
Output of Jenkins CLI Credentials List Command

What is the expected output when running the Jenkins CLI command to list credentials in a domain with no credentials stored?

Jenkins
java -jar jenkins-cli.jar -s http://jenkins.example.com/ list-credentials system::system::jenkins _
AERROR: No such domain or credentials found.
B[]
CNo credentials found.
D
Credentials list:
- id: admin-password
- id: ssh-key
Attempts:
2 left
💡 Hint

Consider how an empty list might be represented in command output.

Configuration
advanced
2:00remaining
Correct Jenkinsfile Snippet to Use Credentials Plugin

Which Jenkinsfile snippet correctly uses the Credentials plugin to access a secret text credential with ID 'my-secret'?

Jenkins
pipeline {
  agent any
  stages {
    stage('Use Secret') {
      steps {
        // Fill in the correct credentials usage
      }
    }
  }
}
A
steps {
  withCredentials(['my-secret']) {
    echo "Secret is $SECRET"
  }
}
B
steps {
  credentials('my-secret') {
    echo "Secret is $SECRET"
  }
}
C
steps {
  withSecret('my-secret') {
    echo "Secret is $SECRET"
  }
}
D
steps {
  withCredentials([string(credentialsId: 'my-secret', variable: 'SECRET')]) {
    echo "Secret is $SECRET"
  }
}
Attempts:
2 left
💡 Hint

Look for the correct syntax of the withCredentials step for secret text.

Troubleshoot
advanced
1:30remaining
Troubleshooting Missing Credentials Error

A Jenkins pipeline fails with the error: java.lang.IllegalArgumentException: No credentials found with id 'db-password'. Which is the most likely cause?

AThe Jenkinsfile syntax for <code>withCredentials</code> is incorrect causing the error.
BThe Jenkins agent does not have network access to the credentials store.
CThe credential with ID 'db-password' does not exist or is not accessible in the current Jenkins domain or folder.
DThe Jenkins master is running an outdated version of the Credentials plugin.
Attempts:
2 left
💡 Hint

Think about what 'No credentials found with id' means in Jenkins context.

🔀 Workflow
expert
2:30remaining
Correct Order to Securely Use Credentials in Jenkins Pipeline

Arrange the steps in the correct order to securely use a username and password credential in a Jenkins pipeline.

A1,2,3,4
B2,1,3,4
C1,3,2,4
D3,1,2,4
Attempts:
2 left
💡 Hint

Think about the logical flow from setup to usage.