Sharing state between pipeline libraries but not between jobs

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Sharing state between pipeline libraries but not between jobs

Vincent Massol
Hi guys,

I need to share some global state (Java objects) between 2 pipeline libraries.

vars/lib1.groovy:

def call(body)
{
 
// set some global state here


  body
()
}

vars/lib2.groovy:

def call()
{
 
// retrieve the global state here
}

And the Jenkinsfile:

lib1() {
  lib2
()
}


Initially I thought about using "env" but it supports only String and I need to store a List<TestResult>.

Important: the global state needs to scoped to the job (i.e. another job using lib1() and lib2() shouldn't see the state value set).

Any idea?
Thanks a Lot

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/90dfc783-9f90-420a-b051-c8cb15fb4943%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.