title: How to retrieve value from LinkedHashMap using variables?
body: <p>I would like to create variable which allows me to access to vary YAML structures.</p>
  
  <p>envFile is the YAML file contains data like:</p>
  
  <pre><code>ENVNAME:
    MYSYS:
      MYSUBSYS:
        MYDETAIL:
          version: 1.0.0
          path: C:\wwwroot\sys
    MYSYS2:
      MYSUBSYS2:
        version: 1.0.1
        path: C:\wwwroot\sys2
  </code></pre>
  
  <p>Important is that MYSYS2 doesn't have MYDETAIL level</p>
  
  <p>In Jenkins pipeline I'm using:</p>
  
  <pre><code>envs = readYaml file: envFile
  </code></pre>
  
  <p>Then I can get version value using:</p>
  
  <pre><code>verNum = envs."${environment}"."${sysName}"."${subSysName}"."${detailName}".version
  </code></pre>
  
  <p>But when I want get version for MYSYS2 then I should use (no detailName):</p>
  
  <pre><code>verNum = envs."${environment}"."${sysName}"."${subSysName}".version
  </code></pre>
  
  <p>So I need variable depends on sysName..</p>
  
  <p>I would like to use syntax like:</p>
  
  <pre><code>if (sysName == 'MYSYS'){
    mySuperVariable = "${environment}"."${sysName}"."${subSysName}"."${detailName}"
  }
  else if (sysName == 'MYSYS2'){
    mySuperVariable = "${environment}"."${sysName}"."${subSysName}"
  }
  
  (...)
  
  sysVer = envs."${mySuperVariable}".version
  </code></pre>