jenkinsci / pipeline-as-yaml-plugin

Jenkins Pipeline As Yaml Plugin
https://plugins.jenkins.io/pipeline-as-yaml/
MIT License
133 stars 46 forks source link

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

Open sunishsurendrank opened 4 years ago

sunishsurendrank commented 4 years ago

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.

aytuncbeken commented 3 years ago

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.

sunishsurendrank commented 3 years ago

Is this issue fixed!

danjeltahko commented 1 year ago

I have this same error

sunishsurendrank commented 1 year ago

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

adev101 commented 1 month ago

I see still same error. Plugin I added is Pipeline As YAML (Incubated) Version192.vc72d50cb_c258

jonesbusy commented 1 month ago

PR are welcome

Nobody is actively contributing to this plugin. Recent contribution like https://github.com/jenkinsci/pipeline-as-yaml-plugin/pull/77 were only there to make it work with recent jenkins version