You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
I hit this issue in the simple demo for jenkinsci/jenkinsfile-runner#316 . Jenkinsfile Runner uses the SCM source and the virtual FilesystemSCM, and presumptions in the Pipeline as YAML's code may lead to incorrect behavior if CpsFlowFactoryAction2 is present in the created Pipeline.
THIS IS NOT A BUG IN PIPELINE AS YAML, but some code hardening may make sense
Step 2. CpsFlowDefinition flow execution creator consults with actions passed as arguments. One of actions is SetJenkinsfileLocation. This action makes the method to calls return ((CpsFlowFactoryAction2) a).create(this, owner, actions); instead of creating the default constructor as coded below. The actually called create() method creates the execution from scratch and ignores the converted DSL. So it calls a standard
Step 3. A standard Groovy Converter is called. Execution fails with...
org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
WorkflowScript: 5: expecting EOF, found ':' @ line 5, column 10.
- stage: "Print Hello"
^
1 error
at org.codehaus.groovy.control.ErrorCollector.failIfErrors(ErrorCollector.java:310)
at org.codehaus.groovy.control.ErrorCollector.addFatalError(ErrorCollector.java:150)
at org.codehaus.groovy.control.ErrorCollector.addError(ErrorCollector.java:120)
at org.codehaus.groovy.control.ErrorCollector.addError(ErrorCollector.java:132)
at org.codehaus.groovy.control.SourceUnit.addError(SourceUnit.java:350)
at org.codehaus.groovy.antlr.AntlrParserPlugin.transformCSTIntoAST(AntlrParserPlugin.java:144)
at org.codehaus.groovy.antlr.AntlrParserPlugin.parseCST(AntlrParserPlugin.java:110)
at org.codehaus.groovy.control.SourceUnit.parse(SourceUnit.java:234)
at org.codehaus.groovy.control.CompilationUnit$1.call(CompilationUnit.java:168)
at org.codehaus.groovy.control.CompilationUnit.applyToSourceUnits(CompilationUnit.java:943)
at org.codehaus.groovy.control.CompilationUnit.doPhaseOperation(CompilationUnit.java:605)
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)
Expected behavior
Pipeline as YAML code is more robust against custom CpsFlowFactoryAction2 implementations. Additional coverage for Pipeline replay/restart functionality might be needed
Additional context
For me the resolution will be clearly on the Jenkinsfile Runner side. This is rather code hardening, not a bug
The text was updated successfully, but these errors were encountered:
Describe the bug
I hit this issue in the simple demo for jenkinsci/jenkinsfile-runner#316 . Jenkinsfile Runner uses the SCM source and the virtual FilesystemSCM, and presumptions in the Pipeline as YAML's code may lead to incorrect behavior if
CpsFlowFactoryAction2
is present in the created Pipeline.THIS IS NOT A BUG IN PIPELINE AS YAML, but some code hardening may make sense
Step 0. Jenkinsfile Runner adds the
SetJenkinsfileLocation
action which implementsCpsFlowFactoryAction2
. https://github.com/jenkinsci/jenkinsfile-runner/blob/9f41f51b6dc320b9dd5c0fa6d81f179518597d37/payload/src/main/java/io/jenkins/jenkinsfile/runner/SetJenkinsfileLocation.javaStep 1.
PipelineCpsScmFlowDefinition
converts YAML to Groovy DSL and then callsCpsFlowDefinition
constructorStep 2.
CpsFlowDefinition
flow execution creator consults with actions passed as arguments. One of actions isSetJenkinsfileLocation
. This action makes the method to callsreturn ((CpsFlowFactoryAction2) a).create(this, owner, actions);
instead of creating the default constructor as coded below. The actually calledcreate()
method creates the execution from scratch and ignores the converted DSL. So it calls a standardStep 3. A standard Groovy Converter is called. Execution fails with...
To Reproduce
Run a demo from jenkinsci/jenkinsfile-runner#316
Expected behavior
Pipeline as YAML code is more robust against custom
CpsFlowFactoryAction2
implementations. Additional coverage for Pipeline replay/restart functionality might be neededAdditional context
For me the resolution will be clearly on the Jenkinsfile Runner side. This is rather code hardening, not a bug
The text was updated successfully, but these errors were encountered: