[JIRA] (JENKINS-53912) Unable to use SSHCheckoutTrait

18 views
Skip to first unread message

markus@markusheiden.de (JIRA)

unread,
Oct 4, 2018, 12:34:02 PM10/4/18
to jenkinsc...@googlegroups.com
Markus Heiden created an issue
 
Jenkins / Bug JENKINS-53912
Unable to use SSHCheckoutTrait
Issue Type: Bug Bug
Assignee: Unassigned
Components: github-branch-source-plugin
Created: 2018-10-04 16:33
Environment: Jenkins 2.144
Priority: Major Major
Reporter: Markus Heiden

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]]

 

Add Comment Add Comment
 
This message was sent by Atlassian Jira (v7.11.2#711002-sha1:fdc329d)

stephen.alan.connolly@gmail.com (JIRA)

unread,
Oct 31, 2018, 5:24:02 AM10/31/18
to jenkinsc...@googlegroups.com
Stephen Connolly updated an issue
Change By: Stephen Connolly
Component/s: configuration-as-code-plugin

timo.sand@iki.fi (JIRA)

unread,
Jun 18, 2019, 7:36:02 AM6/18/19
to jenkinsc...@googlegroups.com
Timo Sand commented on Bug JENKINS-53912
 
Re: Unable to use SSHCheckoutTrait

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

bitwiseman@gmail.com (JIRA)

unread,
Jun 18, 2019, 11:47:04 AM6/18/19
to jenkinsc...@googlegroups.com

The code above is in jobDSL, correct?

bitwiseman@gmail.com (JIRA)

unread,
Jun 18, 2019, 11:47:05 AM6/18/19
to jenkinsc...@googlegroups.com
Liam Newman updated an issue
Change By: Liam Newman
{{ 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]]



 

bitwiseman@gmail.com (JIRA)

unread,
Jun 18, 2019, 11:50:01 AM6/18/19
to jenkinsc...@googlegroups.com
Liam Newman updated an issue

{ { 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]]



 

timo.sand@iki.fi (JIRA)

unread,
Jun 18, 2019, 4:53:02 PM6/18/19
to jenkinsc...@googlegroups.com

timo.sand@iki.fi (JIRA)

unread,
Jun 19, 2019, 10:37:03 AM6/19/19
to jenkinsc...@googlegroups.com
Timo Sand edited a comment on Bug JENKINS-53912
[~bitwiseman] The same issue with trying to use \
{ { code:java}
originPullRequestDiscoveryTrait
{code
}
}

timo.sand@iki.fi (JIRA)

unread,
Jun 19, 2019, 10:37:03 AM6/19/19
to jenkinsc...@googlegroups.com

Liam Newman The same issue with trying to use {

{ originPullRequestDiscoveryTrait }

}

timo.sand@iki.fi (JIRA)

unread,
Jun 20, 2019, 4:14:02 AM6/20/19
to jenkinsc...@googlegroups.com

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
    }
  }
}

bitwiseman@gmail.com (JIRA)

unread,
Jun 24, 2019, 6:39:03 PM6/24/19
to jenkinsc...@googlegroups.com

Timo Sand

Yeah, JobDSL always has the configure block option. I agree it is ugly but in the short term it give you a work around (you could wrap that in method call and put it in a library to make it look cleaner).

This sounds like something that would be better to fix/enhance in the JobDSL plugin. Maybe it could detect this from context? In the DSL,

{sshCheckoutTrait}

is a descendant of

{github}

, the package for which is

{org.jenkinsci.plugins.github_branch_source}

. If there a trait in the same package, it would seem reasonable to choose it instead of failing. Then all the branch source plugins would be fixed in one shot.

Of course, I don't know enough about the JobDSL plugin to know if that would be difficult.

bitwiseman@gmail.com (JIRA)

unread,
Aug 8, 2019, 7:10:03 PM8/8/19
to jenkinsc...@googlegroups.com
Change By: Liam Newman
Status: In Progress Fixed but Unreleased
Resolution: Fixed

bitwiseman@gmail.com (JIRA)

unread,
Aug 8, 2019, 7:10:03 PM8/8/19
to jenkinsc...@googlegroups.com
Liam Newman started work on Bug JENKINS-53912
 
Change By: Liam Newman
Status: Open In Progress
Reply all
Reply to author
Forward
0 new messages