It has been migrated to the Jenkins community:
https://github.com/jenkinsci/gearman-plugin/
Depends-On: Ib6010d7ce85a934501c50a53e9ac78dcf74bc403
Change-Id: I0c84db2ad3fbb4d9f0eff793a0159c6ed3a8e25c
Plugin runs as user "anonymous". Escalate priviledges so it can find
projects/builds also in the case that "anonymous" user does not have
read permissions for them.
Change-Id: Iccf19460bb02a450d4a82fdabaf9dbc37a3ffe97
There was at least one error, likely a race condition, with the
previous code which could cause more than one ExecutorWorkerThread for
a node to be spawned. In particular, I think the bogus comparison in
ComputerListenerImpl may have a large part in that (it checked to see
if a _Computer_ object was in a list of _Thread_ objects).
To improve reliability around adding and removing nodes, all related
functionality is moved to the GearmanProxy class. Any methods (most
of them) that have to do with starting or stopping worker threads are
synchronized on the GearmanProxy monitor (the important parts of most
threads were already synchronized on the worker list before, so this
should not be much of a performance change).
The methods that start management and executor threads now do their
own checking to verify that such threads do not already exist, making
it so that calling them is more idempotent. Existing checks external
to the class have been removed (these were likely somewhat racy).
To avoid keeping redundant data structures, the node availability list
is removed, and instead if we need to find an availability object, we
walk the list of worker threads and compare to their nodes. Because
we do this so much, the list of worker and management threads are
changed to use those explicit classes instead of
AbstractWorkerThreads.
The accessor methods for the internal lists of worker threads is
removed to ensure that they are only managed through GearmanProxy.
This changed some unit tests and required the removal of one complete
test (which was not doing much more than verifying the addition
operator).
Also, when stopping ExecutorWorkerThreads, stop all of the ones
associated with a node.
When a computer goes offline, Computer.getNode() returns null, so we
can't know which workers should be deleted. Instead of using Nodes as
keys for our workers, use Computers instead and change everything to
use Computer (most functions needed Computer rather than Node anyway),
and in the few remaining places where a Node is needed, convert the
other direction.
Change-Id: Ia5084579317f972400069cc3e84db4e0b6560a80
* Use name+number as the build identifier for all meta-jobs.
(Zuul has name + number as build metadata, so avoid adding new/duplicate
features).
* Refer to the name of the manager worker as 'manager' instead of 'master'
to avoid jenkins specifics.
* Just call the url "url" instead of "full_url".
* Change SetDescriptionWorker to use name+number as the build id.
Also, expect 'html_description' instead of 'description'.
* Don't catch as many exceptions, instead, let them propogate so that they
get turned into WORK_EXCEPTION packets with information (instead of
WORK_FAIL packets which have no info).
* Change StopJobWorker to use the same name+number interface as
setDescriptionWorker (for consistency, expandability, plus it makes
the code simpler).
Change-Id: I8e078540c252bf9c1f14b79f8182517cbaa13555
src/main/java/hudson/plugins/gearman/AbstractWorkerThread.java
Removed Id field, it was initially added because I thought it was the plugin's
responsibility to cancel jobs that are on the gearman queue. We've decided that
it will be the client (zuul or otherwise) responsibility to cancel jobs from the gearman
queue. The gearman plugin will cancel jobs that have already been put on the
jenkins queue.
src/main/java/hudson/plugins/gearman/ComputerListenerImpl.java
src/main/java/hudson/plugins/gearman/ExecutorWorkerThread.java
src/main/java/hudson/plugins/gearman/GearmanPluginConfig.java
src/main/java/hudson/plugins/gearman/GearmanProxy.java
src/main/java/hudson/plugins/gearman/ManagementWorkerThread.java
src/main/java/hudson/plugins/gearman/StartJobWorker.java
Refactor to reduce code duplication. Consolidated creation of management worker and
executor workers. Added a fix so that executors spawned on master node
is named 'master-manager' for the manager and 'master-exec-#' for executors
src/test/java/hudson/plugins/gearman/ManagementWorkerThreadTest.java
Added test to make sure worker name is set correctly
src/main/java/hudson/plugins/gearman/GearmanPluginUtil.java
src/test/java/hudson/plugins/gearman/GearmanPluginUtilTest.java
Useful utils for the gearman plugin with tests
Change-Id: I96e097dc0dbf5cd78e5e82af584976085aee61b3
This commit adds a few unit tests for the gearman-plugin.
A few things were refactored from creating the tests.
1. move methods from GearmanPluginUtil to GearmanPluginConfig
2. removed a few unused methods.
Change-Id: I8ccd0000ff528867c66958294192818f35d83383
Checkin to change README from txt to rst format.
Jenkins seems to hijack logging so i've removed all of the
logging specific bindings that were added previously.
I also added "----" to begining of this plugin's logging
messages so i could easily keep track of them.
Change-Id: Ibd8c56af5b9ad18152bcb0d3ff0c41168a6d2fd1
This checkin attempts to make gearman plugin objects thread safe.
src/main/java/hudson/plugins/gearman/SaveableListenerImpl.java
Decided that this was not needed.
src/main/java/hudson/plugins/gearman/GearmanPluginConfig.java
Added method to allow other objects to access gearman server
launchWorker, host, and port settings
src/main/java/hudson/plugins/gearman/GearmanPluginUtil.java
Useful utilities for this plugin
src/main/java/hudson/plugins/gearman/AbstractWorkerThread.java
src/main/java/hudson/plugins/gearman/ComputerListenerImpl.java
src/main/java/hudson/plugins/gearman/ProjectListener.java
src/main/java/hudson/plugins/gearman/GearmanProxy.java
Made object private and added syncronized setters and getters
Change-Id: I04ca6a275ba8184bd18cf8954d07b94d02b2a47d
This change is to create a new object to store Gearman
objects and state info.
src/main/java/hudson/plugins/gearman/GearmanProxy.java
created to keep Gearman state info.
src/main/java/hudson/plugins/gearman/GearmanPluginConfig.java
simplied this class by removing the core gearman stuff out to
a GearmanProxy.java class
src/main/java/hudson/plugins/gearman/Constants.java
Use one logger instead of two. updated logger reference in all
of the other files in this checkin
src/main/java/hudson/plugins/gearman/ProjectListener.java
src/main/java/hudson/plugins/gearman/StartJobWorker.java
src/main/java/hudson/plugins/gearman/StopJobWorker.java
src/main/java/hudson/plugins/gearman/ComputerListenerImpl.java
update references to changed class and methods
Change-Id: I879cdb8839c8b5437bccf6d7e1602c33eff434a6