I am developing a Jenkins pipeline plugin that provides some custom block 
scoped steps something like this:

withFoo( fooParams ) {
   // Some code block that uses the declared "Foo" thing

My *withFoo* step creates some object "Foo" that is made available in the 
code block to my other custom steps.

I have all this sort of thing working with custom block-scoped steps and 
simple steps and it is going well in my declarative pipelines and providing 
the functionality I need.

However the "foo" is only available in a pipeline code block in a single 
declarative stage and it won't be available in a post handler unless I 
re-declare it ( think).

I am envisioning some scenarios where I want my "Foo" object to be 
available to the whole job in the pipeline context using something like 
"options" (or possibly at the stage options level).

So I am looking at the possibility of some custom option like this:

pipeline {

 agent none

 options {
     // Declare the Foo

 // Rest of pipeline uses the Foo in stages or post sections

To give some context, the "Foo" is some sort of connection to a remote system 
so it could be expensive to keep tearing it down and re-establishing it.

Is there a way to provide custom options like this to have an object is created 
and put in the pipeline context for the whole pipeline and can be consumed by 
my other custom steps?

I had a look at the existing Jenkins extension point documents and around some 
plugins in GitHub but I cannot tell whether these options are generally 
extendable in this way.

Thanks for any suggestions or pointers anyone here may have!


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

Reply via email to