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

Could not find a suitable ssh-agent provider.




      Getting the following exception when attempt to run a job with the ssh-agent plugin enabled:

        Started by user anonymous
        Building in workspace C:\Program Files (x86)\Jenkins\jobs\SmartPhone\workspace
        [ssh-agent] Using credentials id_rsa_smartphone (Smartphone Repo on GitHub)
        [ssh-agent] Looking for ssh-agent implementation...
        [ssh-agent] FATAL: Could not find a suitable ssh-agent provider
        [ssh-agent] Diagnostic report
        FATAL: [ssh-agent] Unable to start agent
        hudson.util.IOException2: [ssh-agent] Unable to start agent
        	at com.cloudbees.jenkins.plugins.sshagent.SSHAgentBuildWrapper.createSSHAgentEnvironment(SSHAgentBuildWrapper.java:231)
        	at com.cloudbees.jenkins.plugins.sshagent.SSHAgentBuildWrapper.preCheckout(SSHAgentBuildWrapper.java:189)
        	at jenkins.scm.SCMCheckoutStrategy.preCheckout(SCMCheckoutStrategy.java:76)
        	at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:530)
        	at hudson.model.Run.execute(Run.java:1741)
        	at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
        	at hudson.model.ResourceController.execute(ResourceController.java:98)
        	at hudson.model.Executor.run(Executor.java:374)
        Caused by: java.lang.RuntimeException: [ssh-agent] Could not find a suitable ssh-agent provider.
        	at com.cloudbees.jenkins.plugins.sshagent.SSHAgentBuildWrapper$SSHAgentEnvironment.<init>(SSHAgentBuildWrapper.java:332)
        	at com.cloudbees.jenkins.plugins.sshagent.SSHAgentBuildWrapper.createSSHAgentEnvironment(SSHAgentBuildWrapper.java:224)
        	... 7 more
        Finished: FAILURE

      I'm not a Java developer but It appears that the code is attempting to get implementors of RemoteAgentFactory. From what I can tell, there are two - MinaRemoteAgentFactory and JNRRemoteAgentFactory. However, it doesn't appear to find either of these two because of the FATAL: Could not find a suitable ssh-agent provider message that it emits. If it did find MinaRemoteAgentFactory, the MinaRemoteAgentFactory.isSupported() function would either return true or log the Could not find Tomcat Native library message.

      I'm not positive that I have the Tomcat native library installed correctly but it appears that it is not even getting to the point where it's checking for the existence of the library. When I installed Tomcat on Windows, I selected the option to include the native library. In the Tomcat logs, it indicates that the native library is being used.



          ronrat Ron Ratzlaff created issue -
          rtyler R. Tyler Croy made changes -
          Field Original Value New Value
          Workflow JNJira [ 163113 ] JNJira + In-Review [ 181104 ]
          xtimon Timur Isanov made changes -
          Comment [ For me it works only with adding tcnative libraries with not embedded OpenSSH:

          # JDK Installation with tcnative:
          choco install corretto8jdk --version
          $url = "https://apache.mirror.digionline.de/tomcat/tomcat-connectors/native/1.2.24/binaries/tomcat-native-1.2.24-openssl-1.1.1g-win32-bin.zip"
          $output = "C:\ProgramData\tomcat-native.zip"
          $folder = "C:\ProgramData\tomcat-native"
          Invoke-WebRequest -Uri $url -OutFile $outputExpand-Archive -Path $output -DestinationPath $folder
          cp "$folder\bin\x64\tcnative-1.dll" "C:\Program Files\Amazon Corretto\jdk1.8.0_252\bin"
          # OpenSSH installation:
          choco install openssh
          And in the Jenkinsfile I specify GIT_SSH_COMMAND environment variable to use not embedded OpenSSH:

          stage('push') {
            steps {
              sshagent(['test']) {
                withEnv(['GIT_SSH_COMMAND="C:/Program Files/OpenSSH-Win64/ssh.exe"']) {
                  bat 'git push'
          {code} ]
          alecharp Adrien Lecharpentier made changes -
          Resolution Won't Fix [ 2 ]
          Status Open [ 1 ] Closed [ 6 ]


            Unassigned Unassigned
            ronrat Ron Ratzlaff
            8 Vote for this issue
            13 Start watching this issue