Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-41871

provide a way to create configs via script

    XMLWordPrintable

    Details

    • Type: New Feature
    • Status: Resolved (View Workflow)
    • Priority: Minor
    • Resolution: Fixed
    • Labels:
      None
    • Environment:
      Using all latest versions : 2.15.5.
      Jenkins : 2.32.2
    • Similar Issues:

      Description

      Using all latest versions : 2.15.5.
      Every time visiting Global Config Files: log has exception:

      WARNING: Caught exception evaluating: it.groupedConfigs in /configfiles/index. Reason: java.lang.reflect.InvocationTargetException
      java.lang.reflect.InvocationTargetException
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      ....
      Caused by: java.lang.IllegalStateException: class org.jenkinsci.lib.configprovider.model.Config must override 'getDescriptor()' this method!
      at org.jenkinsci.lib.configprovider.model.Config.getDescriptor(Config.java:108)
      at org.jenkinsci.lib.configprovider.model.Config.getProvider(Config.java:115)
      at org.jenkinsci.plugins.configfiles.GlobalConfigFiles.getGroupedConfigs(GlobalConfigFiles.java:72)
      at org.jenkinsci.plugins.configfiles.ConfigFilesManagement.getGroupedConfigs(ConfigFilesManagement.java:112)
      ... 116 more

      Do not know why but file : org.jenkinsci.plugins.configfiles.GlobalConfigFiles.xml
      for newly created items has

          <org.jenkinsci.plugins.configfiles.custom.CustomConfig>
            <id>5aa81ca6-1ed0-4444-bded-03960d58fc46</id>
            <name>MyCustom</name>
            <comment></comment>
            <content>342342343</content>
            <providerId>org.jenkinsci.plugins.configfiles.custom.CustomConfig</providerId>
          </org.jenkinsci.plugins.configfiles.custom.CustomConfig>
      

      for old

          <org.jenkinsci.lib.configprovider.model.Config>
            <id>id_config_1</id>
            <name>name_1</name>
            <comment>comment_1</comment>
            <content>content_1</content>
            <providerId>org.jenkinsci.plugins.configfiles.custom.CustomConfig</providerId>
          </org.jenkinsci.lib.configprovider.model.Config>
      

        Attachments

          Activity

          Hide
          dshvedchenko Denis Shvedchenko added a comment -

          I 've added my current version of scirpt, that is working with previous version. I hope adding provider.convert(Config) will solve this issue with 2.15

          Show
          dshvedchenko Denis Shvedchenko added a comment - I 've added my current version of scirpt, that is working with previous version. I hope adding provider.convert(Config) will solve this issue with 2.15
          Hide
          dshvedchenko Denis Shvedchenko added a comment -

          hudson.plugins.emailext.GroovyTemplateConfig does not override convert, also convert is deprecated, so I need another solution

          Show
          dshvedchenko Denis Shvedchenko added a comment - hudson.plugins.emailext.GroovyTemplateConfig does not override convert, also convert is deprecated, so I need another solution
          Hide
          imod Dominik Bartholdi added a comment -

          I will provide a solution to create new configs dynamically. Beside this, your last comment is about the best hint I got about an other issue: I did not know that emailext is also using the config-file-provider plugin

          Show
          imod Dominik Bartholdi added a comment - I will provide a solution to create new configs dynamically. Beside this, your last comment is about the best hint I got about an other issue: I did not know that emailext is also using the config-file-provider plugin
          Hide
          dshvedchenko Denis Shvedchenko added a comment - - edited

          if it implement convert, so issue would be solved with assumption in first comment

          Show
          dshvedchenko Denis Shvedchenko added a comment - - edited if it implement convert, so issue would be solved with assumption in first comment
          Hide
          imod Dominik Bartholdi added a comment -

          Denis Shvedchenko could you provide a hudson.plugins.emailext.GroovyTemplateConfig.xml and maybe also hudson.plugins.emailext.JellyTemplateConfig.xml configuration file which was used prior you upgraded to config-file-provider 2.15.*?

          That would make it a lot simpler for me to test the upgrade

          Show
          imod Dominik Bartholdi added a comment - Denis Shvedchenko could you provide a hudson.plugins.emailext.GroovyTemplateConfig.xml and maybe also hudson.plugins.emailext.JellyTemplateConfig.xml configuration file which was used prior you upgraded to config-file-provider 2.15.*? That would make it a lot simpler for me to test the upgrade
          Hide
          scm_issue_link SCM/JIRA link daemon added a comment -

          Code changed in jenkins
          User: imod
          Path:
          src/main/java/org/jenkinsci/lib/configprovider/AbstractConfigProviderImpl.java
          src/main/java/org/jenkinsci/lib/configprovider/ConfigProvider.java
          src/main/java/org/jenkinsci/plugins/configfiles/custom/CustomConfig.java
          src/main/java/org/jenkinsci/plugins/configfiles/groovy/GroovyScript.java
          src/main/java/org/jenkinsci/plugins/configfiles/json/JsonConfig.java
          src/main/java/org/jenkinsci/plugins/configfiles/maven/AbstractMavenSettingsProvider.java
          src/main/java/org/jenkinsci/plugins/configfiles/maven/GlobalMavenSettingsConfig.java
          src/main/java/org/jenkinsci/plugins/configfiles/maven/MavenSettingsConfig.java
          src/main/java/org/jenkinsci/plugins/configfiles/maven/MavenToolchainsConfig.java
          src/main/java/org/jenkinsci/plugins/configfiles/xml/XmlConfig.java
          src/test/java/org/jenkinsci/lib/configprovider/SystemConfigFilesManagementTest.java
          http://jenkins-ci.org/commit/config-file-provider-plugin/110ea60fefa7de9296a0b73d5f7eec8e67479ce1
          Log:
          JENKINS-41871 provide new method to create config objects via configprovider

          Show
          scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: imod Path: src/main/java/org/jenkinsci/lib/configprovider/AbstractConfigProviderImpl.java src/main/java/org/jenkinsci/lib/configprovider/ConfigProvider.java src/main/java/org/jenkinsci/plugins/configfiles/custom/CustomConfig.java src/main/java/org/jenkinsci/plugins/configfiles/groovy/GroovyScript.java src/main/java/org/jenkinsci/plugins/configfiles/json/JsonConfig.java src/main/java/org/jenkinsci/plugins/configfiles/maven/AbstractMavenSettingsProvider.java src/main/java/org/jenkinsci/plugins/configfiles/maven/GlobalMavenSettingsConfig.java src/main/java/org/jenkinsci/plugins/configfiles/maven/MavenSettingsConfig.java src/main/java/org/jenkinsci/plugins/configfiles/maven/MavenToolchainsConfig.java src/main/java/org/jenkinsci/plugins/configfiles/xml/XmlConfig.java src/test/java/org/jenkinsci/lib/configprovider/SystemConfigFilesManagementTest.java http://jenkins-ci.org/commit/config-file-provider-plugin/110ea60fefa7de9296a0b73d5f7eec8e67479ce1 Log: JENKINS-41871 provide new method to create config objects via configprovider
          Hide
          dshvedchenko Denis Shvedchenko added a comment -

          Added requested files

          Show
          dshvedchenko Denis Shvedchenko added a comment - Added requested files
          Hide
          imod Dominik Bartholdi added a comment -

          with version 2.15.6 it is now possible to create a new config file like this:

          provider.newConfig(id, name, comment, content)

          Show
          imod Dominik Bartholdi added a comment - with version 2.15.6 it is now possible to create a new config file like this: provider.newConfig(id, name, comment, content)

            People

            • Assignee:
              domi Dominik Bartholdi
              Reporter:
              dshvedchenko Denis Shvedchenko
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: