Pipeline - how to have a global config that's accessible from every step?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Pipeline - how to have a global config that's accessible from every step?

bbyjenkns
I'm putting together a jenkins global library and am struggling with creating a true global configuration. 

My Jenkinsfiles are pretty flat, and mostly just load the global library, set some build specific configuration values, and then calls a step that contains most of the build logic (calls other steps to run the build/test/install). What I was hoping I could do is have a separate properties file that I can load that contains a bunch of default global configuration values, and have it be accessible from all steps. Per the doc, I'm supposed to be able to create a class to hold this global config, but I have to actually pass this class into each step to make it available, which is really ugly. 

I'm thinking the best approach is to create a config step that reads the file and loads the config, write that config to a file and stash it, then have a utility method that reads the stashed config in any steps that need to access it. Though, I also really don't like this option either. 

Is there a good way in pipeline to make a globally accessible config that I'm missing?

--
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/a3cd3e9b-2e49-4da2-924d-4e75199be73c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Pipeline - how to have a global config that's accessible from every step?

Steffen Elste
Hi,
You might want to have a closer look at the Config File Provider Plugin - plays nicely with Pipelines and allows for various types of configuration files to be configured (globally).
Cheers,

Steffen

--
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/77d82592-d4af-4eb2-ab49-67560820c3c1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Loading...