One common pattern is to extend the number of stages to capture additional
deployment environments, like "staging" or "production", as shown in the
following snippet.
stage('Deploy - Staging') {
steps {
sh './deploy staging'
sh './run-smoke-tests'
}
}
stage('Deploy - Production') {
steps {
sh './deploy production'
}
}
In this example, we’re assuming that whatever "smoke tests" are run by our
./run-smoke-tests
script are sufficient to qualify or validate a release to
the production environment. This kind of pipeline that automatically deploys
code all the way through to production can be considered an implementation of
"continuous deployment." While this is a noble ideal, for many there are
good reasons why continuous deployment might not be practical, but those can
still enjoy the benefits of continuous delivery.
Jenkins Pipeline readily supports both.