Precedence of Gitlab Artifacts

I am working on a use case where I perform some operations in files and upload them as an artifact to the next stage.

The file already exists in the repository, so the next stage executes it get the artifacts but it not going to override the file by artifacts.

Here is the link to the repository*

Pipeline link

From the logs, it seems like the order should be

  • Clone repo
  • Download artifacts (at this should it should replace file during clone)
Initialized empty Git repository in /builds/adilm717/test-artifact-override-behavior/.git/
Created fresh repository.
Checking out bf9bcdc6 as the main...
Skipping Git submodules setup
Downloading artifacts
00:01
Downloading artifacts for build-job (1532361718)...
Downloading artifacts from coordinator... ok        id=1532361718 responseStatus=200 OK token=jWNuv-oE

I expect that pipeline should override existing files/folders by artifacts, but it is not.

Is there a way to change this behavior or what can be the alternative approach?
Should I download the artifact manually through download API?

Thanks

1 Like

Hi @adilm717
From your tests it seems that artifacts don’t overwrite files. If you need this behaviour I suggest to move the files to a different path in the build job.
After the artifacts are extracted in test job you can use before_script or add steps to script to move them to the original path and overwrite files.