Jobs can output an archive of files and directories. This output is known as a job artifact.
You can download job artifacts by using the GitLab UI or the API.
For administrator information about job artifact storage, see administering job artifacts.
Create job artifacts
To create job artifacts, use the
artifacts keyword in your
pdf: script: xelatex mycv.tex artifacts: paths: - mycv.pdf expire_in: 1 week
In this example, a job named
xelatex command to build a PDF file from the
LaTeX source file,
paths keyword determines which files to add to the job artifacts.
All paths to files and directories are relative to the repository where the job was created.
If you run two types of pipelines (like branch and scheduled) for the same ref, the pipeline that finishes later creates the job artifact.
For more examples, view the keyword reference for the
Download job artifacts
You can download job artifacts or view the job archive:
On the Pipelines page, to the right of the pipeline:
On the Jobs page, to the right of the job:
On a job's detail page. The Keep button indicates an
expire_invalue was set:
On a merge request, by the pipeline details:
When browsing an archive:
If GitLab Pages is enabled in the project, you can preview HTML files in the artifacts directly in your browser. If the project is internal or private, you must enable GitLab Pages access control to preview HTML files.
View failed job artifacts
If the latest job has failed to upload the artifacts, you can see that information in the UI.
Delete job artifacts
WARNING: This is a destructive action that leads to data loss. Use with caution.
You can delete a single job, which also removes the job's artifacts and log. You must be:
- The owner of the job.
- A maintainer of the project.
To delete a job:
- Go to a job's detail page.
- At the top right of the job's log, select the trash icon.
- Confirm the deletion.
Retrieve job artifacts for other projects
To retrieve a job artifact from a different project, you might need to use a private token to authenticate and download the artifact.
How searching for job artifacts works
In GitLab 13.5 and later, artifacts for parent and child pipelines are searched in hierarchical order from parent to child. For example, if both parent and child pipelines have a job with the same name, the job artifact from the parent pipeline is returned.
Access the latest job artifacts by URL
You can download the latest job artifacts by using a URL.
To download the whole artifacts archive:
To download a single file from the artifacts:
For example, to download the latest artifacts of the job named
main branch of the
gitlab project in the
To download the file
coverage/index.html from the same artifacts:
To browse the latest job artifacts:
To download specific files, including HTML files that are shown in GitLab Pages:
For example, when a job
coverage creates the artifact
When job artifacts are deleted
By default, the latest job artifacts from the most recent successful jobs are never deleted.
If a job is configured with
its artifacts only expire if a more recent artifact exists.
Keep artifacts from most recent successful jobs
Keeping the latest artifacts can use a large amount of storage space in projects with a lot of jobs or large artifacts. If the latest artifacts are not needed in a project, you can disable this behavior to save space:
- Go to the project's Settings > CI/CD > Artifacts.
- Clear the Keep artifacts from most recent successful jobs checkbox.
You can disable this behavior for all projects on a self-managed instance in the instance's CI/CD settings.
When you disable the feature, the latest artifacts do not immediately expire. A new pipeline must run before the latest artifacts can expire and be deleted.
Troubleshooting job artifacts
No files to upload
This message is often preceded by other errors or warnings that specify the filename and why it wasn't generated. Check the job log for these messages.
If you find no helpful messages, retry the failed job after activating CI/CD debug logging. This logging should provide information to help you investigate further.