How to re-use groovy script in Jenkins Groovy Post Build plugin? -
i have groovy code planning re-use in jenkins groovy post build plugin of multiple jobs. how can achieve this? there place can store script in global variable , call in jobs ever need?
you can load groovy file living on jenkins master within groovy postbuild , execute it. example, have special directory on c drive common scripts live. i'll update answer later code shows how load script in.
update
assuming have test.groovy file on c: drive, should simple following in groovy postbuild:
evaluate(new file("c:\\test.groovy"))
please view comment section of groovy postbuild more examples , possibly other ways.
Comments
Post a Comment