<p>Have you looked at the <a href="https://plugins.jenkins.io/matrix-project/" rel="nofollow noreferrer">Matrix project plugin</a>?</p>
<blockquote>
<p><strong>Multi-Configuration Projects</strong></p>
<p>A multi-configuration project is useful for instances where your
builds will make many similar build steps, and you would otherwise be
duplicating steps.</p>
<p><strong>Configuration matrix</strong></p>
<p>The Configuration Matrix allows you to specify what steps to
duplicate, and create a multiple-axis graph of the type of builds to
create.</p>
</blockquote>
<p><a href="https://www.jenkins.io/blog/2019/11/22/welcome-to-the-matrix/" rel="nofollow noreferrer">Welcome to the Matrix</a> is an excellent reference doc.</p>
<p>Example (from <a href="https://www.jenkins.io/blog/2019/11/22/welcome-to-the-matrix/" rel="nofollow noreferrer">the blog</a>) - Pipeline for multiple platforms and browsers</p>
<blockquote>
<pre><code>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 &quot;Do Build for ${PLATFORM} - ${BROWSER}&quot;
                        }
                    }
                    stage('Test') {
                        steps {
                            echo &quot;Do Test for ${PLATFORM} - ${BROWSER}&quot;
                        }
                    }
                }
            }
        }
    }
}
</code></pre>
</blockquote>

CC BY-SA 4.0
2020-08-23T18:59:45.233Z
Could you perhaps provide a minimal matrix example (perhaps using the declarative pipeline format?) for posterity? the links you reference might break.
Bruce Becker
CC BY-SA 4.0
2020-08-23T11:14:08.347Z
2020-08-23T23:51:23.853Z
2020-08-23T23:51:23.853Z
Ian W
<p>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.</p>

<jenkins><jenkins-pipeline><jenkins-plugins><jenkinsfile><jenkins-blueocean>
What is the best approach to deploying to multiple servers using Jenkins?
Shawn Bates
# What is the best approach to deploying to multiple servers using Jenkins?

(Asked by: username_0 on 2020-08-11)

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.

**Tags:** jenkins, jenkins-pipeline, jenkins-plugins, jenkinsfile, jenkins-blueocean


---

## 1 answers

### Answer by username_1 on 2020-08-23. Score: 1 | Accepted answer

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}"
                        }
                    }
                }
            }
        }
    }
}

> **Comments:**
> **username_2**: Could you perhaps provide a minimal matrix example (perhaps using the declarative pipeline format?) for posterity? the links you reference might break.  

---

