Class ConfigFileSource
java.lang.Object
hudson.model.AbstractDescribableImpl<JsonSource>
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 class
Descriptor forConfigFileSource
, shown as an option in the dropdown selector.Nested classes/interfaces inherited from interface hudson.ExtensionPoint
ExtensionPoint.LegacyInstancesAreScopedToHudson
-
Constructor Summary
ConstructorsConstructorDescriptionConfigFileSource
(String configId) Constructs a newConfigFileSource
instance. -
Method Summary
Modifier and TypeMethodDescriptionloadJson()
Loads the JSON content from the configured Jenkins config file.Methods inherited from class com.github.cyanbaz.jenkins.plugins.jsonparameter.JsonSource
loadOptions
Methods inherited from class hudson.model.AbstractDescribableImpl
getDescriptor
-
Constructor Details
-
ConfigFileSource
Constructs a newConfigFileSource
instance.- 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:
loadJson
in 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
-