Skip to content

Instantly share code, notes, and snippets.

@anilnautiyal
Last active July 28, 2020 08:42
Show Gist options
  • Save anilnautiyal/b64e88e59c52a73d2d8957add446c1bd to your computer and use it in GitHub Desktop.
Save anilnautiyal/b64e88e59c52a73d2d8957add446c1bd to your computer and use it in GitHub Desktop.
pipeline {
agent 'any'
options {
skipStagesAfterUnstable()
}
stages {
// Build
stage('BuildMaster') {
steps {
sh """
echo "${env.HOST}"
"""
}
}
// test
stage('test'){
// code for testing
steps {
sh """
echo "${env.HOST}"
"""
}
}
// Deploy
stage('DeployMaster') {
steps {
//deploy steps goes here
sh """
sshpass -p '${env.PASSWORD}' rsync --progress -avz -e "ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -p 22" /var/lib/jenkins/jenkins/workspace/git-training/ ${env.USERNAME}@${env.HOST}:/document-path/
"""
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment