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.CategoryNested classes/interfaces inherited from interface hudson.ExtensionPoint
ExtensionPoint.LegacyInstancesAreScopedToHudson -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Stringstatic final Stringstatic final Stringstatic final StringFields inherited from class hudson.model.ManagementLink
LIST -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncheckWith(Mapping entries, ConfigurationContext context) checkWith(YamlSource source) Recursive search for allYAML_FILES_PATTERNin provided base pathvoidMain entry point to start configuration process.voidvoidconfigure(Collection<String> configParameters) voidconfigureWith(YamlSource source) voiddoApply(org.kohsuke.stapler.StaplerRequest req, org.kohsuke.stapler.StaplerResponse res) voiddoCheck(org.kohsuke.stapler.StaplerRequest req, org.kohsuke.stapler.StaplerResponse res) doCheckNewSource(String newSource) voiddoExport(org.kohsuke.stapler.StaplerRequest req, org.kohsuke.stapler.StaplerResponse res) Export live jenkins instance configuration as YamlvoiddoReference(org.kohsuke.stapler.StaplerRequest req, org.kohsuke.stapler.StaplerResponse res) voiddoReload(org.kohsuke.stapler.StaplerRequest request, org.kohsuke.stapler.StaplerResponse response) voiddoReplace(org.kohsuke.stapler.StaplerRequest request, org.kohsuke.stapler.StaplerResponse response) voiddoSchema(org.kohsuke.stapler.StaplerRequest req, org.kohsuke.stapler.StaplerResponse res) Export JSONSchema to URLvoiddoViewExport(org.kohsuke.stapler.StaplerRequest req, org.kohsuke.stapler.StaplerResponse res) voidexport(OutputStream out) static ConfigurationAsCodeget()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.PrismConfigurationCollection<?>Used for documentation generation in index.jellystatic voidhandleExceptionOnReloading(org.kohsuke.stapler.StaplerRequest request, org.kohsuke.stapler.StaplerResponse response, ConfiguratorException cause) static voidinit()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 booleanisSupportedURI(String configurationParameter) static Stringstatic voidserializeYamlNode(org.yaml.snakeyaml.nodes.Node root, Writer writer) org.yaml.snakeyaml.nodes.NodeMethods 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:
getIconFileNamein interfaceAction- Specified by:
getIconFileNamein classManagementLink
-
getDisplayName
-
getUrlName
- Specified by:
getUrlNamein interfaceAction- Specified by:
getUrlNamein classManagementLink
-
getDescription
- Overrides:
getDescriptionin classManagementLink
-
getCategoryName
Name of the category for this management link. TODO: Use getCategory when core requirement is greater or equal to 2.226- Overrides:
getCategoryNamein classManagementLink
-
getRequiredPermission
- Overrides:
getRequiredPermissionin 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.ServletExceptionIOException
-
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_PATTERNin 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
-