You could use a QueueTaskDispatcher [1] to block any builds (except the
vetting jobs) from running on the node until it has cleared the vetting
process. And using the NodeLabel parameter plugin [2] you could schedule a
job to run on a specific Node (the one that just connected).
You could also use an OptionalJobPropery [3] to mark specific jobs as being
specially for this purpose or maybe pick all jobs in a special Folder [4].


[1]
http://javadoc.jenkins-ci.org/hudson/model/queue/QueueTaskDispatcher.html
[2] https://wiki.jenkins-ci.org/display/JENKINS/NodeLabel+Parameter+Plugin
[3] http://javadoc.jenkins-ci.org/jenkins/model/OptionalJobProperty.html
[4] https://wiki.jenkins-ci.org/display/JENKINS/CloudBees+Folders+Plugin

/B

On Thu, Mar 17, 2016 at 2:33 AM, Antonio Beyah <[email protected]>
wrote:

> I have recently started using the Jenkins Swarm plugin which grants us the
> ability to allow dynamic agents to join the cluster, I am thinking about
> writing a plugin that would perform a set of actions before the agent is
> allowed to take jobs, irrespective of the 'mode' or 'label' assignments.
>
> When a new agent joins, I would like to be able to run a set of tests, or
> jobs that would signify whether or not the agent is capable of taking on
> real jobs.  Things such as: checkout code from scm, run a gradle build, etc
>
> My thinking for implementation:
> - When an agent joins the cluster, don't allow it to take any jobs until
> it is vetted
> - To vet the agent, a set of jobs would all be required to pass (run and
> return a success)
>
> More implementation details:
> 1) When an agent joins, immediately set its mode to 'exclusive' and change
> all labels to <label>_candidate
> 2) Do a search for any job with the <label>_candidate restriction and run
> those jobs
> 3) If those jobs are all successful, remove the <label>_candidate label
> and set the mode back to its original setting
>
> My questions:
> 1) Is there a better way to do this?
> 2) What extension points should I look at to do this?  So far I have
> started looking at hudson.slaves.ComputerListener but am unsure if I can
> hook in early enough to prevent any jobs from running on the newly added
> agent before changing it
> 3) Does a plugin already exist that does this or have similar behavior?
>
> Any guidance would be appreciated.
>
> Thanks!
> Antonio
>
> --
> You received this message because you are subscribed to the Google Groups
> "Jenkins Developers" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/jenkinsci-dev/98cf67d2-58c1-4634-9579-07116751db57%40googlegroups.com
> <https://groups.google.com/d/msgid/jenkinsci-dev/98cf67d2-58c1-4634-9579-07116751db57%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>



-- 
Robert Sandell
*Software Engineer*
*CloudBees Inc.*

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-dev/CALzHZS288R00nS%2Bn0EtZ_REqYpOh2sxbA0qXQhvxSiXu1rXvPg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to