Skip to content

Instantly share code, notes, and snippets.

@mizanRahman
Created January 27, 2016 17:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save mizanRahman/7b6c1fa77498974db045 to your computer and use it in GitHub Desktop.
Save mizanRahman/7b6c1fa77498974db045 to your computer and use it in GitHub Desktop.
ssh remote deploy with gradle
buildscript {
repositories {
maven {
url "https://plugins.gradle.org/m2/"
}
}
dependencies {
classpath "org.hidetake:gradle-ssh-plugin:1.1.4"
}
}
apply plugin: "org.hidetake.ssh"
apply plugin: "war"
remotes {
localhost {
host = 'localhost'
user = System.properties['user.name']
identity = file("${System.properties['user.home']}/.ssh/id_rsa")
}
vbox {
host = '192.168.99.100'
user = remoteHostUser
println(user)
identity = file("${System.properties['user.home']}/.ssh/id_rsa")
}
}
task showPlatformVersion {
println("showing platforms")
ssh.run {
session(remotes.vbox) {
execute 'uname -a'
execute 'cat /etc/*-release', ignoreError: true
}
}
}
task deploy(dependsOn: war) {
ssh.run {
session(remotes.vbox) {
//put from: 'build/libs/*.war', into: '/root/home'
execute './script.sh'
}
}
}
remoteHostUser = root
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment