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

JCasC: Branch discovery traits failure in config roundtrips (strategyId)

    Details

    • Similar Issues:

      Description

      When I export a configuration to JCasC, e.g. for a Pipeline library with GitHub source, I get the following sample:

       
      globalLibraries:
        libraries:
          - defaultVersion: "master"
            name: "jenkins-pipeline-lib"
            retriever:
               modernSCM:
                 scm:
                   github:
                     id: "e43d6600-ba0e-46c5-8eae-3989bf654055"
                     repoOwner: "jenkins-infra"
                     repository: "pipeline-library"
                     traits:
                       - branchDiscoveryTrait:
                           strategyId: 1
                       - originPullRequestDiscoveryTrait:
                            strategyId: 1
                       - forkPullRequestDiscoveryTrait:
                             strategyId: 1
                             trust: "trustPermission"

       

       When the same configuration is imported, I get 

      SEVERE: Failed ConfigurationAsCode.init java.lang.Error: java.lang.reflect.InvocationTargetException at hudson.init.TaskMethodFinder.invoke(TaskMethodFinder.java:110) at hudson.init.TaskMethodFinder$TaskImpl.run(TaskMethodFinder.java:175) at org.jvnet.hudson.reactor.Reactor.runTask(Reactor.java:296) at jenkins.model.Jenkins$5.runTask(Jenkins.java:1096) at org.jvnet.hudson.reactor.Reactor$2.run(Reactor.java:214) at org.jvnet.hudson.reactor.Reactor$Node.run(Reactor.java:117) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) at java.lang.Thread.run(Thread.java:748) Caused by: java.lang.reflect.InvocationTargetException at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at hudson.init.TaskMethodFinder.invoke(TaskMethodFinder.java:104) ... 8 more Caused by: io.jenkins.plugins.casc.ConfiguratorException: unclassified: error configuring 'unclassified' with class io.jenkins.plugins.casc.impl.configurators.GlobalConfigurationCategoryConfigurator configurator at io.jenkins.plugins.casc.ConfigurationAsCode.invokeWith(ConfigurationAsCode.java:633) at io.jenkins.plugins.casc.ConfigurationAsCode.checkWith(ConfigurationAsCode.java:665) at io.jenkins.plugins.casc.ConfigurationAsCode.configureWith(ConfigurationAsCode.java:649) at io.jenkins.plugins.casc.ConfigurationAsCode.configureWith(ConfigurationAsCode.java:548) at io.jenkins.plugins.casc.ConfigurationAsCode.configure(ConfigurationAsCode.java:277) at io.jenkins.plugins.casc.ConfigurationAsCode.init(ConfigurationAsCode.java:269) ... 13 more 
      
      Caused by: io.jenkins.plugins.casc.ConfiguratorException: Invalid configuration elements for type class jenkins.plugins.git.traits.BranchDiscoveryTrait : strategyId. Available attributes : at io.jenkins.plugins.casc.BaseConfigurator.handleUnknown(BaseConfigurator.java:372) at io.jenkins.plugins.casc.BaseConfigurator.configure(BaseConfigurator.java:361) at io.jenkins.plugins.casc.BaseConfigurator.configure(BaseConfigurator.java:271) at io.jenkins.plugins.casc.impl.configurators.DataBoundConfigurator.configure(DataBoundConfigurator.java:79) at io.jenkins.plugins.casc.impl.configurators.HeteroDescribableConfigurator.lambda$doConfigure$16668e2$1(HeteroDescribableConfigurator.java:228) at io.vavr.CheckedFunction0.lambda$unchecked$52349c75$1(CheckedFunction0.java:201) at io.jenkins.plugins.casc.impl.configurators.HeteroDescribableConfigurator.doConfigure(HeteroDescribableConfigurator.java:228) at io.jenkins.plugins.casc.impl.configurators.HeteroDescribableConfigurator.lambda$null$2(HeteroDescribableConfigurator.java:82) at io.vavr.control.Option.map(Option.java:373) at io.jenkins.plugins.casc.impl.configurators.HeteroDescribableConfigurator.lambda$configure$3(HeteroDescribableConfigurator.java:82) at io.vavr.Tuple2.apply(Tuple2.java:239) at io.jenkins.plugins.casc.impl.configurators.HeteroDescribableConfigurator.configure(HeteroDescribableConfigurator.java:79) at io.jenkins.plugins.casc.impl.configurators.HeteroDescribableConfigurator.configure(HeteroDescribableConfigurator.java:51) at io.jenkins.plugins.casc.BaseConfigurator.configure(BaseConfigurator.java:340) at io.jenkins.plugins.casc.BaseConfigurator.configure(BaseConfigurator.java:271) at io.jenkins.plugins.casc.impl.configurators.DataBoundConfigurator.configure(DataBoundConfigurator.java:79) at io.jenkins.plugins.casc.impl.configurators.HeteroDescribableConfigurator.lambda$doConfigure$16668e2$1(HeteroDescribableConfigurator.java:228) at io.vavr.CheckedFunction0.lambda$unchecked$52349c75$1(CheckedFunction0.java:201) at io.jenkins.plugins.casc.impl.configurators.HeteroDescribableConfigurator.doConfigure(HeteroDescribableConfigurator.java:228) at io.jenkins.plugins.casc.impl.configurators.HeteroDescribableConfigurator.lambda$null$2(HeteroDescribableConfigurator.java:82) at io.vavr.control.Option.map(Option.java:373) at io.jenkins.plugins.casc.impl.configurators.HeteroDescribableConfigurator.lambda$configure$3(HeteroDescribableConfigurator.java:82) at io.vavr.Tuple2.apply(Tuple2.java:239) at io.jenkins.plugins.casc.impl.configurators.HeteroDescribableConfigurator.configure(HeteroDescribableConfigurator.java:79) at io.jenkins.plugins.casc.impl.configurators.HeteroDescribableConfigurator.configure(HeteroDescribableConfigurator.java:51) at io.jenkins.plugins.casc.impl.configurators.DataBoundConfigurator.tryConstructor(DataBoundConfigurator.java:130) at io.jenkins.plugins.casc.impl.configurators.DataBoundConfigurator.instance(DataBoundConfigurator.java:73) at io.jenkins.plugins.casc.BaseConfigurator.configure(BaseConfigurator.java:262) at io.jenkins.plugins.casc.impl.configurators.DataBoundConfigurator.configure(DataBoundConfigurator.java:79) at io.jenkins.plugins.casc.impl.configurators.HeteroDescribableConfigurator.lambda$doConfigure$16668e2$1(HeteroDescribableConfigurator.java:228) at io.vavr.CheckedFunction0.lambda$unchecked$52349c75$1(CheckedFunction0.java:201) at io.jenkins.plugins.casc.impl.configurators.HeteroDescribableConfigurator.doConfigure(HeteroDescribableConfigurator.java:228) at io.jenkins.plugins.casc.impl.configurators.HeteroDescribableConfigurator.lambda$null$2(HeteroDescribableConfigurator.java:82) at io.vavr.control.Option.map(Option.java:373) at io.jenkins.plugins.casc.impl.configurators.HeteroDescribableConfigurator.lambda$configure$3(HeteroDescribableConfigurator.java:82) at io.vavr.Tuple2.apply(Tuple2.java:239) at io.jenkins.plugins.casc.impl.configurators.HeteroDescribableConfigurator.configure(HeteroDescribableConfigurator.java:79) at io.jenkins.plugins.casc.impl.configurators.HeteroDescribableConfigurator.configure(HeteroDescribableConfigurator.java:51) at io.jenkins.plugins.casc.impl.configurators.DataBoundConfigurator.tryConstructor(DataBoundConfigurator.java:130) at io.jenkins.plugins.casc.impl.configurators.DataBoundConfigurator.instance(DataBoundConfigurator.java:73) at io.jenkins.plugins.casc.BaseConfigurator.configure(BaseConfigurator.java:262) at io.jenkins.plugins.casc.impl.configurators.DataBoundConfigurator.check(DataBoundConfigurator.java:97) at io.jenkins.plugins.casc.BaseConfigurator.configure(BaseConfigurator.java:339) at io.jenkins.plugins.casc.BaseConfigurator.check(BaseConfigurator.java:282) at io.jenkins.plugins.casc.BaseConfigurator.configure(BaseConfigurator.java:347) at io.jenkins.plugins.casc.BaseConfigurator.check(BaseConfigurator.java:282) at io.jenkins.plugins.casc.ConfigurationAsCode.lambda$checkWith$6(ConfigurationAsCode.java:665) at io.jenkins.plugins.casc.ConfigurationAsCode.invokeWith(ConfigurationAsCode.java:627) ... 18 more
      

       

        Attachments

          Activity

          oleg_nenashev Oleg Nenashev created issue -
          oleg_nenashev Oleg Nenashev made changes -
          Field Original Value New Value
          Description When I export a configuration to JCasC, e.g. for a Pipeline library with GitHub source, I get the following sample:

           

           When the same configuration is imported, I get

           
          {code:java}
          SEVERE: Failed ConfigurationAsCode.init java.lang.Error: java.lang.reflect.InvocationTargetException at hudson.init.TaskMethodFinder.invoke(TaskMethodFinder.java:110) at hudson.init.TaskMethodFinder$TaskImpl.run(TaskMethodFinder.java:175) at org.jvnet.hudson.reactor.Reactor.runTask(Reactor.java:296) at jenkins.model.Jenkins$5.runTask(Jenkins.java:1096) at org.jvnet.hudson.reactor.Reactor$2.run(Reactor.java:214) at org.jvnet.hudson.reactor.Reactor$Node.run(Reactor.java:117) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) at java.lang.Thread.run(Thread.java:748) Caused by: java.lang.reflect.InvocationTargetException at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at hudson.init.TaskMethodFinder.invoke(TaskMethodFinder.java:104) ... 8 more Caused by: io.jenkins.plugins.casc.ConfiguratorException: unclassified: error configuring 'unclassified' with class io.jenkins.plugins.casc.impl.configurators.GlobalConfigurationCategoryConfigurator configurator at io.jenkins.plugins.casc.ConfigurationAsCode.invokeWith(ConfigurationAsCode.java:633) at io.jenkins.plugins.casc.ConfigurationAsCode.checkWith(ConfigurationAsCode.java:665) at io.jenkins.plugins.casc.ConfigurationAsCode.configureWith(ConfigurationAsCode.java:649) at io.jenkins.plugins.casc.ConfigurationAsCode.configureWith(ConfigurationAsCode.java:548) at io.jenkins.plugins.casc.ConfigurationAsCode.configure(ConfigurationAsCode.java:277) at io.jenkins.plugins.casc.ConfigurationAsCode.init(ConfigurationAsCode.java:269) ... 13 more Caused by: io.jenkins.plugins.casc.ConfiguratorException: Invalid configuration elements for type class jenkins.plugins.git.traits.BranchDiscoveryTrait : strategyId. Available attributes : at io.jenkins.plugins.casc.BaseConfigurator.handleUnknown(BaseConfigurator.java:372) at io.jenkins.plugins.casc.BaseConfigurator.configure(BaseConfigurator.java:361) at io.jenkins.plugins.casc.BaseConfigurator.configure(BaseConfigurator.java:271) at io.jenkins.plugins.casc.impl.configurators.DataBoundConfigurator.configure(DataBoundConfigurator.java:79) at io.jenkins.plugins.casc.impl.configurators.HeteroDescribableConfigurator.lambda$doConfigure$16668e2$1(HeteroDescribableConfigurator.java:228) at io.vavr.CheckedFunction0.lambda$unchecked$52349c75$1(CheckedFunction0.java:201) at io.jenkins.plugins.casc.impl.configurators.HeteroDescribableConfigurator.doConfigure(HeteroDescribableConfigurator.java:228) at io.jenkins.plugins.casc.impl.configurators.HeteroDescribableConfigurator.lambda$null$2(HeteroDescribableConfigurator.java:82) at io.vavr.control.Option.map(Option.java:373) at io.jenkins.plugins.casc.impl.configurators.HeteroDescribableConfigurator.lambda$configure$3(HeteroDescribableConfigurator.java:82) at io.vavr.Tuple2.apply(Tuple2.java:239) at io.jenkins.plugins.casc.impl.configurators.HeteroDescribableConfigurator.configure(HeteroDescribableConfigurator.java:79) at io.jenkins.plugins.casc.impl.configurators.HeteroDescribableConfigurator.configure(HeteroDescribableConfigurator.java:51) at io.jenkins.plugins.casc.BaseConfigurator.configure(BaseConfigurator.java:340) at io.jenkins.plugins.casc.BaseConfigurator.configure(BaseConfigurator.java:271) at io.jenkins.plugins.casc.impl.configurators.DataBoundConfigurator.configure(DataBoundConfigurator.java:79) at io.jenkins.plugins.casc.impl.configurators.HeteroDescribableConfigurator.lambda$doConfigure$16668e2$1(HeteroDescribableConfigurator.java:228) at io.vavr.CheckedFunction0.lambda$unchecked$52349c75$1(CheckedFunction0.java:201) at io.jenkins.plugins.casc.impl.configurators.HeteroDescribableConfigurator.doConfigure(HeteroDescribableConfigurator.java:228) at io.jenkins.plugins.casc.impl.configurators.HeteroDescribableConfigurator.lambda$null$2(HeteroDescribableConfigurator.java:82) at io.vavr.control.Option.map(Option.java:373) at io.jenkins.plugins.casc.impl.configurators.HeteroDescribableConfigurator.lambda$configure$3(HeteroDescribableConfigurator.java:82) at io.vavr.Tuple2.apply(Tuple2.java:239) at io.jenkins.plugins.casc.impl.configurators.HeteroDescribableConfigurator.configure(HeteroDescribableConfigurator.java:79) at io.jenkins.plugins.casc.impl.configurators.HeteroDescribableConfigurator.configure(HeteroDescribableConfigurator.java:51) at io.jenkins.plugins.casc.impl.configurators.DataBoundConfigurator.tryConstructor(DataBoundConfigurator.java:130) at io.jenkins.plugins.casc.impl.configurators.DataBoundConfigurator.instance(DataBoundConfigurator.java:73) at io.jenkins.plugins.casc.BaseConfigurator.configure(BaseConfigurator.java:262) at io.jenkins.plugins.casc.impl.configurators.DataBoundConfigurator.configure(DataBoundConfigurator.java:79) at io.jenkins.plugins.casc.impl.configurators.HeteroDescribableConfigurator.lambda$doConfigure$16668e2$1(HeteroDescribableConfigurator.java:228) at io.vavr.CheckedFunction0.lambda$unchecked$52349c75$1(CheckedFunction0.java:201) at io.jenkins.plugins.casc.impl.configurators.HeteroDescribableConfigurator.doConfigure(HeteroDescribableConfigurator.java:228) at io.jenkins.plugins.casc.impl.configurators.HeteroDescribableConfigurator.lambda$null$2(HeteroDescribableConfigurator.java:82) at io.vavr.control.Option.map(Option.java:373) at io.jenkins.plugins.casc.impl.configurators.HeteroDescribableConfigurator.lambda$configure$3(HeteroDescribableConfigurator.java:82) at io.vavr.Tuple2.apply(Tuple2.java:239) at io.jenkins.plugins.casc.impl.configurators.HeteroDescribableConfigurator.configure(HeteroDescribableConfigurator.java:79) at io.jenkins.plugins.casc.impl.configurators.HeteroDescribableConfigurator.configure(HeteroDescribableConfigurator.java:51) at io.jenkins.plugins.casc.impl.configurators.DataBoundConfigurator.tryConstructor(DataBoundConfigurator.java:130) at io.jenkins.plugins.casc.impl.configurators.DataBoundConfigurator.instance(DataBoundConfigurator.java:73) at io.jenkins.plugins.casc.BaseConfigurator.configure(BaseConfigurator.java:262) at io.jenkins.plugins.casc.impl.configurators.DataBoundConfigurator.check(DataBoundConfigurator.java:97) at io.jenkins.plugins.casc.BaseConfigurator.configure(BaseConfigurator.java:339) at io.jenkins.plugins.casc.BaseConfigurator.check(BaseConfigurator.java:282) at io.jenkins.plugins.casc.BaseConfigurator.configure(BaseConfigurator.java:347) at io.jenkins.plugins.casc.BaseConfigurator.check(BaseConfigurator.java:282) at io.jenkins.plugins.casc.ConfigurationAsCode.lambda$checkWith$6(ConfigurationAsCode.java:665) at io.jenkins.plugins.casc.ConfigurationAsCode.invokeWith(ConfigurationAsCode.java:627) ... 18 more
          {code}
           
          When I export a configuration to JCasC, e.g. for a Pipeline library with GitHub source, I get the following sample:

           
          globalLibraries:
            libraries:
              - defaultVersion: "master"
                name: "jenkins-pipeline-lib"
                retriever:
                   modernSCM:
                     scm:
                       github:
                         id: "e43d6600-ba0e-46c5-8eae-3989bf654055"
                         repoOwner: "jenkins-infra"
                         repository: "pipeline-library"
                         traits:
                           - branchDiscoveryTrait:
                               strategyId: 1
                           - originPullRequestDiscoveryTrait:
                                strategyId: 1
                           - forkPullRequestDiscoveryTrait:
                                 strategyId: 1
                                 trust: "trustPermission"
           When the same configuration is imported, I get

           
          {code:java}
          SEVERE: Failed ConfigurationAsCode.init java.lang.Error: java.lang.reflect.InvocationTargetException at hudson.init.TaskMethodFinder.invoke(TaskMethodFinder.java:110) at hudson.init.TaskMethodFinder$TaskImpl.run(TaskMethodFinder.java:175) at org.jvnet.hudson.reactor.Reactor.runTask(Reactor.java:296) at jenkins.model.Jenkins$5.runTask(Jenkins.java:1096) at org.jvnet.hudson.reactor.Reactor$2.run(Reactor.java:214) at org.jvnet.hudson.reactor.Reactor$Node.run(Reactor.java:117) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) at java.lang.Thread.run(Thread.java:748) Caused by: java.lang.reflect.InvocationTargetException at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at hudson.init.TaskMethodFinder.invoke(TaskMethodFinder.java:104) ... 8 more Caused by: io.jenkins.plugins.casc.ConfiguratorException: unclassified: error configuring 'unclassified' with class io.jenkins.plugins.casc.impl.configurators.GlobalConfigurationCategoryConfigurator configurator at io.jenkins.plugins.casc.ConfigurationAsCode.invokeWith(ConfigurationAsCode.java:633) at io.jenkins.plugins.casc.ConfigurationAsCode.checkWith(ConfigurationAsCode.java:665) at io.jenkins.plugins.casc.ConfigurationAsCode.configureWith(ConfigurationAsCode.java:649) at io.jenkins.plugins.casc.ConfigurationAsCode.configureWith(ConfigurationAsCode.java:548) at io.jenkins.plugins.casc.ConfigurationAsCode.configure(ConfigurationAsCode.java:277) at io.jenkins.plugins.casc.ConfigurationAsCode.init(ConfigurationAsCode.java:269) ... 13 more Caused by: io.jenkins.plugins.casc.ConfiguratorException: Invalid configuration elements for type class jenkins.plugins.git.traits.BranchDiscoveryTrait : strategyId. Available attributes : at io.jenkins.plugins.casc.BaseConfigurator.handleUnknown(BaseConfigurator.java:372) at io.jenkins.plugins.casc.BaseConfigurator.configure(BaseConfigurator.java:361) at io.jenkins.plugins.casc.BaseConfigurator.configure(BaseConfigurator.java:271) at io.jenkins.plugins.casc.impl.configurators.DataBoundConfigurator.configure(DataBoundConfigurator.java:79) at io.jenkins.plugins.casc.impl.configurators.HeteroDescribableConfigurator.lambda$doConfigure$16668e2$1(HeteroDescribableConfigurator.java:228) at io.vavr.CheckedFunction0.lambda$unchecked$52349c75$1(CheckedFunction0.java:201) at io.jenkins.plugins.casc.impl.configurators.HeteroDescribableConfigurator.doConfigure(HeteroDescribableConfigurator.java:228) at io.jenkins.plugins.casc.impl.configurators.HeteroDescribableConfigurator.lambda$null$2(HeteroDescribableConfigurator.java:82) at io.vavr.control.Option.map(Option.java:373) at io.jenkins.plugins.casc.impl.configurators.HeteroDescribableConfigurator.lambda$configure$3(HeteroDescribableConfigurator.java:82) at io.vavr.Tuple2.apply(Tuple2.java:239) at io.jenkins.plugins.casc.impl.configurators.HeteroDescribableConfigurator.configure(HeteroDescribableConfigurator.java:79) at io.jenkins.plugins.casc.impl.configurators.HeteroDescribableConfigurator.configure(HeteroDescribableConfigurator.java:51) at io.jenkins.plugins.casc.BaseConfigurator.configure(BaseConfigurator.java:340) at io.jenkins.plugins.casc.BaseConfigurator.configure(BaseConfigurator.java:271) at io.jenkins.plugins.casc.impl.configurators.DataBoundConfigurator.configure(DataBoundConfigurator.java:79) at io.jenkins.plugins.casc.impl.configurators.HeteroDescribableConfigurator.lambda$doConfigure$16668e2$1(HeteroDescribableConfigurator.java:228) at io.vavr.CheckedFunction0.lambda$unchecked$52349c75$1(CheckedFunction0.java:201) at io.jenkins.plugins.casc.impl.configurators.HeteroDescribableConfigurator.doConfigure(HeteroDescribableConfigurator.java:228) at io.jenkins.plugins.casc.impl.configurators.HeteroDescribableConfigurator.lambda$null$2(HeteroDescribableConfigurator.java:82) at io.vavr.control.Option.map(Option.java:373) at io.jenkins.plugins.casc.impl.configurators.HeteroDescribableConfigurator.lambda$configure$3(HeteroDescribableConfigurator.java:82) at io.vavr.Tuple2.apply(Tuple2.java:239) at io.jenkins.plugins.casc.impl.configurators.HeteroDescribableConfigurator.configure(HeteroDescribableConfigurator.java:79) at io.jenkins.plugins.casc.impl.configurators.HeteroDescribableConfigurator.configure(HeteroDescribableConfigurator.java:51) at io.jenkins.plugins.casc.impl.configurators.DataBoundConfigurator.tryConstructor(DataBoundConfigurator.java:130) at io.jenkins.plugins.casc.impl.configurators.DataBoundConfigurator.instance(DataBoundConfigurator.java:73) at io.jenkins.plugins.casc.BaseConfigurator.configure(BaseConfigurator.java:262) at io.jenkins.plugins.casc.impl.configurators.DataBoundConfigurator.configure(DataBoundConfigurator.java:79) at io.jenkins.plugins.casc.impl.configurators.HeteroDescribableConfigurator.lambda$doConfigure$16668e2$1(HeteroDescribableConfigurator.java:228) at io.vavr.CheckedFunction0.lambda$unchecked$52349c75$1(CheckedFunction0.java:201) at io.jenkins.plugins.casc.impl.configurators.HeteroDescribableConfigurator.doConfigure(HeteroDescribableConfigurator.java:228) at io.jenkins.plugins.casc.impl.configurators.HeteroDescribableConfigurator.lambda$null$2(HeteroDescribableConfigurator.java:82) at io.vavr.control.Option.map(Option.java:373) at io.jenkins.plugins.casc.impl.configurators.HeteroDescribableConfigurator.lambda$configure$3(HeteroDescribableConfigurator.java:82) at io.vavr.Tuple2.apply(Tuple2.java:239) at io.jenkins.plugins.casc.impl.configurators.HeteroDescribableConfigurator.configure(HeteroDescribableConfigurator.java:79) at io.jenkins.plugins.casc.impl.configurators.HeteroDescribableConfigurator.configure(HeteroDescribableConfigurator.java:51) at io.jenkins.plugins.casc.impl.configurators.DataBoundConfigurator.tryConstructor(DataBoundConfigurator.java:130) at io.jenkins.plugins.casc.impl.configurators.DataBoundConfigurator.instance(DataBoundConfigurator.java:73) at io.jenkins.plugins.casc.BaseConfigurator.configure(BaseConfigurator.java:262) at io.jenkins.plugins.casc.impl.configurators.DataBoundConfigurator.check(DataBoundConfigurator.java:97) at io.jenkins.plugins.casc.BaseConfigurator.configure(BaseConfigurator.java:339) at io.jenkins.plugins.casc.BaseConfigurator.check(BaseConfigurator.java:282) at io.jenkins.plugins.casc.BaseConfigurator.configure(BaseConfigurator.java:347) at io.jenkins.plugins.casc.BaseConfigurator.check(BaseConfigurator.java:282) at io.jenkins.plugins.casc.ConfigurationAsCode.lambda$checkWith$6(ConfigurationAsCode.java:665) at io.jenkins.plugins.casc.ConfigurationAsCode.invokeWith(ConfigurationAsCode.java:627) ... 18 more
          {code}
           
          oleg_nenashev Oleg Nenashev made changes -
          Description When I export a configuration to JCasC, e.g. for a Pipeline library with GitHub source, I get the following sample:

           
          globalLibraries:
            libraries:
              - defaultVersion: "master"
                name: "jenkins-pipeline-lib"
                retriever:
                   modernSCM:
                     scm:
                       github:
                         id: "e43d6600-ba0e-46c5-8eae-3989bf654055"
                         repoOwner: "jenkins-infra"
                         repository: "pipeline-library"
                         traits:
                           - branchDiscoveryTrait:
                               strategyId: 1
                           - originPullRequestDiscoveryTrait:
                                strategyId: 1
                           - forkPullRequestDiscoveryTrait:
                                 strategyId: 1
                                 trust: "trustPermission"
           When the same configuration is imported, I get

           
          {code:java}
          SEVERE: Failed ConfigurationAsCode.init java.lang.Error: java.lang.reflect.InvocationTargetException at hudson.init.TaskMethodFinder.invoke(TaskMethodFinder.java:110) at hudson.init.TaskMethodFinder$TaskImpl.run(TaskMethodFinder.java:175) at org.jvnet.hudson.reactor.Reactor.runTask(Reactor.java:296) at jenkins.model.Jenkins$5.runTask(Jenkins.java:1096) at org.jvnet.hudson.reactor.Reactor$2.run(Reactor.java:214) at org.jvnet.hudson.reactor.Reactor$Node.run(Reactor.java:117) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) at java.lang.Thread.run(Thread.java:748) Caused by: java.lang.reflect.InvocationTargetException at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at hudson.init.TaskMethodFinder.invoke(TaskMethodFinder.java:104) ... 8 more Caused by: io.jenkins.plugins.casc.ConfiguratorException: unclassified: error configuring 'unclassified' with class io.jenkins.plugins.casc.impl.configurators.GlobalConfigurationCategoryConfigurator configurator at io.jenkins.plugins.casc.ConfigurationAsCode.invokeWith(ConfigurationAsCode.java:633) at io.jenkins.plugins.casc.ConfigurationAsCode.checkWith(ConfigurationAsCode.java:665) at io.jenkins.plugins.casc.ConfigurationAsCode.configureWith(ConfigurationAsCode.java:649) at io.jenkins.plugins.casc.ConfigurationAsCode.configureWith(ConfigurationAsCode.java:548) at io.jenkins.plugins.casc.ConfigurationAsCode.configure(ConfigurationAsCode.java:277) at io.jenkins.plugins.casc.ConfigurationAsCode.init(ConfigurationAsCode.java:269) ... 13 more Caused by: io.jenkins.plugins.casc.ConfiguratorException: Invalid configuration elements for type class jenkins.plugins.git.traits.BranchDiscoveryTrait : strategyId. Available attributes : at io.jenkins.plugins.casc.BaseConfigurator.handleUnknown(BaseConfigurator.java:372) at io.jenkins.plugins.casc.BaseConfigurator.configure(BaseConfigurator.java:361) at io.jenkins.plugins.casc.BaseConfigurator.configure(BaseConfigurator.java:271) at io.jenkins.plugins.casc.impl.configurators.DataBoundConfigurator.configure(DataBoundConfigurator.java:79) at io.jenkins.plugins.casc.impl.configurators.HeteroDescribableConfigurator.lambda$doConfigure$16668e2$1(HeteroDescribableConfigurator.java:228) at io.vavr.CheckedFunction0.lambda$unchecked$52349c75$1(CheckedFunction0.java:201) at io.jenkins.plugins.casc.impl.configurators.HeteroDescribableConfigurator.doConfigure(HeteroDescribableConfigurator.java:228) at io.jenkins.plugins.casc.impl.configurators.HeteroDescribableConfigurator.lambda$null$2(HeteroDescribableConfigurator.java:82) at io.vavr.control.Option.map(Option.java:373) at io.jenkins.plugins.casc.impl.configurators.HeteroDescribableConfigurator.lambda$configure$3(HeteroDescribableConfigurator.java:82) at io.vavr.Tuple2.apply(Tuple2.java:239) at io.jenkins.plugins.casc.impl.configurators.HeteroDescribableConfigurator.configure(HeteroDescribableConfigurator.java:79) at io.jenkins.plugins.casc.impl.configurators.HeteroDescribableConfigurator.configure(HeteroDescribableConfigurator.java:51) at io.jenkins.plugins.casc.BaseConfigurator.configure(BaseConfigurator.java:340) at io.jenkins.plugins.casc.BaseConfigurator.configure(BaseConfigurator.java:271) at io.jenkins.plugins.casc.impl.configurators.DataBoundConfigurator.configure(DataBoundConfigurator.java:79) at io.jenkins.plugins.casc.impl.configurators.HeteroDescribableConfigurator.lambda$doConfigure$16668e2$1(HeteroDescribableConfigurator.java:228) at io.vavr.CheckedFunction0.lambda$unchecked$52349c75$1(CheckedFunction0.java:201) at io.jenkins.plugins.casc.impl.configurators.HeteroDescribableConfigurator.doConfigure(HeteroDescribableConfigurator.java:228) at io.jenkins.plugins.casc.impl.configurators.HeteroDescribableConfigurator.lambda$null$2(HeteroDescribableConfigurator.java:82) at io.vavr.control.Option.map(Option.java:373) at io.jenkins.plugins.casc.impl.configurators.HeteroDescribableConfigurator.lambda$configure$3(HeteroDescribableConfigurator.java:82) at io.vavr.Tuple2.apply(Tuple2.java:239) at io.jenkins.plugins.casc.impl.configurators.HeteroDescribableConfigurator.configure(HeteroDescribableConfigurator.java:79) at io.jenkins.plugins.casc.impl.configurators.HeteroDescribableConfigurator.configure(HeteroDescribableConfigurator.java:51) at io.jenkins.plugins.casc.impl.configurators.DataBoundConfigurator.tryConstructor(DataBoundConfigurator.java:130) at io.jenkins.plugins.casc.impl.configurators.DataBoundConfigurator.instance(DataBoundConfigurator.java:73) at io.jenkins.plugins.casc.BaseConfigurator.configure(BaseConfigurator.java:262) at io.jenkins.plugins.casc.impl.configurators.DataBoundConfigurator.configure(DataBoundConfigurator.java:79) at io.jenkins.plugins.casc.impl.configurators.HeteroDescribableConfigurator.lambda$doConfigure$16668e2$1(HeteroDescribableConfigurator.java:228) at io.vavr.CheckedFunction0.lambda$unchecked$52349c75$1(CheckedFunction0.java:201) at io.jenkins.plugins.casc.impl.configurators.HeteroDescribableConfigurator.doConfigure(HeteroDescribableConfigurator.java:228) at io.jenkins.plugins.casc.impl.configurators.HeteroDescribableConfigurator.lambda$null$2(HeteroDescribableConfigurator.java:82) at io.vavr.control.Option.map(Option.java:373) at io.jenkins.plugins.casc.impl.configurators.HeteroDescribableConfigurator.lambda$configure$3(HeteroDescribableConfigurator.java:82) at io.vavr.Tuple2.apply(Tuple2.java:239) at io.jenkins.plugins.casc.impl.configurators.HeteroDescribableConfigurator.configure(HeteroDescribableConfigurator.java:79) at io.jenkins.plugins.casc.impl.configurators.HeteroDescribableConfigurator.configure(HeteroDescribableConfigurator.java:51) at io.jenkins.plugins.casc.impl.configurators.DataBoundConfigurator.tryConstructor(DataBoundConfigurator.java:130) at io.jenkins.plugins.casc.impl.configurators.DataBoundConfigurator.instance(DataBoundConfigurator.java:73) at io.jenkins.plugins.casc.BaseConfigurator.configure(BaseConfigurator.java:262) at io.jenkins.plugins.casc.impl.configurators.DataBoundConfigurator.check(DataBoundConfigurator.java:97) at io.jenkins.plugins.casc.BaseConfigurator.configure(BaseConfigurator.java:339) at io.jenkins.plugins.casc.BaseConfigurator.check(BaseConfigurator.java:282) at io.jenkins.plugins.casc.BaseConfigurator.configure(BaseConfigurator.java:347) at io.jenkins.plugins.casc.BaseConfigurator.check(BaseConfigurator.java:282) at io.jenkins.plugins.casc.ConfigurationAsCode.lambda$checkWith$6(ConfigurationAsCode.java:665) at io.jenkins.plugins.casc.ConfigurationAsCode.invokeWith(ConfigurationAsCode.java:627) ... 18 more
          {code}
           
          When I export a configuration to JCasC, e.g. for a Pipeline library with GitHub source, I get the following sample:

           
           globalLibraries:
             libraries:
               - defaultVersion: "master"
                 name: "jenkins-pipeline-lib"
                 retriever:
                    modernSCM:
                      scm:
                        github:
                          id: "e43d6600-ba0e-46c5-8eae-3989bf654055"
                          repoOwner: "jenkins-infra"
                          repository: "pipeline-library"
                          traits:
                            - branchDiscoveryTrait:
                                strategyId: 1
                            - originPullRequestDiscoveryTrait:
                                 strategyId: 1
                            - forkPullRequestDiscoveryTrait:
                                  strategyId: 1
                                  trust: "trustPermission"

           

           When the same configuration is imported, I get 
          {code:java}
          SEVERE: Failed ConfigurationAsCode.init java.lang.Error: java.lang.reflect.InvocationTargetException at hudson.init.TaskMethodFinder.invoke(TaskMethodFinder.java:110) at hudson.init.TaskMethodFinder$TaskImpl.run(TaskMethodFinder.java:175) at org.jvnet.hudson.reactor.Reactor.runTask(Reactor.java:296) at jenkins.model.Jenkins$5.runTask(Jenkins.java:1096) at org.jvnet.hudson.reactor.Reactor$2.run(Reactor.java:214) at org.jvnet.hudson.reactor.Reactor$Node.run(Reactor.java:117) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) at java.lang.Thread.run(Thread.java:748) Caused by: java.lang.reflect.InvocationTargetException at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at hudson.init.TaskMethodFinder.invoke(TaskMethodFinder.java:104) ... 8 more Caused by: io.jenkins.plugins.casc.ConfiguratorException: unclassified: error configuring 'unclassified' with class io.jenkins.plugins.casc.impl.configurators.GlobalConfigurationCategoryConfigurator configurator at io.jenkins.plugins.casc.ConfigurationAsCode.invokeWith(ConfigurationAsCode.java:633) at io.jenkins.plugins.casc.ConfigurationAsCode.checkWith(ConfigurationAsCode.java:665) at io.jenkins.plugins.casc.ConfigurationAsCode.configureWith(ConfigurationAsCode.java:649) at io.jenkins.plugins.casc.ConfigurationAsCode.configureWith(ConfigurationAsCode.java:548) at io.jenkins.plugins.casc.ConfigurationAsCode.configure(ConfigurationAsCode.java:277) at io.jenkins.plugins.casc.ConfigurationAsCode.init(ConfigurationAsCode.java:269) ... 13 more Caused by: io.jenkins.plugins.casc.ConfiguratorException: Invalid configuration elements for type class jenkins.plugins.git.traits.BranchDiscoveryTrait : strategyId. Available attributes : at io.jenkins.plugins.casc.BaseConfigurator.handleUnknown(BaseConfigurator.java:372) at io.jenkins.plugins.casc.BaseConfigurator.configure(BaseConfigurator.java:361) at io.jenkins.plugins.casc.BaseConfigurator.configure(BaseConfigurator.java:271) at io.jenkins.plugins.casc.impl.configurators.DataBoundConfigurator.configure(DataBoundConfigurator.java:79) at io.jenkins.plugins.casc.impl.configurators.HeteroDescribableConfigurator.lambda$doConfigure$16668e2$1(HeteroDescribableConfigurator.java:228) at io.vavr.CheckedFunction0.lambda$unchecked$52349c75$1(CheckedFunction0.java:201) at io.jenkins.plugins.casc.impl.configurators.HeteroDescribableConfigurator.doConfigure(HeteroDescribableConfigurator.java:228) at io.jenkins.plugins.casc.impl.configurators.HeteroDescribableConfigurator.lambda$null$2(HeteroDescribableConfigurator.java:82) at io.vavr.control.Option.map(Option.java:373) at io.jenkins.plugins.casc.impl.configurators.HeteroDescribableConfigurator.lambda$configure$3(HeteroDescribableConfigurator.java:82) at io.vavr.Tuple2.apply(Tuple2.java:239) at io.jenkins.plugins.casc.impl.configurators.HeteroDescribableConfigurator.configure(HeteroDescribableConfigurator.java:79) at io.jenkins.plugins.casc.impl.configurators.HeteroDescribableConfigurator.configure(HeteroDescribableConfigurator.java:51) at io.jenkins.plugins.casc.BaseConfigurator.configure(BaseConfigurator.java:340) at io.jenkins.plugins.casc.BaseConfigurator.configure(BaseConfigurator.java:271) at io.jenkins.plugins.casc.impl.configurators.DataBoundConfigurator.configure(DataBoundConfigurator.java:79) at io.jenkins.plugins.casc.impl.configurators.HeteroDescribableConfigurator.lambda$doConfigure$16668e2$1(HeteroDescribableConfigurator.java:228) at io.vavr.CheckedFunction0.lambda$unchecked$52349c75$1(CheckedFunction0.java:201) at io.jenkins.plugins.casc.impl.configurators.HeteroDescribableConfigurator.doConfigure(HeteroDescribableConfigurator.java:228) at io.jenkins.plugins.casc.impl.configurators.HeteroDescribableConfigurator.lambda$null$2(HeteroDescribableConfigurator.java:82) at io.vavr.control.Option.map(Option.java:373) at io.jenkins.plugins.casc.impl.configurators.HeteroDescribableConfigurator.lambda$configure$3(HeteroDescribableConfigurator.java:82) at io.vavr.Tuple2.apply(Tuple2.java:239) at io.jenkins.plugins.casc.impl.configurators.HeteroDescribableConfigurator.configure(HeteroDescribableConfigurator.java:79) at io.jenkins.plugins.casc.impl.configurators.HeteroDescribableConfigurator.configure(HeteroDescribableConfigurator.java:51) at io.jenkins.plugins.casc.impl.configurators.DataBoundConfigurator.tryConstructor(DataBoundConfigurator.java:130) at io.jenkins.plugins.casc.impl.configurators.DataBoundConfigurator.instance(DataBoundConfigurator.java:73) at io.jenkins.plugins.casc.BaseConfigurator.configure(BaseConfigurator.java:262) at io.jenkins.plugins.casc.impl.configurators.DataBoundConfigurator.configure(DataBoundConfigurator.java:79) at io.jenkins.plugins.casc.impl.configurators.HeteroDescribableConfigurator.lambda$doConfigure$16668e2$1(HeteroDescribableConfigurator.java:228) at io.vavr.CheckedFunction0.lambda$unchecked$52349c75$1(CheckedFunction0.java:201) at io.jenkins.plugins.casc.impl.configurators.HeteroDescribableConfigurator.doConfigure(HeteroDescribableConfigurator.java:228) at io.jenkins.plugins.casc.impl.configurators.HeteroDescribableConfigurator.lambda$null$2(HeteroDescribableConfigurator.java:82) at io.vavr.control.Option.map(Option.java:373) at io.jenkins.plugins.casc.impl.configurators.HeteroDescribableConfigurator.lambda$configure$3(HeteroDescribableConfigurator.java:82) at io.vavr.Tuple2.apply(Tuple2.java:239) at io.jenkins.plugins.casc.impl.configurators.HeteroDescribableConfigurator.configure(HeteroDescribableConfigurator.java:79) at io.jenkins.plugins.casc.impl.configurators.HeteroDescribableConfigurator.configure(HeteroDescribableConfigurator.java:51) at io.jenkins.plugins.casc.impl.configurators.DataBoundConfigurator.tryConstructor(DataBoundConfigurator.java:130) at io.jenkins.plugins.casc.impl.configurators.DataBoundConfigurator.instance(DataBoundConfigurator.java:73) at io.jenkins.plugins.casc.BaseConfigurator.configure(BaseConfigurator.java:262) at io.jenkins.plugins.casc.impl.configurators.DataBoundConfigurator.check(DataBoundConfigurator.java:97) at io.jenkins.plugins.casc.BaseConfigurator.configure(BaseConfigurator.java:339) at io.jenkins.plugins.casc.BaseConfigurator.check(BaseConfigurator.java:282) at io.jenkins.plugins.casc.BaseConfigurator.configure(BaseConfigurator.java:347) at io.jenkins.plugins.casc.BaseConfigurator.check(BaseConfigurator.java:282) at io.jenkins.plugins.casc.ConfigurationAsCode.lambda$checkWith$6(ConfigurationAsCode.java:665) at io.jenkins.plugins.casc.ConfigurationAsCode.invokeWith(ConfigurationAsCode.java:627) ... 18 more
          {code}
           
          oleg_nenashev Oleg Nenashev made changes -
          Component/s github-branch-source-plugin [ 20858 ]
          Component/s git-plugin [ 15543 ]
          oleg_nenashev Oleg Nenashev made changes -
          Assignee Mark Waite [ markewaite ]
          oleg_nenashev Oleg Nenashev made changes -
          Description When I export a configuration to JCasC, e.g. for a Pipeline library with GitHub source, I get the following sample:

           
           globalLibraries:
             libraries:
               - defaultVersion: "master"
                 name: "jenkins-pipeline-lib"
                 retriever:
                    modernSCM:
                      scm:
                        github:
                          id: "e43d6600-ba0e-46c5-8eae-3989bf654055"
                          repoOwner: "jenkins-infra"
                          repository: "pipeline-library"
                          traits:
                            - branchDiscoveryTrait:
                                strategyId: 1
                            - originPullRequestDiscoveryTrait:
                                 strategyId: 1
                            - forkPullRequestDiscoveryTrait:
                                  strategyId: 1
                                  trust: "trustPermission"

           

           When the same configuration is imported, I get 
          {code:java}
          SEVERE: Failed ConfigurationAsCode.init java.lang.Error: java.lang.reflect.InvocationTargetException at hudson.init.TaskMethodFinder.invoke(TaskMethodFinder.java:110) at hudson.init.TaskMethodFinder$TaskImpl.run(TaskMethodFinder.java:175) at org.jvnet.hudson.reactor.Reactor.runTask(Reactor.java:296) at jenkins.model.Jenkins$5.runTask(Jenkins.java:1096) at org.jvnet.hudson.reactor.Reactor$2.run(Reactor.java:214) at org.jvnet.hudson.reactor.Reactor$Node.run(Reactor.java:117) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) at java.lang.Thread.run(Thread.java:748) Caused by: java.lang.reflect.InvocationTargetException at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at hudson.init.TaskMethodFinder.invoke(TaskMethodFinder.java:104) ... 8 more Caused by: io.jenkins.plugins.casc.ConfiguratorException: unclassified: error configuring 'unclassified' with class io.jenkins.plugins.casc.impl.configurators.GlobalConfigurationCategoryConfigurator configurator at io.jenkins.plugins.casc.ConfigurationAsCode.invokeWith(ConfigurationAsCode.java:633) at io.jenkins.plugins.casc.ConfigurationAsCode.checkWith(ConfigurationAsCode.java:665) at io.jenkins.plugins.casc.ConfigurationAsCode.configureWith(ConfigurationAsCode.java:649) at io.jenkins.plugins.casc.ConfigurationAsCode.configureWith(ConfigurationAsCode.java:548) at io.jenkins.plugins.casc.ConfigurationAsCode.configure(ConfigurationAsCode.java:277) at io.jenkins.plugins.casc.ConfigurationAsCode.init(ConfigurationAsCode.java:269) ... 13 more Caused by: io.jenkins.plugins.casc.ConfiguratorException: Invalid configuration elements for type class jenkins.plugins.git.traits.BranchDiscoveryTrait : strategyId. Available attributes : at io.jenkins.plugins.casc.BaseConfigurator.handleUnknown(BaseConfigurator.java:372) at io.jenkins.plugins.casc.BaseConfigurator.configure(BaseConfigurator.java:361) at io.jenkins.plugins.casc.BaseConfigurator.configure(BaseConfigurator.java:271) at io.jenkins.plugins.casc.impl.configurators.DataBoundConfigurator.configure(DataBoundConfigurator.java:79) at io.jenkins.plugins.casc.impl.configurators.HeteroDescribableConfigurator.lambda$doConfigure$16668e2$1(HeteroDescribableConfigurator.java:228) at io.vavr.CheckedFunction0.lambda$unchecked$52349c75$1(CheckedFunction0.java:201) at io.jenkins.plugins.casc.impl.configurators.HeteroDescribableConfigurator.doConfigure(HeteroDescribableConfigurator.java:228) at io.jenkins.plugins.casc.impl.configurators.HeteroDescribableConfigurator.lambda$null$2(HeteroDescribableConfigurator.java:82) at io.vavr.control.Option.map(Option.java:373) at io.jenkins.plugins.casc.impl.configurators.HeteroDescribableConfigurator.lambda$configure$3(HeteroDescribableConfigurator.java:82) at io.vavr.Tuple2.apply(Tuple2.java:239) at io.jenkins.plugins.casc.impl.configurators.HeteroDescribableConfigurator.configure(HeteroDescribableConfigurator.java:79) at io.jenkins.plugins.casc.impl.configurators.HeteroDescribableConfigurator.configure(HeteroDescribableConfigurator.java:51) at io.jenkins.plugins.casc.BaseConfigurator.configure(BaseConfigurator.java:340) at io.jenkins.plugins.casc.BaseConfigurator.configure(BaseConfigurator.java:271) at io.jenkins.plugins.casc.impl.configurators.DataBoundConfigurator.configure(DataBoundConfigurator.java:79) at io.jenkins.plugins.casc.impl.configurators.HeteroDescribableConfigurator.lambda$doConfigure$16668e2$1(HeteroDescribableConfigurator.java:228) at io.vavr.CheckedFunction0.lambda$unchecked$52349c75$1(CheckedFunction0.java:201) at io.jenkins.plugins.casc.impl.configurators.HeteroDescribableConfigurator.doConfigure(HeteroDescribableConfigurator.java:228) at io.jenkins.plugins.casc.impl.configurators.HeteroDescribableConfigurator.lambda$null$2(HeteroDescribableConfigurator.java:82) at io.vavr.control.Option.map(Option.java:373) at io.jenkins.plugins.casc.impl.configurators.HeteroDescribableConfigurator.lambda$configure$3(HeteroDescribableConfigurator.java:82) at io.vavr.Tuple2.apply(Tuple2.java:239) at io.jenkins.plugins.casc.impl.configurators.HeteroDescribableConfigurator.configure(HeteroDescribableConfigurator.java:79) at io.jenkins.plugins.casc.impl.configurators.HeteroDescribableConfigurator.configure(HeteroDescribableConfigurator.java:51) at io.jenkins.plugins.casc.impl.configurators.DataBoundConfigurator.tryConstructor(DataBoundConfigurator.java:130) at io.jenkins.plugins.casc.impl.configurators.DataBoundConfigurator.instance(DataBoundConfigurator.java:73) at io.jenkins.plugins.casc.BaseConfigurator.configure(BaseConfigurator.java:262) at io.jenkins.plugins.casc.impl.configurators.DataBoundConfigurator.configure(DataBoundConfigurator.java:79) at io.jenkins.plugins.casc.impl.configurators.HeteroDescribableConfigurator.lambda$doConfigure$16668e2$1(HeteroDescribableConfigurator.java:228) at io.vavr.CheckedFunction0.lambda$unchecked$52349c75$1(CheckedFunction0.java:201) at io.jenkins.plugins.casc.impl.configurators.HeteroDescribableConfigurator.doConfigure(HeteroDescribableConfigurator.java:228) at io.jenkins.plugins.casc.impl.configurators.HeteroDescribableConfigurator.lambda$null$2(HeteroDescribableConfigurator.java:82) at io.vavr.control.Option.map(Option.java:373) at io.jenkins.plugins.casc.impl.configurators.HeteroDescribableConfigurator.lambda$configure$3(HeteroDescribableConfigurator.java:82) at io.vavr.Tuple2.apply(Tuple2.java:239) at io.jenkins.plugins.casc.impl.configurators.HeteroDescribableConfigurator.configure(HeteroDescribableConfigurator.java:79) at io.jenkins.plugins.casc.impl.configurators.HeteroDescribableConfigurator.configure(HeteroDescribableConfigurator.java:51) at io.jenkins.plugins.casc.impl.configurators.DataBoundConfigurator.tryConstructor(DataBoundConfigurator.java:130) at io.jenkins.plugins.casc.impl.configurators.DataBoundConfigurator.instance(DataBoundConfigurator.java:73) at io.jenkins.plugins.casc.BaseConfigurator.configure(BaseConfigurator.java:262) at io.jenkins.plugins.casc.impl.configurators.DataBoundConfigurator.check(DataBoundConfigurator.java:97) at io.jenkins.plugins.casc.BaseConfigurator.configure(BaseConfigurator.java:339) at io.jenkins.plugins.casc.BaseConfigurator.check(BaseConfigurator.java:282) at io.jenkins.plugins.casc.BaseConfigurator.configure(BaseConfigurator.java:347) at io.jenkins.plugins.casc.BaseConfigurator.check(BaseConfigurator.java:282) at io.jenkins.plugins.casc.ConfigurationAsCode.lambda$checkWith$6(ConfigurationAsCode.java:665) at io.jenkins.plugins.casc.ConfigurationAsCode.invokeWith(ConfigurationAsCode.java:627) ... 18 more
          {code}
           
          When I export a configuration to JCasC, e.g. for a Pipeline library with GitHub source, I get the following sample:

           
           globalLibraries:
             libraries:
               - defaultVersion: "master"
                 name: "jenkins-pipeline-lib"
                 retriever:
                    modernSCM:
                      scm:
                        github:
                          id: "e43d6600-ba0e-46c5-8eae-3989bf654055"
                          repoOwner: "jenkins-infra"
                          repository: "pipeline-library"
                          traits:
                            - branchDiscoveryTrait:
                                strategyId: 1
                            - originPullRequestDiscoveryTrait:
                                 strategyId: 1
                            - forkPullRequestDiscoveryTrait:
                                  strategyId: 1
                                  trust: "trustPermission"

           

           When the same configuration is imported, I get 
          {code:java}
          SEVERE: Failed ConfigurationAsCode.init java.lang.Error: java.lang.reflect.InvocationTargetException at hudson.init.TaskMethodFinder.invoke(TaskMethodFinder.java:110) at hudson.init.TaskMethodFinder$TaskImpl.run(TaskMethodFinder.java:175) at org.jvnet.hudson.reactor.Reactor.runTask(Reactor.java:296) at jenkins.model.Jenkins$5.runTask(Jenkins.java:1096) at org.jvnet.hudson.reactor.Reactor$2.run(Reactor.java:214) at org.jvnet.hudson.reactor.Reactor$Node.run(Reactor.java:117) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) at java.lang.Thread.run(Thread.java:748) Caused by: java.lang.reflect.InvocationTargetException at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at hudson.init.TaskMethodFinder.invoke(TaskMethodFinder.java:104) ... 8 more Caused by: io.jenkins.plugins.casc.ConfiguratorException: unclassified: error configuring 'unclassified' with class io.jenkins.plugins.casc.impl.configurators.GlobalConfigurationCategoryConfigurator configurator at io.jenkins.plugins.casc.ConfigurationAsCode.invokeWith(ConfigurationAsCode.java:633) at io.jenkins.plugins.casc.ConfigurationAsCode.checkWith(ConfigurationAsCode.java:665) at io.jenkins.plugins.casc.ConfigurationAsCode.configureWith(ConfigurationAsCode.java:649) at io.jenkins.plugins.casc.ConfigurationAsCode.configureWith(ConfigurationAsCode.java:548) at io.jenkins.plugins.casc.ConfigurationAsCode.configure(ConfigurationAsCode.java:277) at io.jenkins.plugins.casc.ConfigurationAsCode.init(ConfigurationAsCode.java:269) ... 13 more

          Caused by: io.jenkins.plugins.casc.ConfiguratorException: Invalid configuration elements for type class jenkins.plugins.git.traits.BranchDiscoveryTrait : strategyId. Available attributes : at io.jenkins.plugins.casc.BaseConfigurator.handleUnknown(BaseConfigurator.java:372) at io.jenkins.plugins.casc.BaseConfigurator.configure(BaseConfigurator.java:361) at io.jenkins.plugins.casc.BaseConfigurator.configure(BaseConfigurator.java:271) at io.jenkins.plugins.casc.impl.configurators.DataBoundConfigurator.configure(DataBoundConfigurator.java:79) at io.jenkins.plugins.casc.impl.configurators.HeteroDescribableConfigurator.lambda$doConfigure$16668e2$1(HeteroDescribableConfigurator.java:228) at io.vavr.CheckedFunction0.lambda$unchecked$52349c75$1(CheckedFunction0.java:201) at io.jenkins.plugins.casc.impl.configurators.HeteroDescribableConfigurator.doConfigure(HeteroDescribableConfigurator.java:228) at io.jenkins.plugins.casc.impl.configurators.HeteroDescribableConfigurator.lambda$null$2(HeteroDescribableConfigurator.java:82) at io.vavr.control.Option.map(Option.java:373) at io.jenkins.plugins.casc.impl.configurators.HeteroDescribableConfigurator.lambda$configure$3(HeteroDescribableConfigurator.java:82) at io.vavr.Tuple2.apply(Tuple2.java:239) at io.jenkins.plugins.casc.impl.configurators.HeteroDescribableConfigurator.configure(HeteroDescribableConfigurator.java:79) at io.jenkins.plugins.casc.impl.configurators.HeteroDescribableConfigurator.configure(HeteroDescribableConfigurator.java:51) at io.jenkins.plugins.casc.BaseConfigurator.configure(BaseConfigurator.java:340) at io.jenkins.plugins.casc.BaseConfigurator.configure(BaseConfigurator.java:271) at io.jenkins.plugins.casc.impl.configurators.DataBoundConfigurator.configure(DataBoundConfigurator.java:79) at io.jenkins.plugins.casc.impl.configurators.HeteroDescribableConfigurator.lambda$doConfigure$16668e2$1(HeteroDescribableConfigurator.java:228) at io.vavr.CheckedFunction0.lambda$unchecked$52349c75$1(CheckedFunction0.java:201) at io.jenkins.plugins.casc.impl.configurators.HeteroDescribableConfigurator.doConfigure(HeteroDescribableConfigurator.java:228) at io.jenkins.plugins.casc.impl.configurators.HeteroDescribableConfigurator.lambda$null$2(HeteroDescribableConfigurator.java:82) at io.vavr.control.Option.map(Option.java:373) at io.jenkins.plugins.casc.impl.configurators.HeteroDescribableConfigurator.lambda$configure$3(HeteroDescribableConfigurator.java:82) at io.vavr.Tuple2.apply(Tuple2.java:239) at io.jenkins.plugins.casc.impl.configurators.HeteroDescribableConfigurator.configure(HeteroDescribableConfigurator.java:79) at io.jenkins.plugins.casc.impl.configurators.HeteroDescribableConfigurator.configure(HeteroDescribableConfigurator.java:51) at io.jenkins.plugins.casc.impl.configurators.DataBoundConfigurator.tryConstructor(DataBoundConfigurator.java:130) at io.jenkins.plugins.casc.impl.configurators.DataBoundConfigurator.instance(DataBoundConfigurator.java:73) at io.jenkins.plugins.casc.BaseConfigurator.configure(BaseConfigurator.java:262) at io.jenkins.plugins.casc.impl.configurators.DataBoundConfigurator.configure(DataBoundConfigurator.java:79) at io.jenkins.plugins.casc.impl.configurators.HeteroDescribableConfigurator.lambda$doConfigure$16668e2$1(HeteroDescribableConfigurator.java:228) at io.vavr.CheckedFunction0.lambda$unchecked$52349c75$1(CheckedFunction0.java:201) at io.jenkins.plugins.casc.impl.configurators.HeteroDescribableConfigurator.doConfigure(HeteroDescribableConfigurator.java:228) at io.jenkins.plugins.casc.impl.configurators.HeteroDescribableConfigurator.lambda$null$2(HeteroDescribableConfigurator.java:82) at io.vavr.control.Option.map(Option.java:373) at io.jenkins.plugins.casc.impl.configurators.HeteroDescribableConfigurator.lambda$configure$3(HeteroDescribableConfigurator.java:82) at io.vavr.Tuple2.apply(Tuple2.java:239) at io.jenkins.plugins.casc.impl.configurators.HeteroDescribableConfigurator.configure(HeteroDescribableConfigurator.java:79) at io.jenkins.plugins.casc.impl.configurators.HeteroDescribableConfigurator.configure(HeteroDescribableConfigurator.java:51) at io.jenkins.plugins.casc.impl.configurators.DataBoundConfigurator.tryConstructor(DataBoundConfigurator.java:130) at io.jenkins.plugins.casc.impl.configurators.DataBoundConfigurator.instance(DataBoundConfigurator.java:73) at io.jenkins.plugins.casc.BaseConfigurator.configure(BaseConfigurator.java:262) at io.jenkins.plugins.casc.impl.configurators.DataBoundConfigurator.check(DataBoundConfigurator.java:97) at io.jenkins.plugins.casc.BaseConfigurator.configure(BaseConfigurator.java:339) at io.jenkins.plugins.casc.BaseConfigurator.check(BaseConfigurator.java:282) at io.jenkins.plugins.casc.BaseConfigurator.configure(BaseConfigurator.java:347) at io.jenkins.plugins.casc.BaseConfigurator.check(BaseConfigurator.java:282) at io.jenkins.plugins.casc.ConfigurationAsCode.lambda$checkWith$6(ConfigurationAsCode.java:665) at io.jenkins.plugins.casc.ConfigurationAsCode.invokeWith(ConfigurationAsCode.java:627) ... 18 more
          {code}
           
          Hide
          oleg_nenashev Oleg Nenashev added a comment -

          Basically it looks like the class is not properly recovered from the array object.
          Invalid configuration elements for type class jenkins.plugins.git.traits.BranchDiscoveryTrait : strategyId. Available attributes : at io.jenkins.plugins.casc.BaseConfigurator.handleUnknown(BaseConfigurator.java:372) at
           

          stratagyId exists for child classes, but not for BranchDiscoveryTrait itself

          CC Joseph Petersen, likely this is an issue in the JCasC plugin

          Show
          oleg_nenashev Oleg Nenashev added a comment - Basically it looks like the class is not properly recovered from the array object. Invalid configuration elements for type class jenkins.plugins.git.traits.BranchDiscoveryTrait : strategyId. Available attributes : at io.jenkins.plugins.casc.BaseConfigurator.handleUnknown(BaseConfigurator.java:372) at   stratagyId exists for child classes, but not for BranchDiscoveryTrait itself CC Joseph Petersen , likely this is an issue in the JCasC plugin
          oleg_nenashev Oleg Nenashev made changes -
          Component/s configuration-as-code-plugin [ 23170 ]
          fcojfernandez Francisco Fernández made changes -
          Assignee Francisco Fernández [ fcojfernandez ]
          fcojfernandez Francisco Fernández made changes -
          Status Open [ 1 ] In Progress [ 3 ]

            People

            • Assignee:
              fcojfernandez Francisco Fernández
              Reporter:
              oleg_nenashev Oleg Nenashev
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated: