Class ConfigFileSource
java.lang.Object
com.github.cyanbaz.jenkins.plugins.jsonparameter.JsonSource
com.github.cyanbaz.jenkins.plugins.jsonparameter.ConfigFileSource
- All Implemented Interfaces:
ExtensionPoint, Describable<JsonSource>, Serializable
A
JsonSource implementation that loads JSON content from a Jenkins Config File.
Resolution is hierarchical: Jenkins searches the current folder and its parents, falling back to globally defined configuration files if no folder-local match is found.
This class uses the Config File Provider plugin for resolution and validation.
- Author:
- Caner Yanbaz
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classDescriptor forConfigFileSource, shown as an option in the dropdown selector.Nested classes/interfaces inherited from interface ExtensionPoint
ExtensionPoint.LegacyInstancesAreScopedToHudson -
Constructor Summary
ConstructorsConstructorDescriptionConfigFileSource(String configId) Constructs a newConfigFileSourceinstance. -
Method Summary
Modifier and TypeMethodDescriptionloadJson()Loads the JSON content from the configured Jenkins config file.Methods inherited from class JsonSource
loadOptionsMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface Describable
getDescriptor
-
Constructor Details
-
ConfigFileSource
Constructs a newConfigFileSourceinstance.- Parameters:
configId- the ID of the config file as defined in the Config File Provider plugin
-
-
Method Details
-
getConfigId
-
loadJson
Loads the JSON content from the configured Jenkins config file.The config is resolved hierarchically in the context of the current Jenkins item: nearest folder → parent folders → global.
- Specified by:
loadJsonin classJsonSource- Returns:
- the raw JSON content as a string
- Throws:
IllegalArgumentException- if the config file or Jenkins item is not foundIllegalStateException- if no Jenkins item is available in the current request context
-