io.github.iuin8.remote is a Gradle plugin designed to simplify deployment pipelines by executing local and remote shell commands.
- High Performance (v2.0.0): Fully compatible with Gradle Configuration Cache. Features lazy property resolution to significantly reduce build times for subsequent executions.
- Generalized YAML Parser: Robust stack-based YAML parser supporting complex nested structures, list-style environment definitions, and intelligent
service_portsremapping. - Production Safety: Smart confirmation prompts for production environments (
prod). - Clean Output: Optimized logging levels for a noise-free console experience.
- Environment Grouping: Tasks are automatically grouped by environment (e.g.,
remote-prod) to prevent list overload. - Zero-Config SSH: Automatic SSH configuration and key management for project isolation.
- Robust Interaction (v2.0.1): Interactive tasks (Arthas/Debug) handle session terminations gracefully, preventing Gradle from crashing on exit.
- Jenkins Integration: Deep integration including user-triggered info and automated build logic.
Using the plugins DSL:
plugins {
id "io.github.iuin8.remote" version "2.0.10"
}Refer to the Gradle Plugin Portal for more details.
Define your configuration in a remote.yml file. You can find examples here:
(See below for detailed configuration in Chinese, or refer to the source code for property definitions)
The plugin supports automatic SSH configuration management, enabling out-of-the-box project-level SSH configurations.
Create an SSH configuration file in your project's plugin configuration directory:
<project-root>/gradle/remote-plugin/.ssh/config
Host cloudflared.fa.internet.company
HostName ssh-fa-ssy-edgeone-cn.iuin888vip.icu
User root
IdentityFile ~/.ssh/id_ed25519_iu
ProxyCommand cloudflared access ssh --hostname %h --protocol quic
When gradle/remote-plugin/.ssh/config exists in your project, the plugin automatically:
-
First Layer: System Configuration Injection
- Adds plugin configuration reference at the beginning of
~/.ssh/config(first time only):
# Auto-generated by Gradle Remote Plugin # DO NOT EDIT THIS BLOCK MANUALLY Include ~/.ssh/gradle/remote-plugin/config - Adds plugin configuration reference at the beginning of
-
Second Layer: Project Configuration Injection
- Adds current project's configuration reference in
~/.ssh/gradle/remote-plugin/config:
# Project: <project-name> # Path: <project-path> Include <project-root>/gradle/remote-plugin/.ssh/config - Adds current project's configuration reference in
~/.ssh/config (System Config)
↓ Include
~/.ssh/gradle/remote-plugin/config (Plugin Managed Config)
↓ Include
├─ project1/gradle/remote-plugin/.ssh/config
├─ project2/gradle/remote-plugin/.ssh/config
└─ projectN/gradle/remote-plugin/.ssh/config
- SSH uses "first-match" principle - stops at the first matching Host
- Don't configure duplicate Host names across different projects'
.ssh/configfiles - When Host name conflicts occur, only the first matched configuration takes effect
- Project configurations have higher priority than subsequent definitions in system config
For secure management of sensitive information (e.g., Jenkins Tokens), the plugin supports:
- Placeholder Substitution: Use
${MY_TOKEN}inremote.yml, and the plugin will automatically resolve it from environment variables or Gradle project properties. - Local Override File: Create
remote-local.ymlin the same directory to override configurations inremote.yml. Highly recommended to add this file to your.gitignore.
remote.yml: Recommended to include in Git for team sharingremote-local.yml: Strongly recommended to add to.gitignorefor secrets.ssh/config: Choose based on your needs- If it contains sensitive information (private hosts, usernames), add to
.gitignore - If it's generic configuration (like bastion hosts), can be version controlled
- If it contains sensitive information (private hosts, usernames), add to
- ✅ Project-level configuration, isolated between projects
- ✅ Automatic injection, no manual system config editing
- ✅ Centralized management, unified maintenance
- ✅ Out-of-the-box, works immediately after cloning