Package io.jenkins.plugins.casc
Class ConfigurationAsCode
java.lang.Object
hudson.model.ManagementLink
io.jenkins.plugins.casc.ConfigurationAsCode
- All Implemented Interfaces:
ExtensionPoint
,Action
,ModelObject
- Author:
- Nicolas De Loof
-
Nested Class Summary
Nested classes/interfaces inherited from class hudson.model.ManagementLink
ManagementLink.Category
Nested classes/interfaces inherited from interface hudson.ExtensionPoint
ExtensionPoint.LegacyInstancesAreScopedToHudson
-
Field Summary
Modifier and TypeFieldDescriptionstatic final String
static final String
static final String
static final String
Fields inherited from class hudson.model.ManagementLink
LIST
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptioncheckWith
(Mapping entries, ConfigurationContext context) checkWith
(YamlSource source) Recursive search for allYAML_FILES_PATTERN
in provided base pathvoid
Main entry point to start configuration process.void
void
configure
(Collection<String> configParameters) void
configureWith
(YamlSource source) void
doApply
(org.kohsuke.stapler.StaplerRequest req, org.kohsuke.stapler.StaplerResponse res) void
doCheck
(org.kohsuke.stapler.StaplerRequest req, org.kohsuke.stapler.StaplerResponse res) doCheckNewSource
(String newSource) void
doExport
(org.kohsuke.stapler.StaplerRequest req, org.kohsuke.stapler.StaplerResponse res) Export live jenkins instance configuration as Yamlvoid
doReference
(org.kohsuke.stapler.StaplerRequest req, org.kohsuke.stapler.StaplerResponse res) void
doReload
(org.kohsuke.stapler.StaplerRequest request, org.kohsuke.stapler.StaplerResponse response) void
doReplace
(org.kohsuke.stapler.StaplerRequest request, org.kohsuke.stapler.StaplerResponse response) void
doSchema
(org.kohsuke.stapler.StaplerRequest req, org.kohsuke.stapler.StaplerResponse res) Export JSONSchema to URLvoid
doViewExport
(org.kohsuke.stapler.StaplerRequest req, org.kohsuke.stapler.StaplerResponse res) void
export
(OutputStream out) static ConfigurationAsCode
get()
Name of the category for this management link.Collection<?>
Used for documentation generation in index.jellyRetrieve which plugin do provide this extension point, used in documentation.jellygetHtmlHelp
(Class type, String attribute) Retrieve the html help tip associated to an attribute, used in documentation.jelly FIXME would prefer <st:include page="help-${a.name}.html" class="${c.target}" optional="true"/>io.jenkins.plugins.prism.PrismConfiguration
Collection<?>
Used for documentation generation in index.jellystatic void
handleExceptionOnReloading
(org.kohsuke.stapler.StaplerRequest request, org.kohsuke.stapler.StaplerResponse response, ConfiguratorException cause) static void
init()
Defaults to use a file in the current working directory with the name 'jenkins.yaml' Add the environment variable CASC_JENKINS_CONFIG to override the default.static boolean
isSupportedURI
(String configurationParameter) static String
static void
serializeYamlNode
(org.yaml.snakeyaml.nodes.Node root, Writer writer) org.yaml.snakeyaml.nodes.Node
Methods inherited from class hudson.model.ManagementLink
all, getBadge, getCategory, getRequiresConfirmation, getRequiresPOST
-
Field Details
-
CASC_JENKINS_CONFIG_PROPERTY
- See Also:
-
CASC_JENKINS_CONFIG_ENV
- See Also:
-
DEFAULT_JENKINS_YAML_PATH
- See Also:
-
YAML_FILES_PATTERN
- See Also:
-
-
Constructor Details
-
ConfigurationAsCode
public ConfigurationAsCode()
-
-
Method Details
-
getIconFileName
- Specified by:
getIconFileName
in interfaceAction
- Specified by:
getIconFileName
in classManagementLink
-
getDisplayName
-
getUrlName
- Specified by:
getUrlName
in interfaceAction
- Specified by:
getUrlName
in classManagementLink
-
getDescription
- Overrides:
getDescription
in classManagementLink
-
getCategoryName
Name of the category for this management link. TODO: Use getCategory when core requirement is greater or equal to 2.226- Overrides:
getCategoryName
in classManagementLink
-
getRequiredPermission
- Overrides:
getRequiredPermission
in classManagementLink
-
getLastTimeLoaded
-
getSources
-
doReload
@Restricted(org.kohsuke.accmod.restrictions.NoExternalUse.class) public void doReload(org.kohsuke.stapler.StaplerRequest request, org.kohsuke.stapler.StaplerResponse response) throws Exception - Throws:
Exception
-
handleExceptionOnReloading
@Restricted(org.kohsuke.accmod.restrictions.NoExternalUse.class) public static void handleExceptionOnReloading(org.kohsuke.stapler.StaplerRequest request, org.kohsuke.stapler.StaplerResponse response, ConfiguratorException cause) throws javax.servlet.ServletException, IOException - Throws:
javax.servlet.ServletException
IOException
-
doReplace
@Restricted(org.kohsuke.accmod.restrictions.NoExternalUse.class) public void doReplace(org.kohsuke.stapler.StaplerRequest request, org.kohsuke.stapler.StaplerResponse response) throws Exception - Throws:
Exception
-
doCheckNewSource
@POST @Restricted(org.kohsuke.accmod.restrictions.NoExternalUse.class) public FormValidation doCheckNewSource(@QueryParameter String newSource) -
init
@Restricted(org.kohsuke.accmod.restrictions.NoExternalUse.class) @Initializer(after=SYSTEM_CONFIG_LOADED, before=SYSTEM_CONFIG_ADAPTED) public static void init() throws ExceptionDefaults to use a file in the current working directory with the name 'jenkins.yaml' Add the environment variable CASC_JENKINS_CONFIG to override the default. Accepts single file or a directory. If a directory is detected, we scan for all .yml and .yaml files- Throws:
Exception
- when the file provided cannot be found or parsed
-
configure
Main entry point to start configuration process.- Throws:
ConfiguratorException
- Configuration error
-
getBundledCasCURIs
-
doCheck
@Restricted(org.kohsuke.accmod.restrictions.NoExternalUse.class) public void doCheck(org.kohsuke.stapler.StaplerRequest req, org.kohsuke.stapler.StaplerResponse res) throws Exception - Throws:
Exception
-
doApply
@Restricted(org.kohsuke.accmod.restrictions.NoExternalUse.class) public void doApply(org.kohsuke.stapler.StaplerRequest req, org.kohsuke.stapler.StaplerResponse res) throws Exception - Throws:
Exception
-
doExport
@Restricted(org.kohsuke.accmod.restrictions.NoExternalUse.class) public void doExport(org.kohsuke.stapler.StaplerRequest req, org.kohsuke.stapler.StaplerResponse res) throws Exception Export live jenkins instance configuration as Yaml- Throws:
Exception
-
doSchema
@Restricted(org.kohsuke.accmod.restrictions.NoExternalUse.class) public void doSchema(org.kohsuke.stapler.StaplerRequest req, org.kohsuke.stapler.StaplerResponse res) throws Exception Export JSONSchema to URL- Throws:
Exception
-
doViewExport
@Restricted(org.kohsuke.accmod.restrictions.NoExternalUse.class) public void doViewExport(org.kohsuke.stapler.StaplerRequest req, org.kohsuke.stapler.StaplerResponse res) throws Exception - Throws:
Exception
-
getPrismConfiguration
@Restricted(org.kohsuke.accmod.restrictions.NoExternalUse.class) public io.jenkins.plugins.prism.PrismConfiguration getPrismConfiguration() -
doReference
@Restricted(org.kohsuke.accmod.restrictions.NoExternalUse.class) public void doReference(org.kohsuke.stapler.StaplerRequest req, org.kohsuke.stapler.StaplerResponse res) throws Exception - Throws:
Exception
-
export
@Restricted(org.kohsuke.accmod.restrictions.NoExternalUse.class) public void export(OutputStream out) throws Exception - Throws:
Exception
-
serializeYamlNode
@Restricted(org.kohsuke.accmod.restrictions.NoExternalUse.class) public static void serializeYamlNode(org.yaml.snakeyaml.nodes.Node root, Writer writer) throws IOException - Throws:
IOException
-
toYaml
@CheckForNull @Restricted(org.kohsuke.accmod.restrictions.NoExternalUse.class) public org.yaml.snakeyaml.nodes.Node toYaml(CNode config) throws ConfiguratorException - Throws:
ConfiguratorException
-
configure
- Throws:
ConfiguratorException
-
configure
- Throws:
ConfiguratorException
-
isSupportedURI
-
configureWith
@Restricted(org.kohsuke.accmod.restrictions.NoExternalUse.class) public void configureWith(YamlSource source) throws ConfiguratorException - Throws:
ConfiguratorException
-
checkWith
@Restricted(org.kohsuke.accmod.restrictions.NoExternalUse.class) public Map<Source,String> checkWith(YamlSource source) throws ConfiguratorException - Throws:
ConfiguratorException
-
configs
@Restricted(org.kohsuke.accmod.restrictions.NoExternalUse.class) public List<Path> configs(String path) throws ConfiguratorException Recursive search for allYAML_FILES_PATTERN
in provided base path- Parameters:
path
- base path to start (can be file or directory)- Returns:
- list of all paths matching pattern. Only base file itself if it is a file matching pattern
- Throws:
ConfiguratorException
-
checkWith
public Map<Source,String> checkWith(Mapping entries, ConfigurationContext context) throws ConfiguratorException - Throws:
ConfiguratorException
-
get
-
getRootConfigurators
Used for documentation generation in index.jelly -
getConfigurators
Used for documentation generation in index.jelly -
getHtmlHelp
@Restricted(org.kohsuke.accmod.restrictions.NoExternalUse.class) @NonNull public String getHtmlHelp(Class type, String attribute) throws IOException Retrieve the html help tip associated to an attribute, used in documentation.jelly FIXME would prefer <st:include page="help-${a.name}.html" class="${c.target}" optional="true"/>- Parameters:
attribute
- to get help for- Returns:
- String that shows help. May be empty
- Throws:
IOException
- if the resource cannot be read
-
getExtensionSource
@Restricted(org.kohsuke.accmod.restrictions.NoExternalUse.class) @CheckForNull public String getExtensionSource(Configurator c) throws IOException Retrieve which plugin do provide this extension point, used in documentation.jelly- Returns:
- String representation of the extension source, usually artifactId.
- Throws:
IOException
-
printThrowable
-