Skip to content

joshuaswan/gradle-ssh-plugin

 
 

Repository files navigation

Gradle SSH Plugin Build Status Gradle Status

Gradle SSH Plugin provides SSH facilities such as command execution or file transfer on Gradle.

Read the document for details, and get the template project for quick start.

Getting Started

Add the plugin into your build script. Check the latest version in releases.

plugins {
  id 'org.hidetake.ssh' version 'x.y.z'
}

Define remote hosts and describe SSH operations in the task.

remotes {
  webServer {
    host = '192.168.1.101'
    user = 'jenkins'
    identity = file('id_ecdsa')
  }
}

task deploy << {
  ssh.run {
    session(remotes.webServer) {
      put 'example.war', '/webapps'
      execute 'sudo service tomcat restart'
    }
  }
}

Contributions

This is an open source software licensed under the Apache License Version 2.0. Feel free to open issues or pull requests.

Development

Gradle SSH Plugin internally uses Groovy SSH library. It depends on JSch.

The document is maintained on the repository of Groovy SSH.

Acceptance Test

We can run acceptance tests to verify behavior of the plugin on Gradle environment.

Prerequisite:

  • SSH service should be available on the remote host given by env var EXT_SSH_HOST
  • SSH service should allow the user given by env var EXT_SSH_USER to login with the private key placed at ~/.ssh/id_ext without passphrase
  • SSH service should accept SFTP subsystem

Run test task.

./gradlew :acceptance-tests:test

Release

Build with JDK 7 for compatibility. Do not build with JDK 8.

Push a versioned tag to GitHub and Travis CI will upload the artifact to Bintray.

About

Gradle SSH Plugin

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Groovy 98.4%
  • Shell 1.6%