title: Environment Modules (modulefile) integration into Jenkins Pipeline (Groovy)?
body: <p>I am deploying Environment Modules here at my company and would like to make sure that all use models are covered adequately.  Since Groovy is not a supported language by modulecmd.tcl, and tampering with the code base is not an option, I'm wondering what would be simplest way to expose an environment to a Jenkins executor that is based on <code>source $(module load &lt;modulefile&gt;)</code> (BASH)?</p>
  <p>Some possibilities:</p>
  <ol>
  <li>write a translator for stdout of subprocess <code>.../modulecmd.tcl bash &lt;modulefile&gt;</code></li>
  <li>write a translator for stdout of subprocess <code>module load &lt;modulefile&gt; | env</code>; would need to do some diff'ing to support unload</li>
  <li>plugin?</li>
  </ol>
  <p>I've looked at &quot;environment script&quot; and &quot;environment injector&quot; plugins but can't test these w/o upgrading Jenkins (plugins are not compatible).  I got the impression scripts are supported but would have to output in specific format (more code to write).</p>
  <p>Has anyone here been able to integrate Env Modules into a Pipeline, or could give some guidance as to best practice when needing to import an environment that is natively based on sourcing script output that is shell/interpreter specific?</p>