title: Access managed files, local files and remote files ssh during Jenkins pre-build stages
body: <p>I have a parametrized build and I'd like to populate parameter values based on contents of files/directories on the local slave and/or on a remote box accessible via ssh.</p>
  
  <p>It's not a problem to access local and remote files during build stages, but I need to make it work in an Active Choice Plugin (or something similar).</p>
  
  <p>Apparently, sh function doesn't work, but some Java-like Groovy API is still available (as described here: <a href="https://wiki.jenkins.io/display/JENKINS/Active+Choices+Plugin" rel="nofollow noreferrer">https://wiki.jenkins.io/display/JENKINS/Active+Choices+Plugin</a>)</p>
  
  <pre><code>jenkinsURL=jenkins.model.Jenkins.instance.getRootUrl()
  
  def propFile=vPropFile //name of properties file
  def propKey=vPropKey // name of properties key
  def relPropFileUrl=vRelPropFileUrl // userContent/properties/
  def propAddress="${jenkinsURL}${relPropFileUrl}$propFile"
  def props= new Properties()
  props.load(new URL(propAddress).openStream())
  def choices=[]
  
  props.get(propKey.toString()).split(",").each{
      choices.add(it)
  }
  
  return choices
  </code></pre>
  
  <p>I wonder if it's possible to access managed files the same way or better yet to access something remotely using SSH.</p>
  
  <p>Is there an API for that?</p>