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

SSH-agent not available when checking out perforce workspace

    Details

    • Similar Issues:

      Description

      I connect to perforce via ssh, and have a key prepared for this purpose. The key is loaded in as a credential but when using BOTH ssh-agent-plugin and perforce-plugin, the perforce command fails to sync the workspace with the error:

      [workspace] $ p4 -s client -i
      Caught exception communicating with perforce. TCP receive failed. read: socket: Connection reset by peer
      For Command: p4 -s client -i

      When using ssh-agent-plugin in conjunction with the build step "execute shell", a command "ssh-add -l" lists the expected credentials, and "p4 info" command is able to connect to the server, so the ssh-agent-plugin is doing the right thing in the context of the build step itself, just not the source code checkout portion!

      As a work around, I have added the -i /path/to/key/file option into my p4port. The p4port was something like "rsh:ssh -q my.perforce.host" now it is "rsh:ssh -i ~jenkins/.ssh/key_path -q my.perforce.host". This workaround is successful for now.

      I don't know if this is a problem with perforce or ssh-agent plugin.

        Attachments

          Activity

          Hide
          rpetti Rob Petti added a comment -

          That's for piping data directly to a p4d binary, and should only be used for test environments. I hope it's obvious that this should NOT be used in production, as running more than one p4d at a time can result in database corruption.

          Show
          rpetti Rob Petti added a comment - That's for piping data directly to a p4d binary, and should only be used for test environments. I hope it's obvious that this should NOT be used in production, as running more than one p4d at a time can result in database corruption.
          Hide
          dayoung David Young added a comment - - edited

          Are you sure this isn't supported by perforce? p4port can be an rsh specification. I've found some examples in a changelog that indicate rsh formatted p4ports have been supported for a while. (EDIT: I do believe that our ssh server is configured to force the command p4d, which means this p4port is using ssh as a wrapper to remote execute p4d).

          Maybe this should be fixed by ssh-agent plugin instead? It certainly has been a solved problem for the git plugin: JENKINS-12492

          from http://www.perforce.com/perforce/r10.2/user/relnotes.txt

          Directly Invoking p4d - #2884 * **
          UNIX ONLY. The p4 client program can now directly invoke
          the p4d server program by setting P4PORT to "rsh: p4d -ir
          root". The "rsh:" instructs the client to run the program
          following the :, and the -i flag makes p4d run once with
          its stdin/stdout as the communications pipe. By setting
          P4PORT to "rsh:rsh host cmd" it is possible to invoke a
          server on a remote machine, if "cmd" is either the invocation
          of p4d or a wrapper script which does as much.

          #280361 (Bugs #26753,#41870,#42313) *
          'p4 -p "rsh: p4d -i -r ." passwd < password.txt' now works
          properly on Windows. Additionally, marshalled invocations such as
          'p4 -G login < password.txt' now work properly on Windows.

          #209865 (Bug #35224) *
          P4PORT=rsh: can now handle quoting of spaces on UNIX.
          Use double quotes. For example, the P4CONFIG file can contain:

          P4PORT=rsh: p4d -r "root directory"

          and "root directory" is recognized as a single argument
          (without the quotes). A " can be specified by using "". Note
          that, on Windows, the whole string (after the rsh: ) is passed
          to cmd.exe for handling, and must obey cmd.exe's quoting
          rules.

          Show
          dayoung David Young added a comment - - edited Are you sure this isn't supported by perforce? p4port can be an rsh specification. I've found some examples in a changelog that indicate rsh formatted p4ports have been supported for a while. (EDIT: I do believe that our ssh server is configured to force the command p4d, which means this p4port is using ssh as a wrapper to remote execute p4d). Maybe this should be fixed by ssh-agent plugin instead? It certainly has been a solved problem for the git plugin: JENKINS-12492 from http://www.perforce.com/perforce/r10.2/user/relnotes.txt Directly Invoking p4d - #2884 * ** UNIX ONLY. The p4 client program can now directly invoke the p4d server program by setting P4PORT to "rsh: p4d -ir root ". The "rsh:" instructs the client to run the program following the :, and the -i flag makes p4d run once with its stdin/stdout as the communications pipe. By setting P4PORT to "rsh:rsh host cmd" it is possible to invoke a server on a remote machine, if "cmd" is either the invocation of p4d or a wrapper script which does as much. #280361 (Bugs #26753,#41870,#42313) * 'p4 -p "rsh: p4d -i -r ." passwd < password.txt' now works properly on Windows. Additionally, marshalled invocations such as 'p4 -G login < password.txt' now work properly on Windows. #209865 (Bug #35224) * P4PORT=rsh: can now handle quoting of spaces on UNIX. Use double quotes. For example, the P4CONFIG file can contain: P4PORT=rsh: p4d -r "root directory" and "root directory" is recognized as a single argument (without the quotes). A " can be specified by using "". Note that, on Windows, the whole string (after the rsh: ) is passed to cmd.exe for handling, and must obey cmd.exe's quoting rules.
          Hide
          rpetti Rob Petti added a comment -

          P4PORT needs to be set to your perforce server and port. Whatever it is you are trying to do is not supported by perforce, the perforce-plugin, or the ssh-agent.

          If you believe this should be supported, talk to perforce support, or file a ticket against the p4-plugin and use that instead.

          Show
          rpetti Rob Petti added a comment - P4PORT needs to be set to your perforce server and port. Whatever it is you are trying to do is not supported by perforce, the perforce-plugin, or the ssh-agent. If you believe this should be supported, talk to perforce support, or file a ticket against the p4-plugin and use that instead.

            People

            • Assignee:
              Unassigned
              Reporter:
              dayoung David Young
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: