Why does Jenkins require script approval for certain scripts in the pipeline?
Think about security risks when running scripts from different users.
Jenkins script approval is a security feature that blocks untrusted scripts from running until an administrator approves them. This prevents malicious or harmful code from executing.
What is the output of the following Jenkins CLI command when there are pending scripts for approval?
java -jar jenkins-cli.jar -s http://jenkins.example.com/ list-plugins --pending-script-approvals
Check if the command syntax matches Jenkins CLI commands for script approval.
The command 'list-plugins --pending-script-approvals' is invalid. The correct command to list pending script approvals is 'groovy =< script' or using the Jenkins UI. So this command returns an error.
Which configuration snippet in Jenkins Pipeline script allows a method call to be automatically approved without manual intervention?
Think about how Jenkins manages method signatures for script security.
Jenkins Script Security plugin lets administrators approve specific method signatures. Adding a method signature to the approved list allows scripts using that method to run without manual approval each time.
A Jenkins pipeline script fails with a security exception when calling a custom method. What is the most likely cause?
Consider Jenkins sandbox restrictions on unapproved methods.
Jenkins sandbox restricts execution of unapproved methods for security. If a custom method is not approved, the script will fail with a security exception.
What is the correct sequence of steps to approve a new method call used in a Jenkins pipeline script that is currently blocked by the sandbox?
Think about how Jenkins detects and approves new script methods step-by-step.
The pipeline must first run to create a pending approval request. Then an admin logs in, navigates to the approval page, and approves the method signature.