[docker-executor] Run script as part of Pre-job

We use the android ‘repo’ tool to build our project, and I am in the phase of making it run as part of a gitlab CI pipeline. The build job is supposed to run in a docker image deployed by the runner, and this part works as expected.

Since gitlab does not integrate with repo, I added the source checkout phase as a ‘before_script’. But unfortunately, repo then depends on the content of the image to run, and this one is pretty old.

As I understand it, the docker executor has it’s own image to perform the git-clone and artifacts retrieval, and this is called Pre-job (The Docker executor | GitLab)

Is it possible to add commands to be run during the Pre-job phase ?


If you are using your own runners, you can can override the helper image: Advanced configuration | GitLab

To run something every time in a pre-build phase, you can consider injecting the commands into the pre_build_script config within the [[runners]] section in its config.toml: Advanced configuration | GitLab

1 Like

Thanks a lot for the answer @hchouraria , this could indeed enable me to run repo in a controlled context.
In the meantime, I convinced the team to switch to git submodules; and keep our CI system as “uncustomized” as possible.

If I use a custom helper image, would it be possible to inject the changelog of all the sub-projects into the build’s meta-data ?

1 Like