Class ConfigurationAsCode

    • Constructor Detail

      • ConfigurationAsCode

        public ConfigurationAsCode()
    • Method Detail

      • getDisplayName

        @CheckForNull
        public String getDisplayName()
      • 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
      • getLastTimeLoaded

        public Date getLastTimeLoaded()
      • 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
      • 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
      • 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
      • 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
      • isSupportedURI

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