More broadly, we strongly encourage users to minimize the number of distinct steps in a Pipeline build, so that
node {
stage('Checkout') {
checkout scm
}
stage('Build') {
sh 'mvn -DskipTests package'
}
stage('Test') {
sh 'mvn surefire:test'
}
}
should be reduced to
node {
stage('Checkout') {
checkout scm
}
stage('Main') {
sh 'mvn package'
}
}
or even moving the details to an external versioned file in whatever language is most convenient, so that the Pipeline script itself stays short enough to not need testing or frequent patching:
node {
stage('Checkout') {
checkout scm
}
stage('Main') {
sh 'bash ci.sh'
}
}
(For now, the checkout cannot be easily moved to an external script, since Jenkins SCM plugins do some complex things with authentication, PR merging, changelog generation, and polling which are tricky to replace with a plain git clone, not to mention that you need to bootstrap a checkout just to get an external script to run!)
The problem is that when you do this, you lose some richness of detail in build visualizations. From the text console, this is not so visible, but from Blue Ocean it is. In this case, you lose the ability to see quickly which “stage” the build is in, even if ci.sh is running multiple long-running subcommands. What we would like is for your ci.sh to look something like
echo === Building
mvn -DskipTests package
echo === Testing
mvn surefire:test
where the visualization layers would automatically pick up the section headers (you could also use https://en.wikipedia.org/wiki/Page_break etc.) and display them just like stage or other labels present in Pipeline script. (Delimiters could even be made to match built-in output of various build tools. For example using [INFO] --- would allow a one-line script mvn test to show structure in the Jenkins UI.)
Dean does not work on this plugin. I am also stepping down as maintainer, so the plugin is up for adoption