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

Support for ssh keys in Stash Pull Request Plugin

    XMLWordPrintable

    Details

    • Similar Issues:

      Description

      As a user I would like to have possibility to use ssh credentials in Stash Pull Rquest plugin.

      Currently, when user selects ssh credentials in job configuration (check screen), below exception occurs.

      java.lang.NullPointerException
      	at stashpullrequestbuilder.stashpullrequestbuilder.StashBuildTrigger.getUsername(StashBuildTrigger.java:118)
      	at stashpullrequestbuilder.stashpullrequestbuilder.StashRepository.init(StashRepository.java:62)
      	at stashpullrequestbuilder.stashpullrequestbuilder.StashPullRequestsBuilder.run(StashPullRequestsBuilder.java:31)
      	at stashpullrequestbuilder.stashpullrequestbuilder.StashBuildTrigger.run(StashBuildTrigger.java:223)
      	at hudson.triggers.Trigger.checkTriggers(Trigger.java:273)
      	at hudson.triggers.Trigger$Cron.doRun(Trigger.java:222)
      	at hudson.triggers.SafeTimerTask.run(SafeTimerTask.java:50)
      	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
      	at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308)
      	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180)
      	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294)
      	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
      	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
      	at java.lang.Thread.run(Thread.java:745)
      

        Attachments

          Issue Links

            Activity

            Hide
            srinath_ragh Srinath Raghavan added a comment -

            +1

            Show
            srinath_ragh Srinath Raghavan added a comment - +1
            Hide
            stephenconnolly Stephen Connolly added a comment -

            There is a bug in how the stash pull request builder plugin populates the drop-down list of credentials. https://github.com/jenkinsci/stash-pullrequest-builder-plugin/pull/18 will fix that bug so that only UsernamePassword credentials are available from the drop down.

            I agree that it would be really nice if SSH keys could be used to authenticate against the Stash REST API in order to fetch the required pull request information... however in the absence of Stash actually supporting the use of SSH keys to authenticate a HTTPS REST request I suspect that there is almost nothing that this plugin can do to further this desire.

            Show
            stephenconnolly Stephen Connolly added a comment - There is a bug in how the stash pull request builder plugin populates the drop-down list of credentials. https://github.com/jenkinsci/stash-pullrequest-builder-plugin/pull/18 will fix that bug so that only UsernamePassword credentials are available from the drop down. I agree that it would be really nice if SSH keys could be used to authenticate against the Stash REST API in order to fetch the required pull request information... however in the absence of Stash actually supporting the use of SSH keys to authenticate a HTTPS REST request I suspect that there is almost nothing that this plugin can do to further this desire.
            Hide
            scm_issue_link SCM/JIRA link daemon added a comment -

            Code changed in jenkins
            User: Stephen Connolly
            Path:
            pom.xml
            src/main/java/stashpullrequestbuilder/stashpullrequestbuilder/StashBuildTrigger.java
            http://jenkins-ci.org/commit/stash-pullrequest-builder-plugin/b27cc5d3fd043905a4683f63e668c8fd76cf6a96
            Log:
            JENKINS-37468 Only offer valid credentials in the credentials drop down.

            • There was a mismatch between the dropdown list and the credentials lookup. As only username password credentials are supported, only those should be listed
            • Use Task.getDefaultAuthenticationOf(job) to ensure that the drop-down and lookup respects the authorize-project plugin
            • Use CredentialsProvider.listCredentials based lookups for drop-down selection to ensure that dynamic credentials providers are not forced to retrieve the password where it is not required.
            Show
            scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Stephen Connolly Path: pom.xml src/main/java/stashpullrequestbuilder/stashpullrequestbuilder/StashBuildTrigger.java http://jenkins-ci.org/commit/stash-pullrequest-builder-plugin/b27cc5d3fd043905a4683f63e668c8fd76cf6a96 Log: JENKINS-37468 Only offer valid credentials in the credentials drop down. There was a mismatch between the dropdown list and the credentials lookup. As only username password credentials are supported, only those should be listed Use Task.getDefaultAuthenticationOf(job) to ensure that the drop-down and lookup respects the authorize-project plugin Use CredentialsProvider.listCredentials based lookups for drop-down selection to ensure that dynamic credentials providers are not forced to retrieve the password where it is not required.
            Hide
            nickbrown Nicholas Brown added a comment -

            https://github.com/jenkinsci/stash-pullrequest-builder-plugin/pull/18 has been merged, that should block selecting ssh keys as Stash does not support them.

            Show
            nickbrown Nicholas Brown added a comment - https://github.com/jenkinsci/stash-pullrequest-builder-plugin/pull/18 has been merged, that should block selecting ssh keys as Stash does not support them.
            Hide
            nickbrown Nicholas Brown added a comment -

            This requires upstream Stash to support ssh keys, there is nothing the Jenkins plugin can do about this.

            Show
            nickbrown Nicholas Brown added a comment - This requires upstream Stash to support ssh keys, there is nothing the Jenkins plugin can do about this.

              People

              Assignee:
              nemccarthy nathan m
              Reporter:
              mzielinski Maciej Zielinski
              Votes:
              1 Vote for this issue
              Watchers:
              6 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: