A Python API for accessing resources on a Jenkins continuous-integration server.
Project description
Installation
pip install jenkinsapi
Important Links
About this library
Jenkins is the market leading continuous integration system.
Jenkins (and its predecessor Hudson) are useful projects for automating common development tasks (e.g. unit-testing, production batches) - but they are somewhat Java-centric.
Jenkinsapi makes scripting Jenkins tasks a breeze by wrapping the REST api into familiar python objects.
Here is a list of some of the most commonly used functionality
Add, remove, and query Jenkins jobs
- Control pipeline execution
Query the results of a completed build
Block until jobs are complete or run jobs asyncronously
Get objects representing the latest builds of a job
- Artifact management
Search for artifacts by simple criteria
Install artifacts to custom-specified directory structures
Search for builds by source code revision
- Create, destroy, and monitor
Build nodes (Webstart and SSH slaves)
Views (including nested views using NestedViews Jenkins plugin)
Credentials (username/password and ssh key)
Authentication support for username and password
Manage jenkins and plugin installation
Full library capabilities are outlined in the Documentation
Get details of jobs running on Jenkins server
"""Get job details of each job that is running on the Jenkins instance"""
def get_job_details():
# Refer Example #1 for definition of function 'get_server_instance'
server = get_server_instance()
for job_name, job_instance in server.get_jobs():
print 'Job Name:%s' % (job_instance.name)
print 'Job Description:%s' % (job_instance.get_description())
print 'Is Job running:%s' % (job_instance.is_running())
print 'Is Job enabled:%s' % (job_instance.is_enabled())
Disable/Enable a Jenkins Job
def disable_job():
"""Disable a Jenkins job"""
# Refer Example #1 for definition of function 'get_server_instance'
server = get_server_instance()
job_name = 'nightly-build-job'
if (server.has_job(job_name)):
job_instance = server.get_job(job_name)
job_instance.disable()
print 'Name:%s,Is Job Enabled ?:%s' % (job_name,job_instance.is_enabled())
Use the call job_instance.enable() to enable a Jenkins Job.
Known issues
Job deletion operations fail unless Cross-Site scripting protection is disabled.
For other issues, please refer to the support URL
Development
Make sure that you have Java installed. Jenkins will be automatically downloaded and started during tests.
Create virtual environment for development
Install package in development mode
uv sync
Make your changes, write tests and check your code
uv run pytest -sv
Python versions
The project has been tested against Python versions:
3.9 - 3.13
Jenkins versions
Project tested on both stable (LTS) and latest Jenkins versions.
Project Contributors
Aleksey Maksimov (ctpeko3a@gmail.com)
Salim Fadhley (sal@stodge.org)
Ramon van Alteren (ramon@vanalteren.nl)
Ruslan Lutsenko (ruslan.lutcenko@gmail.com)
Cleber J Santos (cleber@simplesconsultoria.com.br)
William Zhang (jollychang@douban.com)
Victor Garcia (bravejolie@gmail.com)
Bradley Harris (bradley@ninelb.com)
Kyle Rockman (kyle.rockman@mac.com)
Sascha Peilicke (saschpe@gmx.de)
David Johansen (david@makewhat.is)
Misha Behersky (bmwant@gmail.com)
Clinton Steiner (clintonsteiner@gmail.com)
Please do not contact these contributors directly for support questions! Use the GitHub tracker instead.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file jenkinsapi-0.3.17.tar.gz.
File metadata
- Download URL: jenkinsapi-0.3.17.tar.gz
- Upload date:
- Size: 403.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
63333ecb6b1684433e34ade0d205c87dfcc378163cfd02428078620973315790
|
|
| MD5 |
c3dee5273044462fc0120e3aef17579f
|
|
| BLAKE2b-256 |
57924bf312ee8b6cc4db4b256ab61d9694b9641c068c88237a2286e681b1447a
|
Provenance
The following attestation bundles were made for jenkinsapi-0.3.17.tar.gz:
Publisher:
release.yml on pycontribs/jenkinsapi
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
jenkinsapi-0.3.17.tar.gz -
Subject digest:
63333ecb6b1684433e34ade0d205c87dfcc378163cfd02428078620973315790 - Sigstore transparency entry: 660064334
- Sigstore integration time:
-
Permalink:
pycontribs/jenkinsapi@14d9d421401f0c1e912818205ae18a37e53ea288 -
Branch / Tag:
refs/tags/0.3.17 - Owner: https://github.com/pycontribs
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@14d9d421401f0c1e912818205ae18a37e53ea288 -
Trigger Event:
release
-
Statement type:
File details
Details for the file jenkinsapi-0.3.17-py3-none-any.whl.
File metadata
- Download URL: jenkinsapi-0.3.17-py3-none-any.whl
- Upload date:
- Size: 71.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3f12733b60e86e6f06c06756e9d10eb3cc5bd7fb3eeb0e04104200d3a68d8eac
|
|
| MD5 |
ca61d17363b3c728d73443dcd2ec0370
|
|
| BLAKE2b-256 |
2cbe3d4f916ad5953a67803b7bba5d99c00dc6bb9f903c4beb2a13aaaad3a990
|
Provenance
The following attestation bundles were made for jenkinsapi-0.3.17-py3-none-any.whl:
Publisher:
release.yml on pycontribs/jenkinsapi
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
jenkinsapi-0.3.17-py3-none-any.whl -
Subject digest:
3f12733b60e86e6f06c06756e9d10eb3cc5bd7fb3eeb0e04104200d3a68d8eac - Sigstore transparency entry: 660064337
- Sigstore integration time:
-
Permalink:
pycontribs/jenkinsapi@14d9d421401f0c1e912818205ae18a37e53ea288 -
Branch / Tag:
refs/tags/0.3.17 - Owner: https://github.com/pycontribs
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@14d9d421401f0c1e912818205ae18a37e53ea288 -
Trigger Event:
release
-
Statement type: