Search code examples
gitlabgitlab-cigitlab-ci-runnerartifact

Where does Gitlab CI build stores artifacts into runner?


I am using private windows runner for gitlab ci to build .Net application, I am looking for the path where gitlab CI stores artifacts after each build in windows runner.

I am able to download artifacts through gitlab API or UI but I just need to know it's actual path on runner machine to copy it to other folder every time.

I have checked the GitLab documentation and found it's stores in path /var/opt/gitlab/gitlab-rails/shared/artifacts for linux runner but they haven't mentioned path for windows runner.

On the question: Where does gitlab-runner download job artifacts zip file? it is mentioned that artifacts are downloaded into same build directory where code is cloned but when I check that path in windows, i.e. C:\Program Files\GitLab-Runner\builds\RcLyerg4\0\path\to\repo I could not find artifacts there.

Please help me finding path on of artifacts on windows runner.


Solution

  • Artifacts are generally not stored on the runner. They are uploaded to the GitLab server for storage. Your GitLab server may be configured to store them locally on disk or remotely in S3-compatible storage, depending on your server configuration.

    I have checked GitLab documentation and found it's stores in path /var/opt/gitlab/gitlab-rails/shared/artifacts for linux runner but they haven't mentioned path for windows runner

    This documentation talks about the GitLab server configuration and where artifacts are stored on the GitLab server (not the runner). That's why there's no mention of a storage path on Windows, because the GitLab server itself only runs on Linux platforms :-)

    When you download an artifact from GitLab, you're downloading it from the GitLab server, not the runner. You can disconnect/destroy your runner and your artifacts will still be on the GitLab server and available for download (until they expire).


    Depending on which executor you're using, its configuration, and your job configuration, job artifacts might be present on the runner in some form or another after a job completes. However, it depends on all these details and it's possible that the artifacts are removed immediately after they are uploaded to GitLab and the job ends.
    In the case of a shell executor, you might be able to find artifacts within your build workspace for the job that originally produced and uploaded the artifact, but you can't rely on this and this implementation detail may change in the future. For more context, see issues #3856 and #29446 (among many other similar issues).

    At the end of the day, the only reliable place from which to retrieve artifacts after your job completes is your GitLab server.