autojenkins.jobs

class autojenkins.jobs.Jenkins(base_url, auth=None, verify_ssl_cert=True, proxies={})

Main class to interact with a Jenkins server.

all_jobs()

Get a list of tuples with (name, color) of all jobs in the server.

Color is blue, yellow or red depending on build results (SUCCESS, UNSTABLE or FAILED).

build(jobname, params=None, wait=False, grace=10)

Trigger Jenkins to build a job.

Parameters:
  • params – If params are provided, use the “buildWithParameters” endpoint
  • wait – If True, wait until job completes building before returning
build_console(jobname, build_number=None)

Get the console output for the build of a job.

If no build number is specified, defaults to the most recent build.

build_info(jobname, build_number=None)

Get information for a build of a job.

If no build number is specified, defaults to the most recent build.

console_text(jobname, build_number='lastBuild')

Get console text output of last build.

copy(jobname, copy_from='template')

Copy a job from another one (by default from one called template).

create(jobname, config_file, **context)

Create a job from a configuration file.

create_copy(jobname, template_job, enable=True, _force=False, **context)

Create a job from a template job.

delete(jobname)

Delete a job.

disable(jobname)

Trigger Jenkins to disable a job.

enable(jobname)

Trigger Jenkins to enable a job.

get_config_xml(jobname)

Get the config.xml file that contains the job definition.

is_building(jobname)

Check if a job is building

job_info(jobname)

Get all information for a job as a Python object (dicts & lists).

job_url(jobname)

Get the human-browseable URL for a job.

last_build_console(jobname)

Get the console output for the last build of a job.

last_build_info(jobname)

Get information for last build of a job.

last_build_report(jobname)

Get full report of last build.

last_result(jobname)

Obtain results from last execution.

last_success(jobname)

Return information about the last successful build.

set_config_xml(jobname, config)

Replace the config.xml of an existing job.

transfer(jobname, to_server)

Copy a job to another server.

wait_for_build(jobname, poll_interval=3)

Wait until job has finished building