SSH key forwarding into docker container pipeline

67 views
Skip to first unread message

Lorem Ipsum

unread,
Jan 23, 2018, 4:41:09 PM1/23/18
to Jenkins Users
Hello

I'm trying to build a project which Makefile pulls modules from a private repository. How should I forward the SSH key from Jenkins to the docker container?

The pipeline which creates the build is pretty very basic but it fails on checkout: 

pipeline {
    agent
{ dockerfile true }
    stages
{
        stage
('Build'){
            steps
{
                sh
'make'
           
}
       
}
   
}
}

I assume that similar problem will occur for known_hosts entry for the git repo. Are there any best practices for this? 
Message has been deleted

Lorem Ipsum

unread,
Jan 23, 2018, 4:55:50 PM1/23/18
to Jenkins Users
I've tried modifying the Jenkinsfile to the following: 


pipeline {
    agent 
{ dockerfile true }
    stages 
{
        stage
('Build'){
            steps 
{

                sshagent
(['d288a45e-5b02-4aac-839b-d87cc3a854d0']) {
                    sh 
'make'
                
}
            
}
        
}
    
}
}

But the checkout fails with the following error:

No user exists for uid 112
fatal
: Could not read from remote repository.

Should I specially prepare the docker for Jenkins to use?
Reply all
Reply to author
Forward
0 new messages