| Under Global Tool Configuration replace the Default Git installation with a custom one that uses a shell script. In our case we have 2 installers with filters:
- master: the script is just `true` and Tool Home is `/usr/bin/git`
- !master: the script is installing a simple shell wrapper to perform retry logic when the git commands fails due to transient network or server side glitches. The Tool Home is the path to the wrapper.
We use the GitHub Organization Plugin to scan our repos and trigger our CI pipelines, and we use the Kubernetes plugin to launch ephemeral workers for each stage. The kubernetes plugin is configured with a default 'jnlp' pod definition which is nothing more that the default pod definition that comes with the kubernetes plugin. The Jenkinsfile has parallel stages, it does not matter what the stages do. Very randomly, and infrequently, with no apparent cause one of the stages will get an empty git executable name with the stack trace provided in the description. Sample Jenkinsfile:
pipeline {
agent none
options {
ansiColor('xterm')
timestamps ()
buildDiscarder(logRotator(daysToKeepStr: '30'))
timeout(time: 5, unit: 'MINUTES')
}
stages {
stage('Tests') {
parallel {
stage('sleep 1') {
agent { kubernetes { label 'jnlp' } }
steps { sh 'sleep 1' }
}
stage('sleep 2') {
agent { kubernetes { label 'jnlp' } }
steps { sh 'sleep 2' }
}
stage('sleep 3') {
agent { kubernetes { label 'jnlp' } }
steps { sh 'sleep 3' }
}
stage('sleep 4') {
agent { kubernetes { label 'jnlp' } }
steps { sh 'sleep 4' }
}
stage('sleep 5') {
agent { kubernetes { label 'jnlp' } }
steps { sh 'sleep 5' }
}
}
}
}
post { always { chuckNorris() } }
}
|