Complete the code to use the credentials ID inside the withCredentials block.
withCredentials([usernamePassword(credentialsId: '[1]', usernameVariable: 'USER', passwordVariable: 'PASS')]) { echo "Username is $USER" }
The credentialsId must be the actual ID of the stored credentials in Jenkins.
Complete the code to use a secret text credential inside the withCredentials block.
withCredentials([string(credentialsId: '[1]', variable: 'TOKEN')]) { sh 'echo $TOKEN' }
The credentialsId must match the ID of the secret text credential stored in Jenkins.
Fix the error in the withCredentials block to correctly bind the username and password.
withCredentials([usernamePassword(credentialsId: 'cred-id', usernameVariable: '[1]', passwordVariable: 'PASS')]) { echo "User is $USER" }
The variable name USER matches the usage inside the block $USER.
Fill both blanks to correctly use multiple credentials inside the withCredentials block.
withCredentials([usernamePassword(credentialsId: '[1]', usernameVariable: 'USER', passwordVariable: '[2]')]) { echo "User: $USER, Password: $PASS" }
The credentialsId must be the correct ID, and the passwordVariable must match the variable used inside the block.
Fill all three blanks to correctly use a file credential inside the withCredentials block.
withCredentials([file(credentialsId: '[1]', variable: '[2]')]) { sh 'cat $[3]' }
The credentialsId is the ID of the file credential. The variable name must be consistent and used inside the shell command.