Update 'Jenkinsfile'
parent
c8f29bcd2d
commit
fc522d35b1
@ -1,13 +1,30 @@
|
|||||||
pipeline {
|
pipeline {
|
||||||
agent any
|
agent any
|
||||||
|
|
||||||
|
environment {
|
||||||
|
SERVER_IP = '192.168.1.82' // Replace with your server IP/hostname
|
||||||
|
SERVER_USER = 'aimo' // Replace with your server username
|
||||||
|
}
|
||||||
|
|
||||||
stages {
|
stages {
|
||||||
stage('Hello') {
|
stage('Test SSH Connection') {
|
||||||
steps {
|
steps {
|
||||||
echo 'Hello World from Jenkins Pipeline!'
|
sshagent(['backend-server-digitaltwin']) { // Use the credential ID you created
|
||||||
sh 'date'
|
sh '''
|
||||||
sh 'pwd'
|
# Test SSH connection
|
||||||
|
ssh -o StrictHostKeyChecking=no ${SERVER_USER}@${SERVER_IP} 'echo "SSH Connection Successful!" && hostname && date'
|
||||||
|
'''
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
post {
|
||||||
|
success {
|
||||||
|
echo 'SSH Connection test completed successfully!'
|
||||||
|
}
|
||||||
|
failure {
|
||||||
|
echo 'SSH Connection test failed!'
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Loading…
Reference in New Issue