branchSources {
         branchSource {
           source {
             github {
               ...
               traits {
                 sshCheckoutTrait {
                   credentialsId(CHECKOUT_SSH_CREDENTIALS_ID)            
                }
              }
             }
           }
         }
       }
      

      Leads to:

      Found multiple extensions which provide method sshCheckoutTrait with arguments [test_seed$_run_closure1$_closure2$_closure3$_closure4$_closure5$_closure6$_closure7@47c1791b]: [[com.cloudbees.jenkins.plugins.bitbucket.SSHCheckoutTrait, org.jenkinsci.plugins.github_branch_source.SSHCheckoutTrait]]

       

          [JENKINS-53912] Unable to use SSHCheckoutTrait

          Markus Heiden created issue -
          Stephen Connolly made changes -
          Component/s New: configuration-as-code-plugin [ 23170 ]

          Timo Sand added a comment -

          I have the same issue, any knowledge of how to circumvent?

          Timo Sand added a comment - I have the same issue, any knowledge of how to circumvent?

          Liam Newman added a comment -

          The code above is in jobDSL, correct?

          Liam Newman added a comment - The code above is in jobDSL, correct?
          Liam Newman made changes -
          Description Original: branchSources {
             branchSource {
               source {
                 github {
                   ...
                   traits {
                   sshCheckoutTrait {
                       credentialsId(CHECKOUT_SSH_CREDENTIALS_ID)            
                     }
                  }
                 }
               }
             }
          }  

          Leads to:

          Found multiple extensions which provide method sshCheckoutTrait with arguments [test_seed$_run_closure1$_closure2$_closure3$_closure4$_closure5$_closure6$_closure7@47c1791b]: [[com.cloudbees.jenkins.plugins.bitbucket.SSHCheckoutTrait, org.jenkinsci.plugins.github_branch_source.SSHCheckoutTrait]]



           
          New: {{branchSources {
             branchSource {
               source {
                 github {
                   ...
                   traits {
                   sshCheckoutTrait {
                       credentialsId(CHECKOUT_SSH_CREDENTIALS_ID)            
                     }
                  }
                 }
               }
             }
          }  }}

          Leads to:

          Found multiple extensions which provide method sshCheckoutTrait with arguments [test_seed$_run_closure1$_closure2$_closure3$_closure4$_closure5$_closure6$_closure7@47c1791b]: [[com.cloudbees.jenkins.plugins.bitbucket.SSHCheckoutTrait, org.jenkinsci.plugins.github_branch_source.SSHCheckoutTrait]]



           
          Liam Newman made changes -
          Description Original: {{branchSources {
             branchSource {
               source {
                 github {
                   ...
                   traits {
                   sshCheckoutTrait {
                       credentialsId(CHECKOUT_SSH_CREDENTIALS_ID)            
                     }
                  }
                 }
               }
             }
          }  }}

          Leads to:

          Found multiple extensions which provide method sshCheckoutTrait with arguments [test_seed$_run_closure1$_closure2$_closure3$_closure4$_closure5$_closure6$_closure7@47c1791b]: [[com.cloudbees.jenkins.plugins.bitbucket.SSHCheckoutTrait, org.jenkinsci.plugins.github_branch_source.SSHCheckoutTrait]]



           
          New:
          {code:groovy}
          branchSources {
             branchSource {
               source {
                 github {
                   ...
                   traits {
                     sshCheckoutTrait {
                       credentialsId(CHECKOUT_SSH_CREDENTIALS_ID)            
                    }
                  }
                 }
               }
             }
           }
          {code}


          Leads to:

          Found multiple extensions which provide method sshCheckoutTrait with arguments [test_seed$_run_closure1$_closure2$_closure3$_closure4$_closure5$_closure6$_closure7@47c1791b]: [[com.cloudbees.jenkins.plugins.bitbucket.SSHCheckoutTrait, org.jenkinsci.plugins.github_branch_source.SSHCheckoutTrait]]

           
          Liam Newman made changes -
          Remote Link New: This issue links to "github-branch-source PR #228 (Web Link)" [ 23119 ]

          Timo Sand added a comment -

          Timo Sand added a comment - bitwiseman Yes

          Timo Sand added a comment - - edited

          bitwiseman The same issue with trying to use

          originPullRequestDiscoveryTrait
          

          }

          Timo Sand added a comment - - edited bitwiseman The same issue with trying to use originPullRequestDiscoveryTrait }

          Timo Sand added a comment -

          I found a workaround, but it's Ugly as hell.

           organizationFolder('...') {
            organizations {
              ...
            }
            orphanedItemStrategy {
              ...
            }
            triggers {
              ...
            }
            configure {
              def traits = it / navigators / 'org.jenkinsci.plugins.github__branch__source.GitHubSCMNavigator' / traits
              traits << "org.jenkinsci.plugins.github__branch__source.SSHCheckoutTrait" {
                  credentialsId('...')
              }
              traits << 'org.jenkinsci.plugins.github_branch_source.OriginPullRequestDiscoveryTrait' {
                strategyId 1
              }
            }
          }
          

          Timo Sand added a comment - I found a workaround, but it's Ugly as hell. organizationFolder( '...' ) { organizations { ... } orphanedItemStrategy { ... } triggers { ... } configure { def traits = it / navigators / 'org.jenkinsci.plugins.github__branch__source.GitHubSCMNavigator' / traits traits << "org.jenkinsci.plugins.github__branch__source.SSHCheckoutTrait" { credentialsId( '...' ) } traits << 'org.jenkinsci.plugins.github_branch_source.OriginPullRequestDiscoveryTrait' { strategyId 1 } } }

            Unassigned Unassigned
            markus_heiden Markus Heiden
            Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: