I work on a somewhat complicated build process using Jenkins scripted pipeline, where the Jenkinsfile is very small, but it imports a large shared library, sets some application-specific properties, and then calls a top-level function in the "vars" section of the shared library.
The top-level function is pretty complicated, and it calls a bunch of other "var" functions. Data is passed to those functions through "env." vars, and function parameters. I am working on some changes to one of the lower-level functions, where it will reference a couple of "statically-defined" map objects that specify some metadata about build steps. Initially, I simply defined those maps inside the "call()" function in the "vars" file. That does work. However, I see that there is more than one "vars" file that needs to reference those maps. It would make sense if I could move these map definitions to the top-level "vars" file, I assume right inside the "call()" function (or somewhere else, if that makes sense) and then reference them inside the "vars" functions that need that data. If these were scalar values, I would just set "env.<variablename> = <value>" in the top-level "vars" file, inside the "call()" function, and then reference that environment variable in the lower-level "vars" file. Can I set a Map object into environment variables? I wouldn't think it would allow that. I technically could simply reference the variable name in the top-level "vars" function, and pass it down through the layers, but that gets messy. I'd prefer to reference these maps like "static" variables (conceptually if not in actuality) in the lower-level "vars" file. I have browsed the documentation, but I haven't seen an obvious way to do this. -- 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 jenkinsci-users+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/181c2122-ddad-4f88-9f01-018cc89f64b6n%40googlegroups.com.