Skip to content

Instantly share code, notes, and snippets.

@ianibo
Created June 26, 2019 15:36
Show Gist options
  • Save ianibo/fdc719f8c9f09d9c924daa47c6ddf95f to your computer and use it in GitHub Desktop.
Save ianibo/fdc719f8c9f09d9c924daa47c6ddf95f to your computer and use it in GitHub Desktop.
Script in jenkins to deploy via ssh
Set up credentials, then use jenkins bindings/SSH User Key File and put SSHKEYFILE in env var
echo BUILD STEP
export HOST_IP=`/sbin/ip route|awk '/default/ { print $3 }'`
echo SSH KEYFILE is "$SSHKEYFILE"
/sbin/ip route
cat "$SSHKEYFILE"
echo Host IP is $HOST_IP - ssh the war file there and deploy it
ssh -v -o StrictHostKeyChecking=no -i "$SSHKEYFILE" kbpluslive@$HOST_IP "/..../deploy.sh"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment