pipeline-as-yaml-plugin icon indicating copy to clipboard operation
pipeline-as-yaml-plugin copied to clipboard

Pipeline as YAML fails to run if user trigger it with Replay option

Open sunishsurendrank opened this issue 4 years ago • 6 comments

I have created a Pipeline in YAML as shown below.

pipeline:
    agent:
      any:
    stages:
     - stage: "Checkout"
       steps:
         script: 
           - git 'https://github.com/username/API.git'
     - stage: "Build Multi stage Docker Image"
       steps:
         script: 
           - sh "docker build -t username/webserver:v$BUILD_NUMBER ."

The pipeline when successful when I build it. But failing when I replay it with the below error.

Replayed #40
java.lang.ClassCastException: java.lang.String cannot be cast to java.util.LinkedHashMap
	at org.jenkinsci.plugins.workflow.multibranch.yaml.pipeline.parsers.PipelineParser.parse(PipelineParser.java:34)
Caused: org.jenkinsci.plugins.workflow.multibranch.yaml.pipeline.exceptions.PipelineAsYamlRuntimeException: java.lang.String cannot be cast to java.util.LinkedHashMap
	at org.jenkinsci.plugins.workflow.multibranch.yaml.pipeline.parsers.PipelineParser.parse(PipelineParser.java:53)
	at org.jenkinsci.plugins.workflow.multibranch.yaml.pipeline.cps.PipelineCpsFlowDefinition.create(PipelineCpsFlowDefinition.java:41)
	at org.jenkinsci.plugins.workflow.multibranch.yaml.pipeline.PipelineAsYamlScriptFlowDefinition.create(PipelineAsYamlScriptFlowDefinition.java:56)
	at org.jenkinsci.plugins.workflow.job.WorkflowRun.run(WorkflowRun.java:309)
	at hudson.model.ResourceController.execute(ResourceController.java:97)
	at hudson.model.Executor.run(Executor.java:428)
Finished: FAILURE

To Reproduce To reproduce this issue please create a Pipeline using YAML and try to run via replay.

Expected behavior The pipeline should be successful.

sunishsurendrank avatar Aug 21 '20 07:08 sunishsurendrank

Hi @sunishsurendrank ,

Thanks for reporting this bug. I opened PR to workflow-cps for some changes. After these changes are applied, I will be able to fix this error.

aytuncbeken avatar Dec 28 '20 14:12 aytuncbeken

Is this issue fixed!

sunishsurendrank avatar May 11 '21 10:05 sunishsurendrank

I have this same error

danjeltahko avatar Jun 19 '23 19:06 danjeltahko

@DanjelTahko I am not sure this issue is fixed yet @aytuncbeken can you provide some update?

sunishsurendrank avatar Jun 21 '23 07:06 sunishsurendrank