Jenkins is on a detached head. Whenever a submodule gets updated, I need to trigger a build. However, only the main project gets cloned.
Two questions
- How do I tell Jenkins to trigger a build when a submodule gets updated, but not clone the submodule? I need the main project code cloned instead, but Jenkins still needs to start the build only when the submodule gets updated. So let's say say submodule A gets updated (a new commit ism adE), it should trigger a build where the main project code gets cloned. The submodule is not cloned.
- How do I pull the latest changes from the submodule to the submodule directory after Jenkins clones the main project? Granted, the submodule directory will be at a detached head. How do I pull the latest changes to the submodule from the most recent commit (I cannot use git submodule update because that does not pull the latest changes to the submodule).
Basically, I want to give each submodule its own CI environment for testing, but each submodule is not a standalone application; they depend on the main project. So when a submodule gets updated, we need the main project updated with the latest code from that submodule without having the submodule cloned, the code from the submodule must be pulled. I don't want to set the polling on the main project. Jenkins should be checking the submodule each time to check if there is a new commit