how to checkout only specific folder from git repo((monorepo)) and build
You can check out specific files or folders from a repo using git archive.  I've done this from a Jenkinsfile using a shell command like so:

sh("git archive --remote=${repo_url} ${ref} ${path} | tar x")


You will, of course, need to set the variables repo_url (the url of the remote repository), ref (the ref/branch/commit/etc. to check out), and path (the path of the file or folder within the repo to check out).