Jenkins use git submodule with declarative pipeline
To use/checkout a submodule in a Jenkins declarative pipeline use this:
Own example
stage ('Build') {
sh 'git submodule update --init --recursive'
sh "docker build -t technotes:1 ."
}
Stack overflow example
pipeline {
agent any
environment {
GIT_SSH_COMMAND = 'ssh -i /path/to/my/private/key'
}
stages {
stage('Build') {
steps {
sh 'printenv'
sh 'git submodule update --init --recursive'
}
}
}
}