[JIRA] (JENKINS-38580) Declarative Pipeline does not work with Milestone without Ordinal

98 views
Skip to first unread message

pwolf@cloudbees.com (JIRA)

unread,
Sep 28, 2016, 5:08:01 PM9/28/16
to jenkinsc...@googlegroups.com
Patrick Wolf created an issue
 
Jenkins / Bug JENKINS-38580
Declarative Pipeline does not work with Milestone without Ordinal
Issue Type: Bug Bug
Assignee: Andrew Bayer
Components: pipeline-model-definition-plugin
Created: 2016/Sep/28 9:07 PM
Priority: Minor Minor
Reporter: Patrick Wolf

Pipeline milestone step has two optional parameters:

ordinal number
label

stage ("Build") {
milestone()
}

works fine in Pipeline script but will fail without an ordinal value in Declarative Pipeline.

Started by user Admin
org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
WorkflowScript: 5: Missing required parameter: 'ordinal' @ line 5, column 13.
milestone()
^

WorkflowScript: 10: Missing required parameter: 'ordinal' @ line 10, column 13.
milestone (label: 'Test')
^

WorkflowScript: 15: Missing required parameter: 'ordinal' @ line 15, column 13.
milestone (label: 'Deploy')
^

3 errors

at org.codehaus.groovy.control.ErrorCollector.failIfErrors(ErrorCollector.java:310)
at org.codehaus.groovy.control.CompilationUnit.applyToPrimaryClassNodes(CompilationUnit.java:1073)
at org.codehaus.groovy.control.CompilationUnit.doPhaseOperation(CompilationUnit.java:591)
at org.codehaus.groovy.control.CompilationUnit.processPhaseOperations(CompilationUnit.java:569)
at org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:546)
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.reparse(CpsGroovyShell.java:67)
at org.jenkinsci.plugins.workflow.cps.CpsFlowExecution.parseScript(CpsFlowExecution.java:411)
at org.jenkinsci.plugins.workflow.cps.CpsFlowExecution.start(CpsFlowExecution.java:374)
at org.jenkinsci.plugins.workflow.job.WorkflowRun.run(WorkflowRun.java:220)
at hudson.model.ResourceController.execute(ResourceController.java:98)
at hudson.model.Executor.run(Executor.java:410)
Finished: FAILURE

Add Comment Add Comment
 
This message was sent by Atlassian JIRA (v7.1.7#71011-sha1:2526d7c)
Atlassian logo

pwolf@cloudbees.com (JIRA)

unread,
Sep 28, 2016, 5:15:01 PM9/28/16
to jenkinsc...@googlegroups.com
Patrick Wolf commented on Bug JENKINS-38580
 
Re: Declarative Pipeline does not work with Milestone without Ordinal

test script that works for Declarative

pipeline{
    agent none
    stages{
        stage ("Build"){
            milestone(1)
            sleep getTime()
            echo "finishing build"
        }
        stage ("Test"){
            milestone (10)
            sleep getTime()
            echo "finishing Test"
        }
        stage ("Deploy"){
            milestone (20)
            sleep getTime()
            echo "finishing Deploy"
        }
    }
}



@NonCPS
def getTime() {
    if (currentBuild.number % 2 != 0){
        return 10
    }
    else{
        return 5
    }
}

pwolf@cloudbees.com (JIRA)

unread,
Sep 28, 2016, 5:16:02 PM9/28/16
to jenkinsc...@googlegroups.com
Patrick Wolf edited a comment on Bug JENKINS-38580
test script that works for Declarative . Remove the ordinal number and it will fail


{code:java}

pipeline{
    agent none
    stages{
        stage ("Build"){
            milestone(1)
            sleep getTime()
            echo "finishing build"
        }
        stage ("Test"){
            milestone (10)
            sleep getTime()
            echo "finishing Test"
        }
        stage ("Deploy"){
            milestone (20)
            sleep getTime()
            echo "finishing Deploy"
        }
    }
}



@NonCPS
def getTime() {
    if (currentBuild.number % 2 != 0){
        return 10
    }
    else{
        return 5
    }
}
{code}

pwolf@cloudbees.com (JIRA)

unread,
Sep 29, 2016, 12:35:01 PM9/29/16
to jenkinsc...@googlegroups.com
Patrick Wolf updated an issue
 
Change By: Patrick Wolf
Component/s: pipeline-milestone-step-plugin

andrew.bayer@gmail.com (JIRA)

unread,
Sep 29, 2016, 12:45:03 PM9/29/16
to jenkinsc...@googlegroups.com
Andrew Bayer commented on Bug JENKINS-38580
 
Re: Declarative Pipeline does not work with Milestone without Ordinal

Frankly, I think this isn't a bug - https://github.com/jenkinsci/pipeline-milestone-step-plugin/blob/master/src/main/java/org/jenkinsci/plugins/pipeline/milestone/MilestoneStep.java#L62 - the ordinal is a required field. I'm honestly not sure how it works outside declarative without the ordinal! Jesse Glick - is there some magic in DSL that auto-inserts 0 for DataBoundConstructor int parameters that are unspecified?

andrew.bayer@gmail.com (JIRA)

unread,
Nov 17, 2016, 5:42:01 PM11/17/16
to jenkinsc...@googlegroups.com
Andrew Bayer resolved as Not A Defect
 
Change By: Andrew Bayer
Status: Open Resolved
Resolution: Not A Defect

bitwiseman@gmail.com (JIRA)

unread,
Oct 22, 2019, 11:24:47 PM10/22/19
to jenkinsc...@googlegroups.com
Liam Newman closed an issue as Duplicate
 

Bulk closing resolved issues.

Change By: Liam Newman
Status: Resolved Closed
This message was sent by Atlassian Jira (v7.13.6#713006-sha1:cc4451f)
Atlassian logo
Reply all
Reply to author
Forward
0 new messages