[JIRA] (JENKINS-57537) catchError - Expecting "class hudson.model.Result" for parameter "buildResult"

0 views
Skip to first unread message

mail@torstenwalter.de (JIRA)

unread,
May 18, 2019, 2:33:02 AM5/18/19
to jenkinsc...@googlegroups.com
Torsten Walter created an issue
 
Jenkins / Bug JENKINS-57537
catchError - Expecting "class hudson.model.Result" for parameter "buildResult"
Issue Type: Bug Bug
Assignee: Devin Nusbaum
Components: pipeline
Created: 2019-05-18 06:32
Environment: Jenkin Version: 2.164.3

Installed plugins:
ace-editor:1.1
antisamy-markup-formatter:1.5
apache-httpcomponents-client-4-api:4.5.5-3.0
authentication-tokens:1.3
authorize-project:1.3.0
branch-api:2.4.0
build-timeout:1.19
cloudbees-folder:6.8
configuration-as-code-support:1.15
configuration-as-code:1.15
credentials-binding:1.18
credentials:2.1.18
display-url-api:2.3.1
docker-commons:1.15
docker-workflow:1.18
durable-task:1.29
email-ext:2.66
git-client:2.7.7
git-server:1.7
git:3.10.0
github-api:1.95
github-branch-source:2.5.2
github:1.29.4
gitlab-plugin:1.5.12
greenballs:1.15
handlebars:1.1.1
jackson2-api:2.9.8
job-dsl:1.74
jquery-detached:1.2.1
jsch:0.1.55
junit:1.28
kubernetes-credentials:0.4.0
kubernetes:1.15.4
ldap:1.20
lockable-resources:2.5
mailer:1.23
matrix-auth:2.4.2
matrix-project:1.14
momentjs:1.1.1
oic-auth:1.6
pipeline-build-step:2.9
pipeline-github-lib:1.0
pipeline-graph-analysis:1.10
pipeline-input-step:2.10
pipeline-milestone-step:1.3.1
pipeline-model-api:1.3.8
pipeline-model-declarative-agent:1.1.1
pipeline-model-definition:1.3.8
pipeline-model-extensions:1.3.8
pipeline-rest-api:2.11
pipeline-stage-step:2.3
pipeline-stage-tags-metadata:1.3.8
pipeline-stage-view:2.11
pipeline-utility-steps:2.3.0
plain-credentials:1.5
resource-disposer:0.12
scm-api:2.4.1
script-security:1.58
simple-theme-plugin:0.5.1
slack:2.23
sonar:2.8.1
ssh-credentials:1.16
structs:1.19
timestamper:1.9
token-macro:2.7
variant:1.2
workflow-aggregator:2.6
workflow-api:2.34
workflow-basic-steps:2.16
workflow-cps-global-lib:2.13
workflow-cps:2.68
workflow-durable-task-step:2.30
workflow-job:2.32
workflow-multibranch:2.21
workflow-scm-step:2.7
workflow-step-api:2.19
workflow-support:3.3
ws-cleanup:0.37

Browser : Chrome
OS: Ubuntu 18.04
Priority: Minor Minor
Reporter: Torsten Walter

Used pipeline:

pipeline {
    agent any
    stages {
        stage('catch error') {
            steps {
                catchError(buildResult: 'SUCCESS') {
                    sh "exit 1"
                }
            }
        }
        stage('summary') {
            steps {
                echo "here comes the summary..."
            }
        }
    }
}

Result:

Running in Durability level: MAX_SURVIVABILITY
org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
WorkflowScript: 6: Expecting "class hudson.model.Result" for parameter "buildResult" but got "SUCCESS" of type class java.lang.String instead @ line 6, column 41.
         catchError(buildResult: 'SUCCESS')
                                 ^

