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

Shared Library should be allowed to declare reusable stages

    XMLWordPrintable

    Details

    • Similar Issues:

      Description

      Currently, we have a lot of reusable steps we use in our Jenkinsfiles like so:

      pipeline {
        stages {
          stage('Build') {
            steps {
              reusableBuild()
            }
          }
          stage('Test') {
            steps {
              reusableTest()
            }
          }
        } 
      }

      I feel it is very repetitive to always replicate the stage definition - the way I look at this, these should be reusable as well. A pipeline would then simply consist of reusable, composable stages:

      pipeline {
        stages {
          reusableBuild()
          reusableTest()
          stage 'Something individual' {
            steps {
              echo 'only for this project'
            }
          }
        } 
      }

      Maybe this is already possible, but at the moment I have no idea how to define reusable stages in a shared library - any hint would be very much appreciated. I would also be willing to provide a PR, if only I had an idea which code to touch

        Attachments

          Issue Links

            Activity

            tobilarscheid Tobias Larscheid created issue -
            tobilarscheid Tobias Larscheid made changes -
            Field Original Value New Value
            Description Currently, we have a lot of reusable steps we use in our Jenkinsfiles like so:
            {code:java}
            pipeline {
              stages {
                stage('Build') {
                  steps {
                    reusableBuild()
                  }
                }
                stage('Test') {
                  steps {
                    reusableTest()
                  }
                }
              }
            }{code}
            I feel it is very repetitive to always replicate the stage definition - the way I look at this, these should be reusable as well. A pipeline would then simply consist of reusable, composable stages:
            {code:java}
            pipeline {
              stages {
                reusableBuild()
                reusableTest()
                stage 'Something individual' {
                  echo 'only for this project'
                }
              }
            }{code}
            Maybe this is already possible, but at the moment I have no idea how to define reusable stages in a shared library - any hint would be very much appreciated. I would also be willing to provide a PR, if only I had an idea which code to touch ;)
            Currently, we have a lot of reusable steps we use in our Jenkinsfiles like so:
            {code:java}
            pipeline {
              stages {
                stage('Build') {
                  steps {
                    reusableBuild()
                  }
                }
                stage('Test') {
                  steps {
                    reusableTest()
                  }
                }
              }
            }{code}
            I feel it is very repetitive to always replicate the stage definition - the way I look at this, these should be reusable as well. A pipeline would then simply consist of reusable, composable stages:
            {code:java}
            pipeline {
              stages {
                reusableBuild()
                reusableTest()
                stage 'Something individual' {
                  steps {
                    echo 'only for this project'
                  }
                }
              }
            }{code}
            Maybe this is already possible, but at the moment I have no idea how to define reusable stages in a shared library - any hint would be very much appreciated. I would also be willing to provide a PR, if only I had an idea which code to touch ;)
            abayer Andrew Bayer made changes -
            Component/s pipeline-model-definition-plugin [ 21706 ]
            Component/s pipeline [ 21692 ]
            abayer Andrew Bayer made changes -
            Link This issue duplicates JENKINS-49135 [ JENKINS-49135 ]
            abayer Andrew Bayer made changes -
            Status Open [ 1 ] Fixed but Unreleased [ 10203 ]
            Resolution Duplicate [ 3 ]

              People

              • Assignee:
                Unassigned
                Reporter:
                tobilarscheid Tobias Larscheid
              • Votes:
                22 Vote for this issue
                Watchers:
                45 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: