How do I have a local copy of the repository source code in the gitlab runner container

Hi, I want to implement a third party library scanning tool in my cicd pipeline for many repositories. However, this tool only works in local environment. I am thinking I should install this tool in a docker image and use the image to spin up a gitlab runner. What I couldn’t quite understand is how I’m supposed to have a local copy of the repository source codes inside my gitlab runner container? Do the files get copied by default or do I need to import them explicitly?

Thanks

Do the files get copied by default or do I need to import them explicitly?

They get copied by default. :slight_smile:

GitLab will pull the image and then clone/fetch the repository into it before executing anything.

You can see this happen in the job log where it states: "Getting source from Git repository`

For example, this CI pipeline will pull alpine:latest docker image, clone the greg/ci-job-clone-demo repository into it, then cat the README.md file from that repository.

Thanks for the clarification!

1 Like