In my workflow step I have a parameter of type hudson.model.Result
@DataBoundSetter
public void setRequiredResult(final Result requiredResult) {
    this.requiredResult = requiredResult;
}
When this parameter is set in the snipped generator, then the snipped generator 
creates the parameter as
discoverReferenceBuild requiredResult: 'FAILURE‘ 
This works for scripted pipelines, but not for declarative pipelines. In 
declarative pipelines I get an error:
WorkflowScript: 43: Expecting "class hudson.model.Result" for parameter 
"requiredResult" but got "SUCCESS" of type class java.lang.String instead @ 
line 43, column 67.
Is there a way to provide a hint for declarative pipelines so that the 
conversion of String to Result is handled automatically?
As a workaround I am now adding a String parameter as well, but this seems to 
be not elegant. 
PR: https://github.com/jenkinsci/forensics-api-plugin/pull/614
Issue: https://issues.jenkins.io/browse/JENKINS-75846





-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion visit 
https://groups.google.com/d/msgid/jenkinsci-dev/C8405357-6567-4DFB-88C9-FF1E469BC71D%40gmail.com.

Reply via email to