Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-40721

Wrappers provided by plugins not working correctly

      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

          [JENKINS-40721] Wrappers provided by plugins not working correctly

            abayer Andrew Bayer
            tomlarrow Tom Larrow
            Votes:
            1 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved: