After reading some more, I think I can simplify my question...

I have a class that extends Cloud and overrides Cloud.canProvision and 
Cloud.provision.
Inside my implementation of canProvision and/or provision I want to access 
some information on the build and the job that triggered the call to 
Cloud.canProvision/provision.
I've tried System.getEnv("JOB_NAME") but got null. 
What is the right way? 

Thanks,
Yoram

On Monday, August 4, 2014 10:15:00 AM UTC+3, [email protected] wrote:
>
> Hello,
>
> I'm writing a Cloud plugin for Jenkins. The plugin manages in-house 
> resource management system and it dynamically build slaves on temporarily 
> leased resources.
> The plugin extends Cloud (ClustersCloud extends Cloud) , Slave, 
> RetentionStrategy etc... and in general, works as fine. It creates and 
> destroys slaves as expected.
>
> Now I want to add some fields to the Job - whether the Job should use the 
> plugin to get slave or not and if so, for how long and other parameters (on 
> top of the standard Labels mechanism).
> I've added the fields to the Job configuration page by extending 
> JobProperty (ClustersJobProperty extends JobProperty) + some Jelly 
> configuration.
>
>
> <https://lh3.googleusercontent.com/-WuPyWr0I-rU/U98u_4XADhI/AAAAAAAAAAM/NOwlMikYejw/s1600/Untitled.jpg>
> My question is - where and how should I use these fields?
> First I want to access the check-box 'ClustersJobProperty.useCute' and 
> test whether I should call my Cloud to provision a slave or not at all. 
> Should I do it inside ClustersCloud.canProvision?
> Or should I extend some other class and make sure to verify it even before 
> it gets to the canProvision?
> In any case how to I access the ClustersJobProperty object of the job 
> inside ClustersCloud.provision to get the additional info I need to 
> complete the provision? How do I get the the current job that triggered the 
> call to provision?
>
> Any advise?
>
> Thanks,
> Yoram
>

-- 
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].
For more options, visit https://groups.google.com/d/optout.

Reply via email to