title: Jenkins Pipeline - If/Else Statement with Matrix Name vars
body: <p>I dont know why i cant get this to work but could use some help.</p>
  <p>I have a Jenkins pipeline with a matrix defined, one of the axis is defined as OS for windows or linux.</p>
  <p>In one of my stage's i want to call different things if the OS is linux or windows, but i keep getting an error</p>
  <pre><code>java.lang.NoSuchMethodError: No such DSL method '$' found among steps [ArtifactoryGradleBuild, MavenDescriptorStep, acceptGitLabMR, addEmbeddableBadgeConfiguration, addGitLabMRComment, 
  </code></pre>
  <p>My Matrix is defined like this</p>
  <pre><code>matrix {
      agent { 
          label (&quot;${DUT} &amp;&amp; ${OS}&quot;)
      }
      axes {
          axis {
              name 'BUILD_TYPE'
              values 'Internal'
          }
          axis {
              name 'DUT'
              values 'DUT'
          }
          axis {
              name 'OS'
              values 'windows', 'linux'
          }
      }
  </code></pre>
  <p>And my stage is defined like this</p>
  <pre><code>stage (&quot;Cleaning System&quot;) {
      steps {
          script {
              if (${OS} == 'windows') {
                  stage ('Cleaning Up Windows System') {
                      echo &quot;WINDOWS CLEAN&quot;
                  }
              }
              if (${OS} == 'linux') {
                  stage ('Cleaning Up Linux System') {
                      echo &quot;LINUX CLEAN&quot;
                  }
              }
          }
      }
  }
  </code></pre>
  <p>It seems like it doesnt know the ${var} syntax inside a script block?  Or what am i doing wrong?
  Thanks!</p>