Complete the code to import the Jenkins library in Python.
import [1]
The jenkins library is used to interact with Jenkins servers in Python.
Complete the code to create a Jenkins server object with URL 'http://localhost:8080'.
server = jenkins.Jenkins([1])The Jenkins server URL is usually 'http://localhost:8080' when running locally.
Fix the error in the code to trigger a Jenkins build for job 'TestJob'.
server.[1]('TestJob')
The correct method to start a Jenkins job build is build_job.
Fill both blanks to check if the last build of 'DeployJob' was successful.
last_build_number = server.get_job_info('DeployJob')['[1]']['number'] status = server.get_build_info('DeployJob', last_build_number)['[2]']
The key to get the last build number is lastBuild. The build result status is under result.
Fill all three blanks to trigger a build with parameters for job 'TestJob'.
params = {'branch': 'main', 'env': 'staging'}
server.[1]('TestJob', [2]=[3])To trigger a parameterized build, use build_job method with parameters=params.
