-
Bug
-
Resolution: Not A Defect
-
Minor
-
None
I was going through how to use wrappers in Declarative Pipeline https://github.com/jenkinsci/pipeline-model-definition-plugin/wiki/Advanced looking how to use the timestamper plugin specifically. Initially I used the wrap() syntax around the classname, which provided this rather helpful error message
org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
WorkflowScript: 9: Invalid wrapper type 'wrap'. Valid wrapper types: [ansiColor, catchError, gitlabBuilds, gitlabCommitStatus, lock, node, podTemplate, retry, script, timeout, timestamps, waitUntil, withContext, withEnv, ws] @ line 9, column 9.
wrap([$class: 'TimestamperBuildWrapper'])
^
So there it was, I just needed to use 'timestamps' and it should work, as declarative pipeline identified it as an available wrapper.
Unfortunately when trying to do that, I received the following error
org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
WorkflowScript: 9: Expected a wrapper @ line 9, column 9.
timestamps
^
To see if it was an issue with the timestamper plugin, I also tried it with ansiColor, which again showed above as an available wrapper
org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
WorkflowScript: 9: Expected a wrapper @ line 9, column 9.
ansiColor
^
It seems Declarative pipeline is identifying them as available wrappers, but unable to use them as wrappers
- links to
And the probably easier alternative would be to have better error messages - don't just say "not a wrapper, GTFO" but instead "not a wrapper, here's what wrapper syntax is - foo(), bar("arg"), baz(oneArg: 1, twoArg: 2)" or something like that.