Last active
July 23, 2024 12:00
-
-
Save kelvinc1024/7782edac3df63e9d4f4236213fc70696 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sh("mkdir ~/.ssh") | |
withCredentials([sshUserPrivateKey(credentialsId: '1234-abcd-efgh-5678', keyFileVariable: 'SSH_PRIVATE_KEY', passphraseVariable: 'SSH_PASS', usernameVariable: 'SSH_USER')]) { | |
sh("cp $SSH_PRIVATE_KEY ~/.ssh/id_rsa") | |
} | |
sh("chmod 700 ~/.ssh/id_rsa") | |
sh 'ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=~/.ssh/known_hosts -p 7999 [email protected] whoami' | |
sh 'git submodule update --init --recursive' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I know this is ancient, but I find it so weird that you use
sshUserPrivateKey
to make sure the file is obscured, and removed after running the pipelineAnd then you just copy it away 🙃