devpi-jenkins: Jenkins build trigger for devpi-server
Project description
devpi-jenkins: Jenkins build trigger for devpi-server
For use with devpi-server >= 2.2.0.
Installation
devpi-jenkins needs to be installed alongside devpi-server.
You can install it with:
pip install devpi-jenkins
For devpi-server there is no configuration needed, as it will automatically discover the plugin through calling hooks using the setuptools entry points mechanism.
Details about configuration below.
Configuration
devpi-jenkins can trigger Jenkins to test uploaded packages using tox. This needs configuration on two sides:
devpi: configuring an index to send POST requests to Jenkins upon upload
Jenkins: adding one or more jobs which can get triggered by devpi-jenkins.
Configuring a devpi index to trigger Jenkins
Here is a example command, using a /testuser/dev index and a Jenkins server at http://localhost:8080:
# needs one Jenkins job for each name of uploaded packages devpi index /testuser/dev uploadtrigger_jenkins=http://localhost:8080/job/{pkgname}/build
Any package which gets uploaded to /testuser/dev will now trigger a POST request to the specified url. The {pkgname} and {pkgversion} strings will be substituted with the name of the uploaded package. You don’t need to specify such substitutions, however, if you rather want to have one generic Jenkins job which executes all tests for all your uploads:
# one generic job for all uploaded packages devpi index /testuser/dev uploadtrigger_jenkins=http://localhost:8080/job/multijob/build
This requires a single multijob on the Jenkins side whereas the prior configuration would require a job for each package name that you possibly upload.
Note that uploading a package will succeed independently if a build job could be submitted successfully to Jenkins.
Configuring Jenkins job(s)
On the Jenkins side, you need to configure one or more jobs which can be triggered by devpi-jenkins. Each job is configured in the same way:
go to main Jenkins screen
hit “New Job” and enter a name (“multijob” if you want to configure a generic job), then select “freey style software project”, hit OK.
enable “This build is parametrized” and add a “File Parameter”, setting the file location to jobscript.py.
add a buildstep “Execute Python script” (you need to have the Python plugin installed and enabled in Jenkins) and enter execfile("jobscript.py").
hit “Save” for the new build job.
You can now devpi upload a package to an index and see Jenkins starting after the upload successfully returns.
Behind the scenes
Once you triggered a job from devpi, you can checkout the jobscript.py in the Jenkins workspace to see what was injected. The injected script roughly follows these steps:
retrieves a stable virtualenv release through the devpi root/pypi index (i.e. use its caching ability)
unpack the virtualenv tar ball and run the contained “virtualenv.py” script to create a _devpi environment
install/upgrade devpi-client into that environment
devpi use the index which we were triggered from
devpi test PKG where PKG is the package name that we uploaded.
Changelog
3.0.1 - 2024-08-04
Replace pkg_resources with importlib.resources. [fschulze]
Replace unmaintained py library usage with builtin Python functionality. [fschulze]
Drop support for Python <= 3.7. [fschulze]
Add support for Python 3.12.
3.0.0 - 2023-12-19
Drop support for Python <= 3.6. [fschulze]
Fix for new pluggy version. [fschulze]
Remove unused import from devpibootstrap.py.template. [fschulze]
2.0.0 - 2016-04-25
Drop support for Python 2.6 [fschulze]
fixes for devpi-server 3.0.0, older versions aren’t supported anymore [fschulze]
1.0.0 - 2015-05-13
include version in testspec for devpi test command [fschulze]
separated into plugin from devpi-server [fschulze (Florian Schulze)]
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
File details
Details for the file devpi-jenkins-3.0.1.tar.gz
.
File metadata
- Download URL: devpi-jenkins-3.0.1.tar.gz
- Upload date:
- Size: 109.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: devpi-server/6.6.0 (py3.8.6; darwin)
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | acf097449c4b9a89f207c07833db91945c922c99977cd891e59775abcffa39cd |
|
MD5 | d4328a773a8bb7fd8e29d55c0301c1d6 |
|
BLAKE2b-256 | f9e4a8f97ab973b366835618f96cdf27cda5ac75e68883a33bca6412eb7e8686 |
File details
Details for the file devpi_jenkins-3.0.1-py3-none-any.whl
.
File metadata
- Download URL: devpi_jenkins-3.0.1-py3-none-any.whl
- Upload date:
- Size: 6.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: devpi-server/6.6.0 (py3.8.6; darwin)
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | beb95bbfe60121a43fcbe9785b3c7cf004cbca2bd5ed7c5979834303cc64eb91 |
|
MD5 | 8eeeb68cf9413987c20dbe1b945b0f80 |
|
BLAKE2b-256 | 1012b9b32ff287e23ac8fc26ff49c20fae1bdbcc93a94ddc23fc4f9372fafb1d |