I am working on the software repository DAMASK, where all the test are located in a private subdirectory called PRIVATE
. We have a gitlab-ci script, which we are currently slowly modifying to use the docker instead of the shell runner. However, since we have a subrepository where the tests that the pipeline needs to run are located, we are forced to add
before_script:
- git config --global --add safe.directory /builds/damask/DAMASK
- eval $(ssh-agent -s)
- echo "$SSH_PRIVATE_KEY" | tr -d '\r' | ssh-add -
- mkdir -p ~/.ssh
- chmod 700 ~/.ssh
- echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config
- git submodule sync
- git config --global --add safe.directory /builds/damask/DAMASK/PRIVATE
- git submodule update --init
Before every step that uses the docker runner and the PRIVATE tests. It would be much more efficient if there was a way to instantiate the repository with the subrepository already initiated and synced, so that each docker container starts with a complete code and doesn’t require the subrepository to be cloned each time.
Is there something we are missing, or a more effective way to accomplish this?