[JIRA] (JENKINS-35352) unclassified field org.jenkinsci.plugins.workflow.support.steps.build.RunWrapper result when trying to call setResult on wrong type
Title: Message Title Andrew Bayer updated an issue Jenkins / JENKINS-35352 unclassified field org.jenkinsci.plugins.workflow.support.steps.build.RunWrapper result when trying to call setResult on wrong type Change By: Andrew Bayer Labels: diagnostics pipeline triaged-2018-11 Add Comment This message was sent by Atlassian Jira (v7.11.2#711002-sha1:fdc329d) -- You received this message because you are subscribed to the Google Groups "Jenkins Issues" group. To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-issues+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[JIRA] (JENKINS-35352) unclassified field org.jenkinsci.plugins.workflow.support.steps.build.RunWrapper result when trying to call setResult on wrong type
Title: Message Title Andrew Bayer commented on JENKINS-35352 Re: unclassified field org.jenkinsci.plugins.workflow.support.steps.build.RunWrapper result when trying to call setResult on wrong type So the problem is that it'll actually work in standalone Groovy (or non-sandboxed Pipeline code), because Groovy's meta object protocol magic automatically tries to cast the right-hand side to the type of the parameter for setResult(String). Which obviously in the case of the parameter being a String means it just calls toString(). So the question is should we do the same in script-security? Add Comment This message was sent by Atlassian JIRA (v7.3.0#73011-sha1:3c73d0e) -- You received this message because you are subscribed to the Google Groups "Jenkins Issues" group. To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-issues+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[JIRA] (JENKINS-35352) unclassified field org.jenkinsci.plugins.workflow.support.steps.build.RunWrapper result when trying to call setResult on wrong type
Title: Message Title Jesse Glick updated an issue Jenkins / JENKINS-35352 unclassified field org.jenkinsci.plugins.workflow.support.steps.build.RunWrapper result when trying to call setResult on wrong type Change By: Jesse Glick Labels: diagnostics pipeline Add Comment This message was sent by Atlassian JIRA (v7.1.7#71011-sha1:2526d7c) -- You received this message because you are subscribed to the Google Groups "Jenkins Issues" group. To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-issues+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[JIRA] (JENKINS-35352) unclassified field org.jenkinsci.plugins.workflow.support.steps.build.RunWrapper result when trying to call setResult on wrong type
Title: Message Title Jesse Glick reopened an issue No, throwing an unclassified field error is a bug. The call should fail, but it should be reporting the same message that standalone Groovy would in this case, whatever that is. Jenkins / JENKINS-35352 unclassified field org.jenkinsci.plugins.workflow.support.steps.build.RunWrapper result when trying to call setResult on wrong type Change By: Jesse Glick Resolution: Won't Fix Status: Resolved Reopened Add Comment This message was sent by Atlassian JIRA (v7.1.7#71011-sha1:2526d7c) -- You received this message because you are subscribed to the Google Group
[JIRA] (JENKINS-35352) unclassified field org.jenkinsci.plugins.workflow.support.steps.build.RunWrapper result when trying to call setResult on wrong type
Title: Message Title Reinhold Füreder resolved as Won't Fix Based on (a) the comment from Jesse Glick and (b) Andrew Bayer's whitelisting of static fields from hudson.model.Result in the course of JENKINS-40849 I dare to resolve this (rather old) issue with "won't fix" – hope nobody minds... Because the following type-/typo-safe code can actually be used without further script approvals: currentBuild.result = hudson.model.Result.FAILURE.toString() Jenkins / JENKINS-35352 unclassified field org.jenkinsci.plugins.workflow.support.steps.build.RunWrapper result when trying to call setResult on wrong type Change By: Reinhold Füreder Status: Reopened Resolved Resolution: Won't Fix Add Comment This message was sent by Atlassian JIRA (v7.1.7#71011-sha1:2526d7c)
[JIRA] (JENKINS-35352) unclassified field org.jenkinsci.plugins.workflow.support.steps.build.RunWrapper result when trying to call setResult on wrong type
Title: Message Title Jesse Glick commented on JENKINS-35352 Re: unclassified field org.jenkinsci.plugins.workflow.support.steps.build.RunWrapper result when trying to call setResult on wrong type Just use currentBuild.result = 'FAILURE' Would it be possible to whitelist all static result states from hudson.model.Result I prefer not to have scripts import Jenkins API types if at all possible. Add Comment This message was sent by Atlassian JIRA (v7.1.7#71011-sha1:2526d7c) -- You received this message because you are subscribed to the Google Groups "Jenkins Issues" group. To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-issues+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[JIRA] (JENKINS-35352) unclassified field org.jenkinsci.plugins.workflow.support.steps.build.RunWrapper result when trying to call setResult on wrong type
Title: Message Title Reinhold Füreder commented on JENKINS-35352 Re: unclassified field org.jenkinsci.plugins.workflow.support.steps.build.RunWrapper result when trying to call setResult on wrong type Sergey Kovin and Jesse Glick: I think there are two "problems": The line currentBuild.result = hudson.model.Result.FAILURE actually fails, because currently (unfortunately) the result can only be set based on String. See org.jenkinsci.plugins.workflow.support.steps.build.RunWrapper#setResult(...): @Whitelisted public void setResult(String result) throws AbortException { if(!this.currentBuild) { throw new SecurityException("can only set the result property on the current build"); } else { this.build().setResult(Result.fromString(result)); } } => So you could use currentBuild.result = hudson.model.Result.FAILURE.toString(), I guess. => Jesse Glick would it be possible to also allow using hudson.model.Result (directly), which would be type/typo-safe? (For backwards compatibility of course the old String based approach needs to be kept, I assume.) After this change, however, I think the second problem should pop up: namely that hudson.model.Result.FAILURE is not whitelisted either. => Jesse Glick Would it be possible to whitelist all static result states from hudson.model.Result, e.g.: staticField hudson.model.Result FAILURE? Add Comment
[JIRA] (JENKINS-35352) unclassified field org.jenkinsci.plugins.workflow.support.steps.build.RunWrapper result when trying to call setResult on wrong type
Title: Message Title Jesse Glick updated an issue Jenkins / JENKINS-35352 unclassified field org.jenkinsci.plugins.workflow.support.steps.build.RunWrapper result when trying to call setResult on wrong type Change By: Jesse Glick Summary: unclassified field org.jenkinsci.plugins.workflow.support.steps.build.RunWrapper result when trying to call setResult on wrong type Add Comment This message was sent by Atlassian JIRA (v7.1.7#71011-sha1:2526d7c) -- You received this message because you are subscribed to the Google Groups "Jenkins Issues" group. To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-issues+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.