jenkinsci / peass-ci-plugin

Jenkins plugin for peass to support performance measurement in CI
https://plugins.jenkins.io/peass-ci/
GNU Affero General Public License v3.0
4 stars 13 forks source link

Provide ssh-key to clone internal (data)-repos #101

Closed mawHBT closed 2 years ago

mawHBT commented 2 years ago

What feature do you want to see added?

If a repo needs to clone another repo while it is built (e.g. to provide test-data) and needs a ssh-key for it, the key can be provided inside jenkins-pipeline via credetials. After peass cloned the "outer"-repo inside its projectName_fullPeass folder, building it is not possible, because the ssh-key for cloning the "inner"-repo (e.g. test-data) is not available anymore. The ssh-key provided in the pipeline should be securely passed on to be still available for the peass-call to build the "outer"-repo, using the passed ssh-key to clone the "inner"-repo.

Upstream changes

No response

mawHBT commented 2 years ago

ssh-Key must be provided by setting GIT_SSH environment-variable in your pipeline:

withCredentials([sshUserPrivateKey(credentialsId: '123', keyFileVariable: 'SSH_KEY')]){ 
                        withEnv(["GIT_SSH=Path/to/ssh-git-command.sh"]) {                                    
            }
}

ssh-git-command.sh:

#!/bin/bash
ssh -i $SSH_KEY $@