1 error

	at org.codehaus.groovy.control.ErrorCollector.failIfErrors(ErrorCollector.java:310)
	at org.codehaus.groovy.control.CompilationUnit.applyToPrimaryClassNodes(CompilationUnit.java:1085)
	at org.codehaus.groovy.control.CompilationUnit.doPhaseOperation(CompilationUnit.java:603)
	at org.codehaus.groovy.control.CompilationUnit.processPhaseOperations(CompilationUnit.java:581)
	at org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:558)
	at groovy.lang.GroovyClassLoader.doParseClass(GroovyClassLoader.java:298)
	at groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:268)
	at groovy.lang.GroovyShell.parseClass(GroovyShell.java:688)
	at groovy.lang.GroovyShell.parse(GroovyShell.java:700)
	at org.jenkinsci.plugins.workflow.cps.CpsGroovyShell.doParse(CpsGroovyShell.java:133)
	at org.jenkinsci.plugins.workflow.cps.CpsGroovyShell.reparse(CpsGroovyShell.java:126)
	at org.jenkinsci.plugins.workflow.cps.CpsFlowExecution.parseScript(CpsFlowExecution.java:561)
	at org.jenkinsci.plugins.workflow.cps.CpsFlowExecution.start(CpsFlowExecution.java:522)
	at org.jenkinsci.plugins.workflow.job.WorkflowRun.run(WorkflowRun.java:320)
	at hudson.model.ResourceController.execute(ResourceController.java:97)
	at hudson.model.Executor.run(Executor.java:429)
Finished: FAILURE

 

Add Comment Add Comment
 
