0
0
Jenkinsdevops~10 mins

Script approval and sandbox in Jenkins - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to approve a script signature in Jenkins.

Jenkins
def approved = Jenkins.instance.getExtensionList('hudson.scm.SCM')[0].[1]('script-signature')
Drag options to blanks, or click blank then click option'
AgetDescriptorByName
BgetDescriptor
CgetScriptApproval
DgetSignature
Attempts:
3 left
💡 Hint
Common Mistakes
Using getDescriptor or getDescriptorByName instead of getScriptApproval.
Trying to get a signature directly without accessing script approval.
2fill in blank
medium

Complete the code to check if a script is approved in Jenkins sandbox.

Jenkins
def isApproved = Jenkins.instance.getScriptApproval().[1]('signature')
Drag options to blanks, or click blank then click option'
AhasSignature
BisSignatureApproved
CisApproved
DcheckApproval
Attempts:
3 left
💡 Hint
Common Mistakes
Using isApproved which is not a method in this context.
Using hasSignature which only checks presence, not approval.
3fill in blank
hard

Fix the error in the code to add a script signature for approval.

Jenkins
Jenkins.instance.getScriptApproval().[1]('new-signature')
Drag options to blanks, or click blank then click option'
AaddSignature
BapproveSignature
CaddApprovedSignature
DaddScriptSignature
Attempts:
3 left
💡 Hint
Common Mistakes
Using approveSignature which is not a method.
Using addScriptSignature which does not exist.
4fill in blank
hard

Fill both blanks to create a script approval object and approve a signature.

Jenkins
def approval = Jenkins.instance.[1]()
approval.[2]('signature-to-approve')
Drag options to blanks, or click blank then click option'
AgetScriptApproval
BapproveSignature
CaddSignature
DgetApproval
Attempts:
3 left
💡 Hint
Common Mistakes
Using getApproval which does not exist.
Using addSignature instead of approveSignature for approval.
5fill in blank
hard

Fill all three blanks to reject a script signature and save the approval state.

Jenkins
def approval = Jenkins.instance.[1]()
approval.[2]('signature-to-reject')
approval.[3]()
Drag options to blanks, or click blank then click option'
AgetScriptApproval
BrejectSignature
Csave
DremoveSignature
Attempts:
3 left
💡 Hint
Common Mistakes
Using removeSignature which does not reject but removes.
Forgetting to call save() after changes.