I'm trying to setup Gitlab CI for a project I'm working on (PHP - Symfony 4 / MySQL). I've got the .gitlab-ci.yml file created with the necessary steps to prepare a Docker image. One of the steps is to run composer install - this should normally install a bunch of linked code, a few of which come from private repositories (also stored on Gitlab).
I'm trying to work out the current best practice for allowing the Gitlab CI runner to clone this code from it's private repo. I see reference in other Stack Overflow posts to the ${CI_JOB_TOKEN} variable, but seem to be missing the connecting bits of information to make it work - for example, do I need to modify the private repos to access this variable as a deploy token somehow, or does this happen automatically as Gitlab is cloning code from it's own servers?
Does anyone have a complete example of a .gitlab-ci.yml file that can clone code from a private repo using composer? If it's relevant, there are 4 private repos I need to clone, and will need to have the same CI setup for many projects that rely on these based libraries.