engine: Create verify jobs for openstack stack
[infra/cicd.git] / jjb / engine / scripts / generate-ssh-keypair.sh
index 04633fd248e9858ab0ff6fd8279e233132317fac..00f8336a5ad1513ac0a95793159e2e0ea69a5d04 100755 (executable)
@@ -22,6 +22,8 @@ set -o nounset
 set -o errexit
 set -o pipefail
 
-echo "Info  : Generating SSH keypair for the job"
-ssh-keygen -q -t rsa -f ~/.ssh/id_rsa -N '' <<< y > /dev/null 2>&1
-chmod -R go-rwx ~/.ssh
+if [[ ! -f "$HOME/.ssh/id_rsa" ]]; then
+  echo "Info  : Generating SSH keypair for the job"
+  ssh-keygen -q -t rsa -f ~/.ssh/id_rsa -N '' <<< y > /dev/null 2>&1
+  chmod -R go-rwx ~/.ssh
+fi