@Library('globalPipelineLibraryMarkEWaite') _
pipeline {
agent {
label '!windows && git-1.8+' // Older git versions don't do submodules well, use an sh step later, no windows
}
options {
skipDefaultCheckout()
}
stages {
stage('checkout') {
when {
// Only test when cloning from ssh protocol URL
// Submodule is defined with ssh protocol URL
expression { scm.userRemoteConfigs[0].url ==~ /g...@github.com:.*/ }
}
steps {
deleteDir()
checkout([$class: 'GitSCM',
branches: scm.branches,
userRemoteConfigs: scm.userRemoteConfigs,
extensions: [
[$class: 'SubmoduleOption', parentCredentials: true],
[$class: 'LocalBranch', localBranch: 'JENKINS-60529'],
],
gitTool: 'Default' // JGit in git client plugin does not fully support submodules
])
}
}
stage('build') {
when {
// Only test when cloning from ssh protocol URL
// Submodule is defined with ssh protocol URL
expression { scm.userRemoteConfigs[0].url ==~ /g...@github.com:.*/ }
}
steps {
echo 'SCM url is ' + scm.userRemoteConfigs[0].url
withAnt(installation: 'ant-latest', jdk: 'jdk8') {
sh 'ant info'
}
}
}
stage('verify') {
when {
// Only test when cloning from ssh protocol URL
// Submodule is defined with ssh protocol URL
expression { scm.userRemoteConfigs[0].url ==~ /g...@github.com:.*/ }
}
steps {
logContains([expectedRegEx: ".*Found:.*JENKINS-57936.*",
failureMessage: "Missing submodule README contents."])
}
}
}
}