There are cases where asking for depth>0 node_info will 500. This breaks
listing jobs because we raise and stop looking for running jobs. Handle
this by checking if it is a 500 error at depth=2 and if so check
depth=0. If that returns successfully treat it as a broken slave that
isn't running any jobs.
If depth=0 returns an error things are probably much more broken and
should be looked into.
Change-Id: Ieac15a0fe2a47ec3dae51db96ad2fe40992c353a
To allow PluginVersion class to be passed to builtin functions expecting
a string type, need to use 'str' as the base class. This ensures
the change to support version comparison is completely transparent to
the calling code, but permits changes to benefit from the new behaviour
without breaking existing usage.
Change-Id: I7d434294fa45171e47ea4876d01398cb75f5d962
Add the ability to install the latest version of a Jenkins plugin.
Thanks to Fatih Degirmenci for providing the groovy script[1]
[1] http://pastebin.com/9qWeVYSP
Change-Id: I67a0b02710a9f5007a6529d87222e5777e744337
Add some common management and version comparison capabilities via
dedicated classes to simplify how calling libraries can perform version
checks on the installed plugins.
Update the comments on the existing methods to note that they return the
raw plugin data in JSON format instead of the parsed local objects.
Change-Id: If43bb945f55c6fb9f8a6595091eace12e4630ffa
We can discover the next build number Jenkins will use for a particular
job using get_job_info(), but there's currently no way through
python-jenkins to set the next build number. This change introduces
the set_next_build_number() method which, given a job name and a
desired number, sets the next build number of the named job to the
given number.
Limitations: Jenkins enforces that build numbers must be monotonically
increasing, but gives no indication of an error; it simply ignores the
offending value.
Change-Id: I23b5a84b7ea37d66bf778a89343e3c81ffa9ceb6
This patch adds cloudbees folder plugin support. Folder should be
specified in job name : <folder>/<job>
This update also extend job_builder
(http://ci.openstack.org/jenkins-job-builder/) tool without any
modification.
Change-Id: I6d3957c217e1253e53152d90d5fcce5e69c77674
Co-Authored-By: Darragh Bailey <daragh.bailey@gmail.com>
It can be useful to get a list of running builds from jenkins. This is
particularly useful when you need to take an action on a specific built
or if you need to know when the jenkins master has finished running all
builds (say after quieting down). Add a function to return this list.
Change-Id: I5c7dac8076250f94cd2b358c5b153d9410f53aee
If we run python3 tests before python2 tests the testrepository DB works
fine. If we run python2 first the python3 tests cannot read the
testrepository DB. The simple fix here is to change the order of the tox
env list so that python3 always runs first.
Change-Id: I5118c65f07c0f761e211cd2f186ab11d2f8a3393
This adds a Jenkins.quiet_down() method which can be used to quiet down
the server. Unit tests included.
Change-Id: I4e229aae6ad766bc6194a643fcd514e5538d6fa7
Split existing tests into separate files and classes to make it easier
to select a subset to be executed when making modifications.
Add some simple consolidations of test data as example improvements that
can be extended by consolidating complete tests or sets of tests.
Change-Id: If2380e6f4e848ba68f05868e2ef4186d7912952b
Change where noindex is used to allow indexing of all the jenkins object
methods. This allows for cross reference links to methods to be created
in the documentation and sphinx will automatically generate the
necessary links.
Change-Id: Ic9c28debca382a003ae9560f0bf7943c35ef187d
Ensure process terminate is only called after checking whether the
process is still running so as not to accidentally set an exitcode.
Additionally include improved message exchange and capturing to allow
for easier debug should the expected exceptions not appear on socket
timeouts.
Change-Id: Ic51745ffa67570e9a3ca4574d2bfc54d0cd6724b
Move to using a helper method for constructing urls to ensure that call
interpolation is done using urlencoded values.
Change-Id: I318456a26a8651a8369e3a396b69354cb3793e43
Add tests that use a simple socket server instance that opens the port
and ignores all data in order to support testing when the socket timeout
is set and catching the exception triggered. Also test that when not set
that the request will continue to remain connected for a period of time
longer than the other test using a wrapper time limit process.
Includes some helper classes to black hole all requests by simply
listening using a socketserver but never accepting connections, and a
time limit function to allow wrapping actions with a time limit when
checking for blocking behaviour where the call should not return and
will need to be focibly terminated.
Change-Id: Idab98b0121adb26aed6320ddcf2afbdf2c4428e0
Pin mock to < 1.1 as newer versions no longer work on python 2.6.
Remove duplicate unittest2 for python 2.6 test env.
Adding warning to mark python 2.6 support as deprecated and intended to
be removed.
Testtools re-added the requirement for unittest2 so the separate
dependency for python 2.6 created a duplicate error that causes tox
to fail.
Change-Id: Ia79eeeb5d2432cf1025631a1722de5fb1babe2c9
Remove the path injection being added by the helper module which was a
carry over from when the tests where executed directly via Makefile.
Change-Id: I435f039d75fdf55b295060656d071b011190973d
This patch allows users to create, delete, reconfigure, and list views in
Jenkins. It is very similar to the protocols for working with jobs and has the
same code structure and format.
Change-Id: I79c557520cc9a417399a1a18df0f57da6904ab0e
change I542d56b6c392 attempted to pass a byte object to the url request
but instead mistakenly passed it to the jenkins_open method. This
change fixes the problem.
Change-Id: I750aa476e5fe69cead784c45ba81aaf683b19df6
This patch aims to pin pbr>=0.8.2,<2.0 instead of pbr>=0.8.2,<1.0.
To do that, we also need to update test-requirements.txt to pin hacking
to <0.11 (like in current Global OpenStack requirements).
We also need to ignore some hacking rules.
Some distros ship 1.0.1 so it conflicts with the version in
requirements.
Change-Id: I3620c5fe72e49e226f2f5d1e6c36179eb053f424
Ensure that the parameters passed to POST requests are in the correct format.
As with change Ia6ce75958bb, this change ensures that the parameters passed to
POST requests are in the correct format so the data needed to trigger the use
of POST won't result in an exception being thrown due to use of str instead
of unicode on python 3.
Change-Id: I542d56b6c392a8390d9eea6a860c798eade3f925
Need to exercise the Request object on python3 to ensure that the
parameters passed to it are in the correct format. Use a simple
combination of the opener and required handler to be able to have the
url handling code parse the Request object created for performing API
calls.
Change-Id: Ia6ce75958bb18a743b7fd88d9512fcba3128a527
Before this patch python 3.x would cause TypeError's when communicating
to the jenkins server.
- Added Python 3 support for get_version
Change-Id: I24f0cd46663e5e8b3a06f52e1e0c57dd99a22c5f
Until now it has not been possible to enumerate build nodes connected to
the master. This commit adds the support via get_nodes() method, which
returns a list of dicts with name and offline-status for the nodes.
Signed-off-by: Antoine Musso <hashar@free.fr>
Change-Id: Ia51ee71196a80e365693959edac860730e7ea202
The get_job_info_regex method allows a user to get a list of jobs
information that match by the job name.
Change-Id: I1cfccdef0bbd81a039725a1ed63eae077d610c4b
My man Guido, who's been testing Jenkins connections lately, says doing
this is better than setting it to an arbitrary value. The timeout can
be overriden when instantiating the jenkins client.
Change-Id: Ib74e6a11b87c9e9340be8c303d580ae656ee7e46