Executing bash and groovy commands on a Jenkins node
- Through the Script Console (Manage Jenkins -> Nodes -> Select a node -> Script Console) of the node we can execute groovy script
- Run the bash command ls -la on current directory:
println "ls -la".execute().text
- Run the following command to get the IP address (groovy):
println InetAddress.localHost.canonicalHostName
Note: possibly this requires whitelisting for security via
In-process Script Approval