On Wed, Mar 14, 2018 at 8:46 AM, Miguelangel Fernandez
<[email protected]> wrote:
> For a plugin I'm working on I've defined my own folder-level property by
> extending AbstractFolderProperty<AbstractFolder<?>>

Fine…

> and AbstractDescribableImpl<FolderProperty>

Not sure what this is for though.

> 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.

Generally speaking, this should be a recursive search up to the root
(`Jenkins`).

> 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.

Sure they do—that is the whole point of using `SimpleBuildWrapper`!
Check *Pipeline Syntax*. If your wrapper defines a `@Symbol`, it will
show up like a step. Otherwise it will appear in an uglier way under
the `wrap`step.

You can also implement the `EnvironmentContributor` extension point if
you wish for environment variable injection to be automatic for all
jobs inside the folder, rather than opt-in using the wrapper. After
all, it would be a bit weird to have the user define a folder property
and then also a build wrapper in each job—why would you not just put
all the configuration into the wrapper to begin with?

-- 
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/CANfRfr1MBX0HZCHm6uqiW5MCHienH13tBMGnDyNaZEh7BZ%2BE%2BA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to