Sharing state between pipeline libraries but not between jobs

12 views
Skip to first unread message

Vincent Massol

unread,
Jan 31, 2018, 3:02:56 AM1/31/18
to Jenkins Users
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

Reply all
Reply to author
Forward
0 new messages