title: Jenkinsfile Compare variable
body: <p>I have a Jenkinsfile where I would like to compare two variables in expression. Say my target should have v1 and v2 the identical value, the step should be skipped, but both variables don't have the identical value, jenkins should cancel the job.</p>
  
  <p>My stage for it looks like this at the moment. Unfortunately, jenkins overrides this step even if both variable ones have different values.</p>
  
  <pre><code>stage('Compare') {
    when {
      expression { myVar = myVar2}
    }
    steps {
      exit 
    }
  }
  </code></pre>