I'd recommend trying to do this using the Snippet Generator, General SCM, Git ... make sure you are on workflow 1.4 at least.
It will help you put together something like this, taking advantage of all the extensions available. I'm thinking what you really want is the ' doGenerateSubmoduleConfigurations: true" part.
checkout([$class: 'GitSCM', branches: [[name: 'master']], doGenerateSubmoduleConfigurations: true, extensions: [[$class: 'WipeWorkspace'], [$class: 'SparseCheckoutPaths', sparseCheckoutPaths: [[path: 'build']]]], userRemoteConfigs: [[credentialsId: 'secretc', url: 'g...@github.com:sample/sample.git']]])
Cheers,
tim