0

Trying to figure out the best approach for deploying to multiple servers using Jenkins Blue Ocean pipeline. We will have six servers in development, six in QA, six in Staging, and six in production. Should I put the list of the servers in a config file and store in git or is there a plug-in or something within Jenkins that stores host names? All feedback is greatly appreciate.

1

Have you looked at the Matrix project plugin?

Multi-Configuration Projects

A multi-configuration project is useful for instances where your builds will make many similar build steps, and you would otherwise be duplicating steps.

Configuration matrix

The Configuration Matrix allows you to specify what steps to duplicate, and create a multiple-axis graph of the type of builds to create.

Welcome to the Matrix is an excellent reference doc.

Example (from the blog) - Pipeline for multiple platforms and browsers

Jenkinsfile

pipeline {
    agent none
    stages {
        stage('BuildAndTest') {
            matrix {
                agent any
                axes {
                    axis {
                        name 'PLATFORM'
                        values 'linux', 'windows', 'mac'
                    }
                    axis {
                        name 'BROWSER'
                        values 'firefox', 'chrome', 'safari', 'edge'
                    }
                }
                stages {
                    stage('Build') {
                        steps {
                            echo "Do Build for ${PLATFORM} - ${BROWSER}"
                        }
                    }
                    stage('Test') {
                        steps {
                            echo "Do Test for ${PLATFORM} - ${BROWSER}"
                        }
                    }
                }
            }
        }
    }
}
  • Could you perhaps provide a minimal matrix example (perhaps using the declarative pipeline format?) for posterity? the links you reference might break. – Bruce Becker Aug 23 '20 at 18:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.