Introduction to job artifacts
- Since GitLab 8.2 and GitLab Runner 0.7.0, job artifacts that are created by GitLab Runner are uploaded to GitLab and are downloadable as a single archive (
tar.gz) using the GitLab UI.
- Starting with GitLab 8.4 and GitLab Runner 1.0, the artifacts archive format changed to
ZIP, and it is now possible to browse its contents, with the added ability of downloading the files separately.
- Starting with GitLab 8.17, builds are renamed to jobs.
- The artifacts browser will be available only for new artifacts that are sent to GitLab using GitLab Runner version 1.0 and up. It will not be possible to browse old artifacts already uploaded to GitLab.
- This is the user documentation. For the administration guide see administration/job_artifacts.
Artifacts is a list of files and directories which are attached to a job after it finishes. This feature is enabled by default in all GitLab installations.
Defining artifacts in
A simple example of using the artifacts definition in
.gitlab-ci.yml would be
pdf: script: xelatex mycv.tex artifacts: paths: - mycv.pdf expire_in: 1 week
A job named
xelatex command in order to build a pdf file from
the latex source file
mycv.tex. We then define the
artifacts paths which in
turn are defined with the
paths keyword. All paths to files and directories
are relative to the repository that was cloned during the build.
The artifacts will be uploaded when the job succeeds by default, but can be set to upload
when the job fails, or always, if the
parameter is used. These uploaded artifacts will be kept in GitLab for 1 week as defined
expire_in definition. You have the option to keep the artifacts from expiring
via the web interface. If the expiry time is not defined, it defaults
to the instance wide setting.
For more examples on artifacts, follow the artifacts reference in
Note: With GitLab 9.2, PDFs, images, videos and other formats can be previewed directly in the job artifacts browser without the need to download them.
Note: With GitLab 10.1, HTML files in a public project can be previewed directly in a new tab without the need to download them when GitLab Pages is enabled. The same holds for textual formats (currently supported extensions:
After a job finishes, if you visit the job's specific page, there are three buttons. You can download the artifacts archive or browse its contents, whereas the Keep button appears only if you have set an expiry date to the artifacts in case you changed your mind and want to keep them.
The archive browser shows the name and the actual file size of each file in the archive. If your artifacts contained directories, then you are also able to browse inside them.
Below you can see how browsing looks like. In this case we have browsed inside the archive and at this point there is one directory, a couple files, and one HTML file that you can view directly online when GitLab Pages is enabled (opens in a new tab).
If you need to download the whole archive, there are buttons in various places inside GitLab that make that possible.
While on the pipelines page, you can see the download icon for each job's artifacts archive in the right corner:
While on the Jobs page, you can see the download icon for each job's artifacts archive in the right corner:
While inside a specific job, you are presented with a download button along with the one that browses the archive:
And finally, when browsing an archive you can see the download button at the top right corner:
Downloading the latest artifacts
It is possible to download the latest artifacts of a job via a well known URL so you can use it for scripting purposes.
Note: The latest artifacts are considered as the artifacts created by jobs in the latest pipeline that succeeded for the specific ref. Artifacts for other pipelines can be accessed with direct access to them.
The structure of the URL to download the whole artifacts archive is the following:
To download a single file from the artifacts use the following URL:
For example, to download the latest artifacts of the job named
master branch of the
gitlab-ce project that belongs to the
namespace, the URL would be:
To download the file
coverage/index.html from the same
artifacts use the following URL:
There is also a URL to browse the latest job artifacts:
There is also a URL to specific files, including html files that are shown in GitLab Pages:
For example, when a job
coverage creates the artifact
you can access it at:
The latest builds are also exposed in the UI in various places. Specifically, look for the download button in:
- the main project's page
- the branches page
- the tags page
If the latest job has failed to upload the artifacts, you can see that information in the UI.
DANGER: Warning: This is a destructive action that leads to data loss. Use with caution.
You can erase a single job via the UI, which will also remove the job's artifacts and trace, if you are:
- The owner of the job.
- A Maintainer of the project.
To erase a job:
- Navigate to a job's page.
- Click the trash icon at the top right of the job's trace.
- Confirm the deletion.
Retrieve artifacts of private projects when using GitLab CI
In order to retrieve a job artifact of a different project, you might need to use a private token in order to authenticate and download the artifacts.