I have a submodule A that is not a standalone application. It requires the main application for it to work. I would like to create a CI build for A so that whenever a commit
This can be done in two steps:
Enable a build trigger url on the Jenkins job you want to build. This is done under "Trigger builds remotely" tab. The url will be in the form: JENKINS_URL/job/MY_JOB_NAME/build?token=TOKEN_NAME
.
Setup a git post-receive hook in submodule A that calls the above url. An easy way to do so is simply to use curl: curl JENKINS_URL/job/MY_JOB_NAME/build?token=TOKEN_NAME
.
A push to submodule A will then trigger the main project Jenkins's job by calling the url. Configure the Jenkins job to update its code before build or any other specifics you need.
This answer provides a lot of details on how to setup the git hook.