This message was sent by Atlassian Jira (v7.11.2#711002-sha1:fdc329d)

dnusbaum@cloudbees.com (JIRA)

unread,
May 23, 2019, 11:05:02 AM5/23/19
to jenkinsc...@googlegroups.com
Devin Nusbaum commented on Bug JENKINS-57537
 
Re: catchError - Expecting "class hudson.model.Result" for parameter "buildResult"

Thanks for filing a separate ticket! I was not able to reproduce this in a scripted Pipeline, but I spoke with Andrew Bayer about this today, and he thought that it might be possible this issue was specific to Declarative. My guess is that it has to do with the way that Result registers a custom converter via Stapler here rather than using normal data binding.

mail@torstenwalter.de (JIRA)

unread,
May 23, 2019, 7:00:01 PM5/23/19
to jenkinsc...@googlegroups.com

Thanks for looking into this. Is there anything I can help with?

dnusbaum@cloudbees.com (JIRA)

unread,
May 29, 2019, 5:33:02 PM5/29/19
to jenkinsc...@googlegroups.com

I was able to reproduce the issue and can confirm that this is specific to Declarative Pipelines. I am working on a PR to fix the issue: https://github.com/jenkinsci/workflow-basic-steps-plugin/pull/85.

dnusbaum@cloudbees.com (JIRA)

unread,
May 29, 2019, 5:34:02 PM5/29/19
to jenkinsc...@googlegroups.com
Devin Nusbaum started work on Bug JENKINS-57537
 
Change By: Devin Nusbaum
Status: Open In Progress

dnusbaum@cloudbees.com (JIRA)

unread,
May 29, 2019, 5:34:02 PM5/29/19
to jenkinsc...@googlegroups.com

dnusbaum@cloudbees.com (JIRA)

unread,
Jun 3, 2019, 5:06:02 PM6/3/19
to jenkinsc...@googlegroups.com
 

A fix for this issue was just released in Pipeline Basic Steps Plugin version 2.17. Note that you must update Pipeline Groovy Plugin version 2.70 along with this update.

Change By: Devin Nusbaum
Status: In Review Resolved
Resolution: Fixed
Released As: workflow-basic-steps 2.17

dnusbaum@cloudbees.com (JIRA)

unread,
Jun 3, 2019, 5:06:03 PM6/3/19
to jenkinsc...@googlegroups.com
Devin Nusbaum edited a comment on Bug JENKINS-57537
 
Re: catchError - Expecting "class hudson.model.Result" for parameter "buildResult"
A fix for this issue was just released in Pipeline Basic Steps Plugin version 2.17. Note that you *must* update Pipeline Groovy Plugin to version 2.70 along with this update.

andreimuresianu1@gmail.com (JIRA)

unread,
Jun 4, 2019, 6:54:03 AM6/4/19
to jenkinsc...@googlegroups.com

Thank you for working on the Devin Nusbaum!

Could you please let me know if my expectation is wrong? I tried running the following:

pipeline {
    agent any
    stages {
        stage('catch error'
) {
            steps {
                catchError(stageResult: 'UNSTABLE') {
                    sh "exit 1"
                }
            }
        }
        stage('summary') {
            steps {
                echo "here comes the summary..."
            }
        }
    }
} 
 
                                                            

And I expected the first stage to turn yellow instead it stayed green.

I can confirm that I am running:

Pipeline Basic Steps 2.17 and Pipeline Groovy: 2.70

andreimuresianu1@gmail.com (JIRA)

unread,
Jun 4, 2019, 8:00:02 AM6/4/19
to jenkinsc...@googlegroups.com
Andrei Muresianu edited a comment on Bug JENKINS-57537
Thank you for working on the this  [~dnusbaum]!


Could you please let me know if my expectation is wrong? I tried running the following:
{code:java}

pipeline {
    agent any
    stages {
        stage('catch error') {
            steps {
                catchError(stageResult: 'UNSTABLE') {
                    sh "exit 1"
                }
            }
        }
        stage('summary') {
            steps {
                echo "here comes the summary..."
            }
        }
    }
} {code}

And I expected the first stage to turn yellow instead it stayed green.

I can confirm that I am running:

Pipeline Basic Steps 2.17 and Pipeline Groovy: 2.70

dnusbaum@cloudbees.com (JIRA)

unread,
Jun 4, 2019, 9:15:03 AM6/4/19
to jenkinsc...@googlegroups.com

Andrei Muresianu Yes, it should turn yellow in your example. I think that JENKINS-57579 is that problem, and we are waiting on a Blue Ocean fix to be merged and released to fix it. (In some cases, things work without the fix, but I think sequential stages are problematic.)

dnusbaum@cloudbees.com (JIRA)

unread,
Jun 4, 2019, 4:58:02 PM6/4/19
to jenkinsc...@googlegroups.com

dnusbaum@cloudbees.com (JIRA)

unread,
Jun 4, 2019, 5:05:02 PM6/4/19
to jenkinsc...@googlegroups.com
Devin Nusbaum edited a comment on Bug JENKINS-57537
A fix for this issue was just released in Pipeline Basic Steps Plugin version 2. 17 18 . Note that you *must* update Pipeline Groovy Plugin to version 2.70 along with this update.

wamcubs@yahoo.com (JIRA)

unread,
Sep 13, 2019, 9:57:03 AM9/13/19
to jenkinsc...@googlegroups.com

Hello, Did anyone ever solve this issue for Declarative pipeline? The catchError still give the same error.

This message was sent by Atlassian Jira (v7.13.6#713006-sha1:cc4451f)
Atlassian logo

dnusbaum@cloudbees.com (JIRA)

unread,
Sep 13, 2019, 10:03:05 AM9/13/19
to jenkinsc...@googlegroups.com

Andrew Mullens Yes, this issue is fixed, see this comment. Make sure you are passing a String to catchError and not an object of type Result. If that still isn't working for you, please post an extract from your Jenkinsfile showing how you are using catchError.

wamcubs@yahoo.com (JIRA)

unread,
Sep 16, 2019, 9:21:03 AM9/16/19
to jenkinsc...@googlegroups.com

Hey Devin, thank you. I saw that and was passing in a string, but turns out our Plug in Version is 2.66. So it should work once we update the plug in. Thanks again.

robin.bjorklin@gmail.com (JIRA)

unread,
Sep 17, 2019, 8:11:04 PM9/17/19
to jenkinsc...@googlegroups.com

Can anyone get the message to show?

 

catchError(buildResult: 'SUCCESS', stageResult: 'SUCCESS', message: 'Not triggering downstream build.') {
    build job: "test/build", wait: false
}

 

robin.bjorklin@gmail.com (JIRA)

unread,
Sep 17, 2019, 8:13:01 PM9/17/19
to jenkinsc...@googlegroups.com
Robin Björklin edited a comment on Bug JENKINS-57537
Can anyone get the message to show?

 
{code:java}

catchError(buildResult: 'SUCCESS', stageResult: 'SUCCESS', message: 'Not triggering downstream build.') {
    build job: "test/build", wait: false
}
{code}
 
EDIT: It shows up in the ConsoleText but not in Blue Ocean. Intended?

anvesh.gundlapalli@gmail.com (JIRA)

unread,
Jan 2, 2020, 4:33:03 PM1/2/20
to jenkinsc...@googlegroups.com

Am I doing something wrong here? 

catchError(buildResult: hudson.model.Result.UNSTABLE, stageResult: hudson.model.Result.FAILURE) {
//build steps
}

We just updated from v2.16 to v2.204 this morning and this line (and similar) has been causing our declarative pipelines to break. I'm not sure what the right format is

Reply all
Reply to author
Forward
0 new messages