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

Need ability to create reusable chunks of Declarative Pipeline

      There is no way to write reusable chunks of Declarative Pipeline configuration.
      Jenkinsfile has no facility for this, and
      shared libraries support only scripted groovy (classes, steps, globals).

          [JENKINS-42224] Need ability to create reusable chunks of Declarative Pipeline

          Liam Newman created issue -

          Andrew Bayer added a comment -

          This is an interesting and legitimately challenging problem - needs thinking.

          Andrew Bayer added a comment - This is an interesting and legitimately challenging problem - needs thinking.
          Andrew Bayer made changes -
          Link New: This issue is duplicated by JENKINS-42220 [ JENKINS-42220 ]

          Andrew Bayer added a comment -

          Ok, been thinking about this some. =) I think we could avoid some of the hassles of inserting GroovyShellDecoratorImpl all over the place for compile-time validating etc by instead putting the Declarative chunks in the resources directory of libraries and using the libraryResource step to get them as strings - then we can use the same logic as in the validateDeclarativePipeline step to do the validation without worrying about breaking other things outside of the Declarative scope.

          That may or may not make sense. =)

          The next challenge is figuring out how to insert the chunk into the runtime model. Still working on that.

          Andrew Bayer added a comment - Ok, been thinking about this some. =) I think we could avoid some of the hassles of inserting GroovyShellDecoratorImpl all over the place for compile-time validating etc by instead putting the Declarative chunks in the resources directory of libraries and using the libraryResource step to get them as strings - then we can use the same logic as in the validateDeclarativePipeline step to do the validation without worrying about breaking other things outside of the Declarative scope. That may or may not make sense. =) The next challenge is figuring out how to insert the chunk into the runtime model. Still working on that.
          Andrew Bayer made changes -
          Link New: This issue is duplicated by JENKINS-42327 [ JENKINS-42327 ]
          Alexander Vorobiev made changes -
          Link New: This issue is related to JENKINS-45306 [ JENKINS-45306 ]
          Andrew Bayer made changes -
          Link New: This issue is duplicated by JENKINS-45306 [ JENKINS-45306 ]
          Andrew Bayer made changes -
          Link New: This issue is duplicated by JENKINS-44053 [ JENKINS-44053 ]
          Andrew Bayer made changes -
          Link New: This issue is duplicated by JENKINS-43794 [ JENKINS-43794 ]
          Andrew Bayer made changes -
          Link New: This issue is duplicated by JENKINS-43455 [ JENKINS-43455 ]

            Unassigned Unassigned
            bitwiseman Liam Newman
            Votes:
            89 Vote for this issue
            Watchers:
            102 Start watching this issue

              Created:
              Updated: