Complete the code to set the Jenkins system message.
jenkins.model.Jenkins.instance.setSystemMessage("[1]")
The setSystemMessage method sets the message shown on the Jenkins dashboard. "Welcome to Jenkins!" is a common friendly message.
Complete the code to enable Jenkins security.
jenkins.model.Jenkins.instance.setSecurityRealm(new [1]())HudsonPrivateSecurityRealm is the built-in Jenkins security realm that manages users internally.
Fix the error in the code to set the number of executors to 4.
jenkins.model.Jenkins.instance.setNumExecutors([1])The setNumExecutors method expects an integer number, so 4 without quotes is correct.
Fill both blanks to configure Jenkins to use the 'admin' user and set the authorization strategy to full control.
jenkins.model.Jenkins.instance.setSecurityRealm(new HudsonPrivateSecurityRealm(false)) jenkins.model.Jenkins.instance.setAuthorizationStrategy(new [1]()) jenkins.model.Jenkins.instance.getSecurityRealm().createAccount("[2]", "password")
The LoggedInUsersCanDoAnythingAuthorizationStrategy grants full control to logged-in users. The user 'admin' is created with a password.
Fill the blanks to create a new Jenkins job named 'MyJob' of type freestyle and save it.
import hudson.model.FreeStyleProject import jenkins.model.Jenkins project = Jenkins.instance.createProject([1], "[2]") project.save()
The createProject method needs the project class and the job name. FreeStyleProject.class is the correct class for freestyle jobs, and "MyJob" is the job name.