Forked from int128/gist:14255ff1b1ed11ce1f661a7d35954c2b
Created
May 1, 2018 01:40
-
-
Save lepffm/a538f4db9186e73a1e46165b6e38abc9 to your computer and use it in GitHub Desktop.
How to execute a remote command on the Jenkins Script Console
This file contains hidden or 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
import hudson.util.RemotingDiagnostics; | |
def node = 'node-name' | |
def command = 'uname -a' | |
println RemotingDiagnostics.executeGroovy(""" | |
def p = '$command'.execute() | |
p.waitFor() | |
println p.in.text | |
""", Jenkins.instance.slaves.find { it.name == node }.channel) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment