title: groovy.lang.ReadOnlyPropertyException for Sonar Qube WaitForQualityGate Step
body: <p>While running a <strong>multi-branch pipeline job</strong> in Jenkins with <code>waitForQualityGate()</code> step, Jenkins throws <code>groovy.lang.ReadOnlyPropertyException: Cannot set readonly property: status for class: org.sonarsource.scanner.jenkins.pipeline.WaitForQualityGateStep$QGStatus</code> error.
  <code>waitForQualityGate()</code> works fine with normal pipeline project run with <code>Use Groovy Sandbox</code> option checked.</p>
  
  <p>below is the code used to run <code>waitForQualityGate()</code> along with Sonar Scanner for MSBuild.</p>
  
  <pre><code>void endSonarMSBuild() {
  if (env.BRANCH_NAME == 'develop') {
      stage('Complete SonarQube Analysis') {
          withSonarQubeEnv('civil sonar') {
              def MSBuildScannerHome = tool 'sonar-scanner-msbuild-3.0.0.629';
              bat "${MSBuildScannerHome}\\SonarQube.Scanner.MSBuild.exe end"
          }
      }
      stage("Quality Gate") {
          timeout(time: 1, unit: 'MINUTES') {
              def qg = waitForQualityGate()
              if ((qg.status = 'ERROR')) {
                  error "Pipeline aborted due to quality gate failure"
              }
          }
      }
  } else {
      echo "Skipping stage since the current branch is: ${env.BRANCH_NAME}"
  }
  }
  </code></pre>
  
  <p>The same code works in normal pipeline job but not in Multi-Branch Pipeline job. Any help is appreciated.</p>
  
  <p>The full Jenkins error log is as below:</p>
  
  <pre><code>groovy.lang.ReadOnlyPropertyException: Cannot set readonly property: status for class: org.sonarsource.scanner.jenkins.pipeline.WaitForQualityGateStep$QGStatus
  at groovy.lang.MetaClassImpl.setProperty(MetaClassImpl.java:2744)
  at groovy.lang.MetaClassImpl.setProperty(MetaClassImpl.java:3770)
  at org.codehaus.groovy.runtime.InvokerHelper.setProperty(InvokerHelper.java:201)
  at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.setProperty(ScriptBytecodeAdapter.java:484)
  at org.kohsuke.groovy.sandbox.impl.Checker$5.call(Checker.java:300)
  at org.kohsuke.groovy.sandbox.GroovyInterceptor.onSetProperty(GroovyInterceptor.java:68)
  at org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.SandboxInterceptor.onSetProperty(SandboxInterceptor.java:182)
  at org.kohsuke.groovy.sandbox.impl.Checker$5.call(Checker.java:297)
  at org.kohsuke.groovy.sandbox.impl.Checker.checkedSetProperty(Checker.java:294)
  at com.cloudbees.groovy.cps.sandbox.SandboxInvoker.setProperty(SandboxInvoker.java:32)
  at com.cloudbees.groovy.cps.impl.PropertyAccessBlock.rawSet(PropertyAccessBlock.java:24)
  at WorkflowScript.endSonarMSBuild(WorkflowScript:177)
  at ___cps.transform___(Native Method)
  at com.cloudbees.groovy.cps.impl.PropertyishBlock$ContinuationImpl.set(PropertyishBlock.java:88)
  at com.cloudbees.groovy.cps.impl.AssignmentBlock$ContinuationImpl.assignAndDone(AssignmentBlock.java:70)
  at sun.reflect.GeneratedMethodAccessor718.invoke(Unknown Source)
  at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
  at java.lang.reflect.Method.invoke(Method.java:498)
  at com.cloudbees.groovy.cps.impl.ContinuationPtr$ContinuationImpl.receive(ContinuationPtr.java:72)
  at com.cloudbees.groovy.cps.impl.ConstantBlock.eval(ConstantBlock.java:21)
  at com.cloudbees.groovy.cps.Next.step(Next.java:74)
  at com.cloudbees.groovy.cps.Continuable.run0(Continuable.java:154)
  at org.jenkinsci.plugins.workflow.cps.SandboxContinuable.access$001(SandboxContinuable.java:18)
  at org.jenkinsci.plugins.workflow.cps.SandboxContinuable$1.call(SandboxContinuable.java:33)
  at org.jenkinsci.plugins.workflow.cps.SandboxContinuable$1.call(SandboxContinuable.java:30)
  at org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.GroovySandbox.runInSandbox(GroovySandbox.java:108)
  at org.jenkinsci.plugins.workflow.cps.SandboxContinuable.run0(SandboxContinuable.java:30)
  at org.jenkinsci.plugins.workflow.cps.CpsThread.runNextChunk(CpsThread.java:165)
  at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.run(CpsThreadGroup.java:330)
  at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.access$100(CpsThreadGroup.java:82)
  at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup$2.call(CpsThreadGroup.java:242)
  at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup$2.call(CpsThreadGroup.java:230)
  at org.jenkinsci.plugins.workflow.cps.CpsVmExecutorService$2.call(CpsVmExecutorService.java:64)
  at java.util.concurrent.FutureTask.run(FutureTask.java:266)
  at hudson.remoting.SingleLaneExecutorService$1.run(SingleLaneExecutorService.java:112)
  at jenkins.util.ContextResettingExecutorService$1.run(ContextResettingExecutorService.java:28)
  at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
  at java.util.concurrent.FutureTask.run(FutureTask.java:266)
  at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
  at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
  at java.lang.Thread.run(Thread.java:745)
  </code></pre>