Coder Social home page Coder Social logo

devpi-jenkins's Introduction

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.

jenkins1.png

  • enable "This build is parametrized" and add a "File Parameter", setting the file location to jobscript.py.

jenkins2.png

  • add a buildstep "Execute Python script" (you need to have the Python plugin installed and enabled in Jenkins) and enter execfile("jobscript.py").

jenkins3.png

  • 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.

devpi-jenkins's People

Contributors

fschulze avatar hpk42 avatar jaraco avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.