I would like to know if it is possible to only run
git clean at the beginning of my CI pipeline but not between jobs of the same pipeline ?
I am using GitLab Community Edition version 14.8.2 on a self-hosted instance. Here is my setup (which explains my question), I have one single runner (version 14.10.0) to run my CI pipelines (so all jobs will be run on the same machine), hosted on a server with access to the Internet (so that it can communicate with the gitlab server hosted somewhere else). In addition, the runner is not actually doing the work but dispatches the computations to a local worker (which is a server without Internet access but with larger computing capability, required for my CI runs).
In my pipeline, I have different jobs, one configuring a local python environment, one compiling a software and one using this software and the python environment to run tests. So I would like for my jobs to share some files (environment setup, build products).
I know I can use the
artifact setup (which is totally designed to handle this) but since I have only one runner, I would like to avoid useless data transfer on the network (since the files are produced and used on the same machine during a pipeline run).
To avoid the destruction of untracked files at the beginning of each job, I use the following in my
variables: GIT_CLEAN_FLAGS: none
combined with a
pre. jobs doing:
preparation: stage: .pre before_script: - git clean -ffdx script: ## setup environment ## ...
to clean the repos at the beginning of the pipeline (for a fresh start).
Is there a better way to do what I want ? (without having to run the
git clean command manually)