Commit 3a0a3463 authored by Fernando Vazquez's avatar Fernando Vazquez

Testing ssh

parent 4ac13dc8
...@@ -12,9 +12,6 @@ pipeline { ...@@ -12,9 +12,6 @@ pipeline {
NEXUS_CREDENTIAL_ID = "nexus-credentials" NEXUS_CREDENTIAL_ID = "nexus-credentials"
USER = "root" USER = "root"
REMOTE_AGENT = "34.168.252.248" REMOTE_AGENT = "34.168.252.248"
registry = "fe4vazquez/hello-spring"
registryCredential = 'dockerhub_id'
dockerImage = ''
} }
stages { stages {
...@@ -105,8 +102,16 @@ pipeline { ...@@ -105,8 +102,16 @@ pipeline {
} }
stage("Build Docker Image"){ stage("Build Docker Image"){
steps{ steps{
script { sshagent(credentials: ['ssh-cred']){
dockerImage = docker.build registry + ":test" sh '''
whoami
echo $HOME
ls -lah ~/.ssh
[ -d ~/.ssh ] || mkdir ~/.ssh && chmod 0700 ~/.ssh
ssh-keyscan -t rsa,dsa ${REMOTE_AGENT} >> ~/.ssh/known_hosts
ssh ${USER}@${REMOTE_AGENT} "echo hello vm!"
'''
} }
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment