Hi,

For a plugin I'm working on I've defined my own folder-level property by 
extending *AbstractFolderProperty<AbstractFolder<?>>* and  
*AbstractDescribableImpl<FolderProperty>*, but now I'd like make all jobs 
inside the folder inherit this property.

What is the best way to go about this? Here's what I have so far.

I need to be able to do this at least for Freestyle and Pipeline jobs. I 
believe the implementation has to be different for each.
For Freestyle jobs, I've implemented a build wrapper that extends 
*SimpleBuildWrapper* and I'm able to use the *setUp* method to add 
environment variables to the run. I first do *run.getParent()* to get the 
instance of *hudson.model.Job* and then I the property I've defined from 
it's parent folder. I got the idea from the way the Jira plugin does it here 
<https://github.com/jenkinsci/jira-plugin/blob/1a677da9147e35e6827e04828ff10c3b14d2bf86/src/main/java/hudson/plugins/jira/JiraSite.java#L417>
.

The outstanding part of the problem is Pipeline jobs -i.e. jobs of type 
*org.jenkinsci.plugins.workflow.job.WorkflowJob 
*- because apparently build wrappers don't apply to this type of job. I 
think the only way to do this is to extend 
*org.jenkinsci.plugins.workflow.cps.GlobalVariable 
*but I've so far been unable to find a way to get a reference to the parent 
folder from method 

*getValue(CpsScript script)*Can anyone point me in the right direction?

Thank you,

-- 
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 jenkinsci-dev+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-dev/c6fb5bb4-7cf1-4100-a080-93e790f0ffc2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to