Start with empty job directory (when using GIT_STRATEGY: none)
Description
We use the Gitlab CI pipeline with stages "build" and "review".
The "review" stage uses GIT_STRATEGY: none
and gets all content from artifacts.
But because we don't start with an clean empty directory, the current artifacts are mixed with code of older builds (older artifacts).
So we get an mix of different versions (in case of new or deleted files) which breaks our software.
From the docs: Git repository data may be present, but it is certain to be out of date, so you should only rely on files brought into the project workspace from cache or artifacts.
For example in the "vendors" directory of our software the files are mixed together, so I don't have the chance to only rely on files brought into the project workspace from cache or artifacts.
I've tried to use a before_script
to clean the directory, but it's called after downloading the artifacts. So it's too late to delete the current directory.
Proposal
We need a configuration variable to empty the directory before downloading the artifacts. Something like:
GIT_STRATEGY: empty # like "none" but deletes the current job directory too
or
STAGE_DIRECTORY: clean