I endup using secrete file auth, with linux ssh agent. Which is not the 
most elegant solution, but it works!!

 public def run_shell_with_credentials(ssh_key_file,cmd) {
    env.RUN_CMD = cmd
    withCredentials([[$class: 'FileBinding', variable: 'PVT_KEY_FILE', 
credentialsId: ssh_key_file]]) {
      sh '''
        chmod 0500 $PVT_KEY_FILE
        env  |grep SIS  
        eval `ssh-agent`
        ssh-add $PVT_KEY_FILE
        $RUN_CMD
        kill -s term $SSH_AGENT_PID
      '''
    }
}

Thanks,
Yasir.

On Thursday, May 7, 2015 at 9:33:11 PM UTC-4, Yasir Saleem wrote:
>
> Hi, 
>
>   I started using workflow plugin for Jenkins (
> https://github.com/jenkinsci/workflow-plugin). I really like it, 
> specially for complex jobs and pipelining the CD workflow. 
>
> We want to use some sort of mechanism to pass ssh credentials to 'sh' step 
> of 'workflow' to slaves the way we normally do using ssh-agent plugin (
> https://wiki.jenkins-ci.org/display/JENKINS/SSH+Agent+Plugin). 
>
> We typically use Swarm slaves to attach to master. ssh keys are only 
> present in Jenkins master, they are passed on to slaves dynamically. This 
> really helps restricting the ssh keys to master only. 
>
> workflow plugin does support credentials for gitSCM or general SCM class. 
> We want same feature for other steps specially 'sh'.
>
>  Is there any workaround or any other means to accomplish same thing?
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/68eec617-e18e-4929-a3f7-f90389d13182%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to