-
-
Save aravinthanpnk/7e2e8c4f18c7799bddd0254e88780629 to your computer and use it in GitHub Desktop.
ssh remote deploy with gradle
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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' | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
remoteHostUser = root |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment