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

Ability to create custom stages in parallel blocks in pipeline shared library

XMLWordPrintable

      I would like to be able to easily run the same steps across multiple nodes using the declarative pipeline and a shared library. This does not currently seem to be possible since only custom steps can be created in shared libraries.

       

      Example jenkinsfile:

      pipeline {
          agent any
          stages {
              stage('Build everywhere') {
                  runOnAllPlatforms {
                      sh 'doing build things'
                  }
              }
          }
      }

      Example shared library vars/runOnAllPlatforms.groovy:

      def call(Closure body) {
          parallel {
              stage('RHEL') {
                  agent {
                      node { label 'rhel7' }
                  }
                  steps {
                      body()
                  }
              stage('Apple') {
              agent {
                  node { label 'apple' }
              }
              steps {
                  body()
              }
              steps {
                  body()
              }
          }
      }

            Unassigned Unassigned
            kevlan Kevin Lannen
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: