Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Jenkins automation scripts

Merge pull request #23 from bravegnu/master

Add support to update jobs, if they exist.
latest commit 70bb55ded4
Carles Barrobés i Meix authored
Failed to load latest commit information.
autojenkins Use the argument name _force instead of update.
docs Fix documentation typos
samples Add a sample for calling build wait
.gitignore More ignores
.travis.yml Looks like we're not ready for python 3.2 yet
AUTHORS Centralise HTTP requests to remove argument duplication. Plus PEP8.
MANIFEST.in Problems with version import
README.markdown Update README.markdown
README.rst
README.txt
TODO.txt Add TODO
ajk_version.py Prepare 1.0 by tidying up requirements etc
build.sh Version and build script updates
package-requirements.txt Add release script
release.sh Add release script
requirements.txt Prepare 1.0 by tidying up requirements etc
rtdocs.sh Added script to trigger building ReadTheDocs documentation
setup.py Prepare 1.0 by tidying up requirements etc
test-requirements.txt Test case for last_result

README.markdown

Travis CI

autojenkins

Automation (remote control) of Jenkins tasks. Includes a class autojenkins.Jenkins that you can use to drive Jenkins.

Things you can do with it:

  • Copy a job (e.g. from a template job)
  • Delete a job
  • Obtain the config.xml file for that job
  • Trigger building of a job
  • Obtain latest execution results
  • ...

Sample use:

from autojenkins import Jenkins

j = Jenkins('http://jenkins.pe.local')

# trigger a manual build and check results
j.build('warehouse-screens-us544_login')
j.last_result('warehouse-screens-us544_login')

# get only the result string (one of 'SUCCESS', 'UNSTABLE', 'FAILURE'):
j.last_result('warehouse-screens-us544_login')['result']

# get the configuration file for a job:
j.get_config_xml('template')

# Create a new job from a job named 'template', replacing variables
j.create_copy('my-new-job', 'template',
              repo='mbf-warehouse-screens',
              branch='us544_login',
              package='warehouse_screens')

# build
j.build('my-new-job')

# enable or disable
j.enable('my-new-job')
j.disable('my-new-job')

# check result and delete if successful:
result = j.last_result('my-new-job')['result']
if result == 'SUCCESS':
    j.delete('my-new-job')

Authentication

If your Jenkins server uses authentication, you can use HTTP basic authentication in this way:

jenkins = Jenkins('http://jenkins', auth=('user', 'pass'))

Note that you can use either a cleartext password or a Jenkins API token as the password.

Something went wrong with that request. Please try again.