Created
January 9, 2020 13:06
-
-
Save jozenstar/2c29aef6efe6f76a45c5c03e99a76402 to your computer and use it in GitHub Desktop.
Active Choice Interactive Parameter
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 | |
import jenkins.model.Jenkins | |
String agent_name = 'JENKINS_NODE_NAME' | |
//groovy script you want executed on an agent | |
groovy_script = ''' println(['bash', '-c', 'commands'].execute().text) | |
'''.trim() | |
String result | |
Jenkins.instance.slaves.find { agent -> | |
agent.name == agent_name | |
}.with { agent -> | |
result = RemotingDiagnostics.executeGroovy(groovy_script, agent.channel) | |
} | |
return result.tokenize() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment