You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
30 lines
844 B
Groovy
30 lines
844 B
Groovy
pipeline {
|
|
agent any
|
|
|
|
environment {
|
|
SERVER_IP = '192.168.1.82' // Replace with your server IP/hostname
|
|
SERVER_USER = 'aimo' // Replace with your server username
|
|
}
|
|
|
|
stages {
|
|
stage('Test SSH Connection') {
|
|
steps {
|
|
sshagent(['backend-server-digitaltwin']) { // Use the credential ID you created
|
|
sh '''
|
|
# 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!'
|
|
}
|
|
}
|
|
} |