Class ConfigurationAsCode

java.lang.Object
hudson.model.ManagementLink
io.jenkins.plugins.casc.ConfigurationAsCode
All Implemented Interfaces:
ExtensionPoint, Action, ModelObject

@Extension public class ConfigurationAsCode extends ManagementLink
Author:
Nicolas De Loof
  • Field Details

  • Constructor Details

    • ConfigurationAsCode

      public ConfigurationAsCode()
  • Method Details

    • getIconFileName

      @CheckForNull public String getIconFileName()
      Specified by:
      getIconFileName in interface Action
      Specified by:
      getIconFileName in class ManagementLink
    • getDisplayName

      @CheckForNull public String getDisplayName()
    • getUrlName

      @CheckForNull public String getUrlName()
      Specified by:
      getUrlName in interface Action
      Specified by:
      getUrlName in class ManagementLink
    • getDescription

      public String getDescription()
      Overrides:
      getDescription in class ManagementLink
    • getCategoryName

      @NonNull public String 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 class ManagementLink
    • getRequiredPermission

      @NonNull public Permission getRequiredPermission()
      Overrides:
      getRequiredPermission in class ManagementLink
    • getLastTimeLoaded

      public Date getLastTimeLoaded()
    • getSources

      public List<String> 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 Exception
      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. 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

      public void configure() throws ConfiguratorException
      Main entry point to start configuration process.
      Throws:
      ConfiguratorException - Configuration error
    • getBundledCasCURIs

      @Restricted(org.kohsuke.accmod.restrictions.NoExternalUse.class) public List<String> 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

      public void configure(String... configParameters) throws ConfiguratorException
      Throws:
      ConfiguratorException
    • configure

      public void configure(Collection<String> configParameters) throws ConfiguratorException
      Throws:
      ConfiguratorException
    • isSupportedURI

      public static boolean isSupportedURI(String configurationParameter)
    • 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 all YAML_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

      public static ConfigurationAsCode get()
    • getRootConfigurators

      public Collection<?> getRootConfigurators()
      Used for documentation generation in index.jelly
    • getConfigurators

      public Collection<?> 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

      @Restricted(org.kohsuke.accmod.restrictions.NoExternalUse.class) public static String printThrowable(@NonNull Throwable t)