Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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
You can’t perform that action at this time.