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

Cannot configure ForkPullRequestDiscoveryTrait by using Job DSL dynamic API

    XMLWordPrintable

    Details

    • Similar Issues:
    • Released As:
      github-branch-source-2.4.5

      Description

      GitHub Branch Source plugin has introduced unique symbols (not released yet), so finally we are able to configure traits by using Job DSL dynamic API instead of configure block. Unfortunately, ForkPullRequestDiscoveryTrait (gitHubForkDiscovery) is unavailable. For now the only possible option is to still use configure block:

      branchSources {
          branchSource {
              source {
                  github {
                      apiUri(config.scm.apiUrl)
                      id(config.name)
                      repoOwner(config.scm.organisation)
                      repository(config.scm.repository)
                      repositoryUrl(config.scm.url)
                      configuredByUrl(false)
                      credentialsId(config.scm.credentialsId)
                      traits {
                          gitHubBranchDiscovery {
                              strategyId(3)
                          }
                          gitHubPullRequestDiscovery {
                              strategyId(1)
                          }
                      }
                  }
              }
              buildStrategies {
                  skipInitialBuildOnFirstBranchIndexing()
              }
          }
      }
      configure {
          def traits = it / 'sources' / 'data' / 'jenkins.branch.BranchSource' / 'source' / 'traits'
          traits << 'org.jenkinsci.plugins.github__branch__source.ForkPullRequestDiscoveryTrait' {
              strategyId(1)
              trust(class: 'org.jenkinsci.plugins.github_branch_source.ForkPullRequestDiscoveryTrait$TrustPermission')
          }
      }
      

      List of available traits in Job DSL Dynamic API Vievwer:

      • gitHubAgedRefsTrait
      • gitHubBranchDiscovery
      • gitHubPullRequestDiscovery
      • gitHubSshCheckout
      • gitHubTagDiscovery

      Missing:

      • gitHubForkDiscovery ← missing, but possible to execute

      I tried:
      1)

      gitHubForkDiscovery {
          strategyId(1)
          trust('trustPermission')
      } 
      
      ERROR: (unknown source) No signature of method: javaposse.jobdsl.plugin.structs.DescribableContext.trust() is applicable for argument types: (java.lang.String) values: [trustPermission]
      Possible solutions: getAt(java.lang.String), print(java.io.PrintWriter), use([Ljava.lang.Object;), print(java.lang.Object), wait(), dump()
      

      2)

      gitHubForkDiscovery {
          strategyId(1)
          trust(gitHubTrustPermissions)
      } 
      
      ERROR: (MultibranchJobFactory.groovy, line 89) No such property: gitHubTrustPermissions for class: javaposse.jobdsl.plugin.structs.DescribableContext
      

      3)

      gitHubForkDiscovery {
          strategyId(1)
          trust(gitHubTrustPermissions())
      } 
      
      ERROR: (unknown source) No signature of method: javaposse.jobdsl.plugin.structs.DescribableContext.gitHubTrustPermissions() is applicable for argument types: () values: []
      

      4)

      gitHubForkDiscovery {
          strategyId(1)
          trust {
              gitHubTrustPermissions()
          }
      } 
      
      ERROR: (unknown source) No signature of method: javaposse.jobdsl.plugin.structs.DescribableContext.gitHubTrustPermissions() is applicable for argument types: () values: []
      

      5)

      gitHubForkDiscovery {
          strategyId(1)
          trust(Class.forName('org.jenkinsci.plugins.github_branch_source.ForkPullRequestDiscoveryTrait$TrustPermission', true, Jenkins.get().pluginManager.uberClassLoader).getDeclaredConstructor().newInstance())
      } 
      
      ERROR: (unknown source) No signature of method: javaposse.jobdsl.plugin.structs.DescribableContext.trust() is applicable for argument types: (org.jenkinsci.plugins.github_branch_source.ForkPullRequestDiscoveryTrait$TrustPermission) values: [org.jenkinsci.plugins.github_branch_source.ForkPullRequestDiscoveryTrait$TrustPermission@3a41ed6e]
      Possible solutions: print(java.io.PrintWriter), use([Ljava.lang.Object;), print(java.lang.Object), wait(), dump(), grep()
      

        Attachments

          Issue Links

            Activity

            agabrys Adam Gabryś created issue -
            agabrys Adam Gabryś made changes -
            Field Original Value New Value
            Issue Type Task [ 3 ] Bug [ 1 ]
            agabrys Adam Gabryś made changes -
            Environment Job DSL: 1.76
            GitHub Branch Source: 2.5.9-SNAPSHOT (commit: 7179854f068f0012b3d1222f6924e8de5d437513)
            agabrys Adam Gabryś made changes -
            Link This issue relates to JENKINS-45504 [ JENKINS-45504 ]
            agabrys Adam Gabryś made changes -
            Link This issue relates to JENKINS-45504 [ JENKINS-45504 ]
            agabrys Adam Gabryś made changes -
            Link This issue is related to JENKINS-45504 [ JENKINS-45504 ]
            agabrys Adam Gabryś made changes -
            Description GitHub Branch Source plugin has introduced unique symbols (not released yet), so finally we are able to configure traits by using Job DSL dynamic API instead of {{configure block}}. Unfortunately, ForkPullRequestDiscoveryTrait ({{gitHubForkDiscovery}}) is unavailable. For now the only possible option is to still use {{configure}} block:
            {code}
            branchSources {
                branchSource {
                    source {
                        github {
                            apiUri(config.scm.apiUrl)
                            id(config.name)
                            repoOwner(config.scm.organisation)
                            repository(config.scm.repository)
                            repositoryUrl(config.scm.url)
                            configuredByUrl(false)
                            credentialsId(config.scm.credentialsId)
                            traits {
                                gitHubBranchDiscovery {
                                    strategyId(3)
                                }
                                gitHubPullRequestDiscovery {
                                    strategyId(1)
                                }
                            }
                        }
                    }
                    buildStrategies {
                        skipInitialBuildOnFirstBranchIndexing()
                    }
                }
            }
            configure {
                def traits = it / 'sources' / 'data' / 'jenkins.branch.BranchSource' / 'source' / 'traits'
                traits << 'org.jenkinsci.plugins.github__branch__source.ForkPullRequestDiscoveryTrait' {
                    strategyId(1)
                    trust(class: 'org.jenkinsci.plugins.github_branch_source.ForkPullRequestDiscoveryTrait$TrustPermission')
                }
            }
            {code}
            GitHub Branch Source plugin has introduced unique symbols (not released yet), so finally we are able to configure traits by using Job DSL dynamic API instead of {{configure block}}. Unfortunately, ForkPullRequestDiscoveryTrait ({{gitHubForkDiscovery}}) is unavailable. For now the only possible option is to still use {{configure}} block:
            {code}
            branchSources {
                branchSource {
                    source {
                        github {
                            apiUri(config.scm.apiUrl)
                            id(config.name)
                            repoOwner(config.scm.organisation)
                            repository(config.scm.repository)
                            repositoryUrl(config.scm.url)
                            configuredByUrl(false)
                            credentialsId(config.scm.credentialsId)
                            traits {
                                gitHubBranchDiscovery {
                                    strategyId(3)
                                }
                                gitHubPullRequestDiscovery {
                                    strategyId(1)
                                }
                            }
                        }
                    }
                    buildStrategies {
                        skipInitialBuildOnFirstBranchIndexing()
                    }
                }
            }
            configure {
                def traits = it / 'sources' / 'data' / 'jenkins.branch.BranchSource' / 'source' / 'traits'
                traits << 'org.jenkinsci.plugins.github__branch__source.ForkPullRequestDiscoveryTrait' {
                    strategyId(1)
                    trust(class: 'org.jenkinsci.plugins.github_branch_source.ForkPullRequestDiscoveryTrait$TrustPermission')
                }
            }
            {code}

            List of available traits:
            * gitHubAgedRefsTrait
            * gitHubBranchDiscovery
            * gitHubSshCheckout
            * gitHubTagDiscovery

            Missing:
            * gitHubForkDiscovery
            * gitHubPullRequestDiscovery
            agabrys Adam Gabryś made changes -
            Summary Cannot configure ForkPullRequestDiscoveryTrait by using Job DSL dynamic API Cannot configure ForkPullRequestDiscoveryTrait and OriginPullRequestDiscoveryTrait by using Job DSL dynamic API
            agabrys Adam Gabryś made changes -
            Remote Link This issue links to "github-branch-source-plugin #183 add Symbol to ForkPullRequestDiscoveryTrait (Web Link)" [ 24339 ]
            agabrys Adam Gabryś made changes -
            Remote Link This issue links to "github-branch-source-plugin #258 add Symbol to OriginPullRequestDiscoveryTrait (Web Link)" [ 24340 ]
            agabrys Adam Gabryś made changes -
            Summary Cannot configure ForkPullRequestDiscoveryTrait and OriginPullRequestDiscoveryTrait by using Job DSL dynamic API Cannot configure ForkPullRequestDiscoveryTrait by using Job DSL dynamic API
            agabrys Adam Gabryś made changes -
            Description GitHub Branch Source plugin has introduced unique symbols (not released yet), so finally we are able to configure traits by using Job DSL dynamic API instead of {{configure block}}. Unfortunately, ForkPullRequestDiscoveryTrait ({{gitHubForkDiscovery}}) is unavailable. For now the only possible option is to still use {{configure}} block:
            {code}
            branchSources {
                branchSource {
                    source {
                        github {
                            apiUri(config.scm.apiUrl)
                            id(config.name)
                            repoOwner(config.scm.organisation)
                            repository(config.scm.repository)
                            repositoryUrl(config.scm.url)
                            configuredByUrl(false)
                            credentialsId(config.scm.credentialsId)
                            traits {
                                gitHubBranchDiscovery {
                                    strategyId(3)
                                }
                                gitHubPullRequestDiscovery {
                                    strategyId(1)
                                }
                            }
                        }
                    }
                    buildStrategies {
                        skipInitialBuildOnFirstBranchIndexing()
                    }
                }
            }
            configure {
                def traits = it / 'sources' / 'data' / 'jenkins.branch.BranchSource' / 'source' / 'traits'
                traits << 'org.jenkinsci.plugins.github__branch__source.ForkPullRequestDiscoveryTrait' {
                    strategyId(1)
                    trust(class: 'org.jenkinsci.plugins.github_branch_source.ForkPullRequestDiscoveryTrait$TrustPermission')
                }
            }
            {code}

            List of available traits:
            * gitHubAgedRefsTrait
            * gitHubBranchDiscovery
            * gitHubSshCheckout
            * gitHubTagDiscovery

            Missing:
            * gitHubForkDiscovery
            * gitHubPullRequestDiscovery
            GitHub Branch Source plugin has introduced unique symbols (not released yet), so finally we are able to configure traits by using Job DSL dynamic API instead of {{configure block}}. Unfortunately, ForkPullRequestDiscoveryTrait ({{gitHubForkDiscovery}}) is unavailable. For now the only possible option is to still use {{configure}} block:
            {code}
            branchSources {
                branchSource {
                    source {
                        github {
                            apiUri(config.scm.apiUrl)
                            id(config.name)
                            repoOwner(config.scm.organisation)
                            repository(config.scm.repository)
                            repositoryUrl(config.scm.url)
                            configuredByUrl(false)
                            credentialsId(config.scm.credentialsId)
                            traits {
                                gitHubBranchDiscovery {
                                    strategyId(3)
                                }
                                gitHubPullRequestDiscovery {
                                    strategyId(1)
                                }
                            }
                        }
                    }
                    buildStrategies {
                        skipInitialBuildOnFirstBranchIndexing()
                    }
                }
            }
            configure {
                def traits = it / 'sources' / 'data' / 'jenkins.branch.BranchSource' / 'source' / 'traits'
                traits << 'org.jenkinsci.plugins.github__branch__source.ForkPullRequestDiscoveryTrait' {
                    strategyId(1)
                    trust(class: 'org.jenkinsci.plugins.github_branch_source.ForkPullRequestDiscoveryTrait$TrustPermission')
                }
            }
            {code}

            List of available traits:
            * gitHubAgedRefsTrait
            * gitHubBranchDiscovery
            * gitHubSshCheckout
            * gitHubTagDiscovery

            Missing:
            * gitHubForkDiscovery
            agabrys Adam Gabryś made changes -
            Remote Link This issue links to "github-branch-source-plugin #258 add Symbol to OriginPullRequestDiscoveryTrait (Web Link)" [ 24340 ]
            agabrys Adam Gabryś made changes -
            Description GitHub Branch Source plugin has introduced unique symbols (not released yet), so finally we are able to configure traits by using Job DSL dynamic API instead of {{configure block}}. Unfortunately, ForkPullRequestDiscoveryTrait ({{gitHubForkDiscovery}}) is unavailable. For now the only possible option is to still use {{configure}} block:
            {code}
            branchSources {
                branchSource {
                    source {
                        github {
                            apiUri(config.scm.apiUrl)
                            id(config.name)
                            repoOwner(config.scm.organisation)
                            repository(config.scm.repository)
                            repositoryUrl(config.scm.url)
                            configuredByUrl(false)
                            credentialsId(config.scm.credentialsId)
                            traits {
                                gitHubBranchDiscovery {
                                    strategyId(3)
                                }
                                gitHubPullRequestDiscovery {
                                    strategyId(1)
                                }
                            }
                        }
                    }
                    buildStrategies {
                        skipInitialBuildOnFirstBranchIndexing()
                    }
                }
            }
            configure {
                def traits = it / 'sources' / 'data' / 'jenkins.branch.BranchSource' / 'source' / 'traits'
                traits << 'org.jenkinsci.plugins.github__branch__source.ForkPullRequestDiscoveryTrait' {
                    strategyId(1)
                    trust(class: 'org.jenkinsci.plugins.github_branch_source.ForkPullRequestDiscoveryTrait$TrustPermission')
                }
            }
            {code}

            List of available traits:
            * gitHubAgedRefsTrait
            * gitHubBranchDiscovery
            * gitHubSshCheckout
            * gitHubTagDiscovery

            Missing:
            * gitHubForkDiscovery
            GitHub Branch Source plugin has introduced unique symbols (not released yet), so finally we are able to configure traits by using Job DSL dynamic API instead of {{configure block}}. Unfortunately, ForkPullRequestDiscoveryTrait ({{gitHubForkDiscovery}}) is unavailable. For now the only possible option is to still use {{configure}} block:
            {code}
            branchSources {
                branchSource {
                    source {
                        github {
                            apiUri(config.scm.apiUrl)
                            id(config.name)
                            repoOwner(config.scm.organisation)
                            repository(config.scm.repository)
                            repositoryUrl(config.scm.url)
                            configuredByUrl(false)
                            credentialsId(config.scm.credentialsId)
                            traits {
                                gitHubBranchDiscovery {
                                    strategyId(3)
                                }
                                gitHubPullRequestDiscovery {
                                    strategyId(1)
                                }
                            }
                        }
                    }
                    buildStrategies {
                        skipInitialBuildOnFirstBranchIndexing()
                    }
                }
            }
            configure {
                def traits = it / 'sources' / 'data' / 'jenkins.branch.BranchSource' / 'source' / 'traits'
                traits << 'org.jenkinsci.plugins.github__branch__source.ForkPullRequestDiscoveryTrait' {
                    strategyId(1)
                    trust(class: 'org.jenkinsci.plugins.github_branch_source.ForkPullRequestDiscoveryTrait$TrustPermission')
                }
            }
            {code}

            List of available traits in Job DSL Dynamic API Vievwer:
            * gitHubAgedRefsTrait
            * gitHubBranchDiscovery
            * gitHubSshCheckout
            * gitHubTagDiscovery

            Missing:
            * gitHubPullRequestDiscovery ← I'm able to configure
            * gitHubForkDiscovery ← I'm not able to configure

            I tried:
            {code}
            gitHubForkDiscovery {
                strategyId(1)
                trust('trustPermission')
            }
            {code}
            agabrys Adam Gabryś made changes -
            Description GitHub Branch Source plugin has introduced unique symbols (not released yet), so finally we are able to configure traits by using Job DSL dynamic API instead of {{configure block}}. Unfortunately, ForkPullRequestDiscoveryTrait ({{gitHubForkDiscovery}}) is unavailable. For now the only possible option is to still use {{configure}} block:
            {code}
            branchSources {
                branchSource {
                    source {
                        github {
                            apiUri(config.scm.apiUrl)
                            id(config.name)
                            repoOwner(config.scm.organisation)
                            repository(config.scm.repository)
                            repositoryUrl(config.scm.url)
                            configuredByUrl(false)
                            credentialsId(config.scm.credentialsId)
                            traits {
                                gitHubBranchDiscovery {
                                    strategyId(3)
                                }
                                gitHubPullRequestDiscovery {
                                    strategyId(1)
                                }
                            }
                        }
                    }
                    buildStrategies {
                        skipInitialBuildOnFirstBranchIndexing()
                    }
                }
            }
            configure {
                def traits = it / 'sources' / 'data' / 'jenkins.branch.BranchSource' / 'source' / 'traits'
                traits << 'org.jenkinsci.plugins.github__branch__source.ForkPullRequestDiscoveryTrait' {
                    strategyId(1)
                    trust(class: 'org.jenkinsci.plugins.github_branch_source.ForkPullRequestDiscoveryTrait$TrustPermission')
                }
            }
            {code}

            List of available traits in Job DSL Dynamic API Vievwer:
            * gitHubAgedRefsTrait
            * gitHubBranchDiscovery
            * gitHubSshCheckout
            * gitHubTagDiscovery

            Missing:
            * gitHubPullRequestDiscovery ← I'm able to configure
            * gitHubForkDiscovery ← I'm not able to configure

            I tried:
            {code}
            gitHubForkDiscovery {
                strategyId(1)
                trust('trustPermission')
            }
            {code}
            GitHub Branch Source plugin has introduced unique symbols (not released yet), so finally we are able to configure traits by using Job DSL dynamic API instead of {{configure block}}. Unfortunately, ForkPullRequestDiscoveryTrait ({{gitHubForkDiscovery}}) is unavailable. For now the only possible option is to still use {{configure}} block:
            {code:java}
            branchSources {
                branchSource {
                    source {
                        github {
                            apiUri(config.scm.apiUrl)
                            id(config.name)
                            repoOwner(config.scm.organisation)
                            repository(config.scm.repository)
                            repositoryUrl(config.scm.url)
                            configuredByUrl(false)
                            credentialsId(config.scm.credentialsId)
                            traits {
                                gitHubBranchDiscovery {
                                    strategyId(3)
                                }
                                gitHubPullRequestDiscovery {
                                    strategyId(1)
                                }
                            }
                        }
                    }
                    buildStrategies {
                        skipInitialBuildOnFirstBranchIndexing()
                    }
                }
            }
            configure {
                def traits = it / 'sources' / 'data' / 'jenkins.branch.BranchSource' / 'source' / 'traits'
                traits << 'org.jenkinsci.plugins.github__branch__source.ForkPullRequestDiscoveryTrait' {
                    strategyId(1)
                    trust(class: 'org.jenkinsci.plugins.github_branch_source.ForkPullRequestDiscoveryTrait$TrustPermission')
                }
            }
            {code}
            List of available traits in Job DSL Dynamic API Vievwer:
             * gitHubAgedRefsTrait
             * gitHubBranchDiscovery
             * gitHubPullRequestDiscovery
             * gitHubSshCheckout
             * gitHubTagDiscovery

            Missing:
             * gitHubForkDiscovery ← missing, but exists

            I tried:
             1)
            {code:java}
            gitHubForkDiscovery {
                strategyId(1)
                trust('trustPermission')
            }
            {code}
            {noformat}
            ERROR: (unknown source) No signature of method: javaposse.jobdsl.plugin.structs.DescribableContext.trust() is applicable for argument types: (java.lang.String) values: [trustPermission]
            Possible solutions: getAt(java.lang.String), print(java.io.PrintWriter), use([Ljava.lang.Object;), print(java.lang.Object), wait(), dump()
            {noformat}
            2)
            {code:java}
            gitHubForkDiscovery {
                strategyId(1)
                trust(gitHubTrustPermissions)
            }
            {code}
            {noformat}
            ERROR: (MultibranchJobFactory.groovy, line 89) No such property: gitHubTrustPermissions for class: javaposse.jobdsl.plugin.structs.DescribableContext
            {noformat}
            3)
            {code:java}
            gitHubForkDiscovery {
                strategyId(1)
                trust(gitHubTrustPermissions())
            }
            {code}
            {noformat}
            ERROR: (unknown source) No signature of method: javaposse.jobdsl.plugin.structs.DescribableContext.gitHubTrustPermissions() is applicable for argument types: () values: []
            {noformat}
            4)
            {code:java}
            gitHubForkDiscovery {
                strategyId(1)
                trust {
                    gitHubTrustPermissions()
                }
            }
            {code}
            {noformat}
            ERROR: (unknown source) No signature of method: javaposse.jobdsl.plugin.structs.DescribableContext.gitHubTrustPermissions() is applicable for argument types: () values: []
            {noformat}
            5)
            {code:java}
            gitHubForkDiscovery {
                strategyId(1)
            gitHubForkDiscovery {
            strategyId(1)
            trust(Class.forName('org.jenkinsci.plugins.github_branch_source.ForkPullRequestDiscoveryTrait$TrustPermission', true, Jenkins.get().pluginManager.uberClassLoader).getDeclaredConstructor().newInstance())
            }
            }
            {code}
            {noformat}
            ERROR: (unknown source) No signature of method: javaposse.jobdsl.plugin.structs.DescribableContext.gitHubTrustPermissions() is applicable for argument types: () values: []
            {noformat}
            5)
            agabrys Adam Gabryś made changes -
            Description GitHub Branch Source plugin has introduced unique symbols (not released yet), so finally we are able to configure traits by using Job DSL dynamic API instead of {{configure block}}. Unfortunately, ForkPullRequestDiscoveryTrait ({{gitHubForkDiscovery}}) is unavailable. For now the only possible option is to still use {{configure}} block:
            {code:java}
            branchSources {
                branchSource {
                    source {
                        github {
                            apiUri(config.scm.apiUrl)
                            id(config.name)
                            repoOwner(config.scm.organisation)
                            repository(config.scm.repository)
                            repositoryUrl(config.scm.url)
                            configuredByUrl(false)
                            credentialsId(config.scm.credentialsId)
                            traits {
                                gitHubBranchDiscovery {
                                    strategyId(3)
                                }
                                gitHubPullRequestDiscovery {
                                    strategyId(1)
                                }
                            }
                        }
                    }
                    buildStrategies {
                        skipInitialBuildOnFirstBranchIndexing()
                    }
                }
            }
            configure {
                def traits = it / 'sources' / 'data' / 'jenkins.branch.BranchSource' / 'source' / 'traits'
                traits << 'org.jenkinsci.plugins.github__branch__source.ForkPullRequestDiscoveryTrait' {
                    strategyId(1)
                    trust(class: 'org.jenkinsci.plugins.github_branch_source.ForkPullRequestDiscoveryTrait$TrustPermission')
                }
            }
            {code}
            List of available traits in Job DSL Dynamic API Vievwer:
             * gitHubAgedRefsTrait
             * gitHubBranchDiscovery
             * gitHubPullRequestDiscovery
             * gitHubSshCheckout
             * gitHubTagDiscovery

            Missing:
             * gitHubForkDiscovery ← missing, but exists

            I tried:
             1)
            {code:java}
            gitHubForkDiscovery {
                strategyId(1)
                trust('trustPermission')
            }
            {code}
            {noformat}
            ERROR: (unknown source) No signature of method: javaposse.jobdsl.plugin.structs.DescribableContext.trust() is applicable for argument types: (java.lang.String) values: [trustPermission]
            Possible solutions: getAt(java.lang.String), print(java.io.PrintWriter), use([Ljava.lang.Object;), print(java.lang.Object), wait(), dump()
            {noformat}
            2)
            {code:java}
            gitHubForkDiscovery {
                strategyId(1)
                trust(gitHubTrustPermissions)
            }
            {code}
            {noformat}
            ERROR: (MultibranchJobFactory.groovy, line 89) No such property: gitHubTrustPermissions for class: javaposse.jobdsl.plugin.structs.DescribableContext
            {noformat}
            3)
            {code:java}
            gitHubForkDiscovery {
                strategyId(1)
                trust(gitHubTrustPermissions())
            }
            {code}
            {noformat}
            ERROR: (unknown source) No signature of method: javaposse.jobdsl.plugin.structs.DescribableContext.gitHubTrustPermissions() is applicable for argument types: () values: []
            {noformat}
            4)
            {code:java}
            gitHubForkDiscovery {
                strategyId(1)
                trust {
                    gitHubTrustPermissions()
                }
            }
            {code}
            {noformat}
            ERROR: (unknown source) No signature of method: javaposse.jobdsl.plugin.structs.DescribableContext.gitHubTrustPermissions() is applicable for argument types: () values: []
            {noformat}
            5)
            {code:java}
            gitHubForkDiscovery {
                strategyId(1)
            gitHubForkDiscovery {
            strategyId(1)
            trust(Class.forName('org.jenkinsci.plugins.github_branch_source.ForkPullRequestDiscoveryTrait$TrustPermission', true, Jenkins.get().pluginManager.uberClassLoader).getDeclaredConstructor().newInstance())
            }
            }
            {code}
            {noformat}
            ERROR: (unknown source) No signature of method: javaposse.jobdsl.plugin.structs.DescribableContext.gitHubTrustPermissions() is applicable for argument types: () values: []
            {noformat}
            5)
            GitHub Branch Source plugin has introduced unique symbols (not released yet), so finally we are able to configure traits by using Job DSL dynamic API instead of {{configure block}}. Unfortunately, ForkPullRequestDiscoveryTrait ({{gitHubForkDiscovery}}) is unavailable. For now the only possible option is to still use {{configure}} block:
            {code:java}
            branchSources {
                branchSource {
                    source {
                        github {
                            apiUri(config.scm.apiUrl)
                            id(config.name)
                            repoOwner(config.scm.organisation)
                            repository(config.scm.repository)
                            repositoryUrl(config.scm.url)
                            configuredByUrl(false)
                            credentialsId(config.scm.credentialsId)
                            traits {
                                gitHubBranchDiscovery {
                                    strategyId(3)
                                }
                                gitHubPullRequestDiscovery {
                                    strategyId(1)
                                }
                            }
                        }
                    }
                    buildStrategies {
                        skipInitialBuildOnFirstBranchIndexing()
                    }
                }
            }
            configure {
                def traits = it / 'sources' / 'data' / 'jenkins.branch.BranchSource' / 'source' / 'traits'
                traits << 'org.jenkinsci.plugins.github__branch__source.ForkPullRequestDiscoveryTrait' {
                    strategyId(1)
                    trust(class: 'org.jenkinsci.plugins.github_branch_source.ForkPullRequestDiscoveryTrait$TrustPermission')
                }
            }
            {code}
            List of available traits in Job DSL Dynamic API Vievwer:
             * gitHubAgedRefsTrait
             * gitHubBranchDiscovery
             * gitHubPullRequestDiscovery
             * gitHubSshCheckout
             * gitHubTagDiscovery

            Missing:
             * gitHubForkDiscovery ← missing, but possible to execute

            I tried:
             1)
            {code:java}
            gitHubForkDiscovery {
                strategyId(1)
                trust('trustPermission')
            }
            {code}
            {noformat}
            ERROR: (unknown source) No signature of method: javaposse.jobdsl.plugin.structs.DescribableContext.trust() is applicable for argument types: (java.lang.String) values: [trustPermission]
            Possible solutions: getAt(java.lang.String), print(java.io.PrintWriter), use([Ljava.lang.Object;), print(java.lang.Object), wait(), dump()
            {noformat}
            2)
            {code:java}
            gitHubForkDiscovery {
                strategyId(1)
                trust(gitHubTrustPermissions)
            }
            {code}
            {noformat}
            ERROR: (MultibranchJobFactory.groovy, line 89) No such property: gitHubTrustPermissions for class: javaposse.jobdsl.plugin.structs.DescribableContext
            {noformat}
            3)
            {code:java}
            gitHubForkDiscovery {
                strategyId(1)
                trust(gitHubTrustPermissions())
            }
            {code}
            {noformat}
            ERROR: (unknown source) No signature of method: javaposse.jobdsl.plugin.structs.DescribableContext.gitHubTrustPermissions() is applicable for argument types: () values: []
            {noformat}
            4)
            {code:java}
            gitHubForkDiscovery {
                strategyId(1)
                trust {
                    gitHubTrustPermissions()
                }
            }
            {code}
            {noformat}
            ERROR: (unknown source) No signature of method: javaposse.jobdsl.plugin.structs.DescribableContext.gitHubTrustPermissions() is applicable for argument types: () values: []
            {noformat}
            5)
            {code:java}
            gitHubForkDiscovery {
                strategyId(1)
                trust(Class.forName('org.jenkinsci.plugins.github_branch_source.ForkPullRequestDiscoveryTrait$TrustPermission', true, Jenkins.get().pluginManager.uberClassLoader).getDeclaredConstructor().newInstance())
            }
            {code}
            {noformat}
            ERROR: (unknown source) No signature of method: javaposse.jobdsl.plugin.structs.DescribableContext.trust() is applicable for argument types: (org.jenkinsci.plugins.github_branch_source.ForkPullRequestDiscoveryTrait$TrustPermission) values: [org.jenkinsci.plugins.github_branch_source.ForkPullRequestDiscoveryTrait$TrustPermission@3a41ed6e]
            Possible solutions: print(java.io.PrintWriter), use([Ljava.lang.Object;), print(java.lang.Object), wait(), dump(), grep()
            {noformat}
            agabrys Adam Gabryś made changes -
            Link This issue is related to JENKINS-26535 [ JENKINS-26535 ]
            agabrys Adam Gabryś made changes -
            Link This issue is related to JENKINS-26535 [ JENKINS-26535 ]
            agabrys Adam Gabryś made changes -
            Link This issue is blocked by JENKINS-26535 [ JENKINS-26535 ]
            agabrys Adam Gabryś made changes -
            Link This issue is related to JENKINS-61119 [ JENKINS-61119 ]
            bitwiseman Liam Newman made changes -
            Released As github-branch-source-2.4.5
            Resolution Fixed [ 1 ]
            Status Open [ 1 ] Closed [ 6 ]
            agabrys Adam Gabryś made changes -
            Resolution Fixed [ 1 ]
            Status Closed [ 6 ] Reopened [ 4 ]

              People

              Assignee:
              daspilker Daniel Spilker
              Reporter:
              agabrys Adam Gabryś
              Votes:
              3 Vote for this issue
              Watchers:
              5 Start watching this issue

                Dates

                Created:
                Updated: