I am trying to use a private git repo as a submodule in my application. Locally I can clone my main repo and pull all submodules correctly.
I am using GitLab.com for my hosting and runner. In GitLab runner, a GitHub hosted public repo pulls fine, but a private GitLab hosted repo will not pull the latest code. I am the owner of the main project as well as the private submodule.
I noticed this started after I made and pushed a change to my submodule while working on my main project.
When I attempt an automated build on the GitLab runner, the submodule will pull, but even though it shows the correct (current/latest) Git Ref SHA1, the files are shown from a commit long ago. I have attempted many iterations of ways to fetch the private repo and I have pushed insignificant changes to my submodule. Even still I am unable to pull the most recent version of the submodule code.
I have tried using the builtin GitLab runner variables to pull the submodules and I have setup the before_script to attempt a manual pull.
I have also made sure to update my local submodule and commit the changes to my main repo.
Here is using the GitLab runner variable
variables:
GIT_SUBMODULE_STRATEGY: recursive
Here is a sample before script, I have tried this with and without setting GIT_SUBMODULE_STRATEGY: none I have tried many variations of this removing and adding lines trying to get the most recent code.
- git submodule sync --recursive
- git submodule update --force --recursive --remote
- git submodule foreach git pull
- git submodule status
- git submodule foreach git log -1
Expected: GitLab runner should pull the latest commit on the branch of the submodule.
Actual: GitLab pulls the submodule, but code changes after a certain commit do not show even though the shown commit is current.