Richard Spindler
Posted on July 6, 2021
There is one simple tutorial that I was looking for on the web, and I could not find it.
So I wrote it myself.
Jenkins has matrix builds, and Jenkins has agent docker for builds inside a docker image.
Combined, these features make it easy to test a project with multiple versions of PHP for example.
So here is the simple example I came up with: Put this in your Jenkinsfile and you are done.
pipeline {
agent none
stages {
stage('Test') {
matrix {
agent {
docker { image "${DOCKER_IMAGE}" }
}
axes {
axis {
name 'DOCKER_IMAGE'
values 'php:5.3', 'php:5.6'
}
}
stages {
stage('Test') {
steps {
sh 'php --version'
}
}
}
}
}
}
}
Please let me know if it helps you 😊
Learning more
Testing your software in different environments is a best practice for software engineering.
If you like this article: I am writing a book about best practices for legacy code projects:
💖 💪 🙅 🚩
Richard Spindler
Posted on July 6, 2021
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.