diff options
Diffstat (limited to 'doc/ci/jobs/job_artifacts.md')
-rw-r--r-- | doc/ci/jobs/job_artifacts.md | 48 |
1 files changed, 28 insertions, 20 deletions
diff --git a/doc/ci/jobs/job_artifacts.md b/doc/ci/jobs/job_artifacts.md index b6269918ed9..f93068faf01 100644 --- a/doc/ci/jobs/job_artifacts.md +++ b/doc/ci/jobs/job_artifacts.md @@ -1,7 +1,7 @@ --- stage: Verify group: Pipeline Security -info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/product/ux/technical-writing/#assignments +info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://handbook.gitlab.com/handbook/product/ux/technical-writing/#assignments --- # Job artifacts **(FREE ALL)** @@ -67,6 +67,8 @@ is used. To prevent artifacts from expiring, you can select **Keep** from the job details page. The option is not available when an artifact has no expiry set. +By default, the [latest artifacts are always kept](#keep-artifacts-from-most-recent-successful-jobs). + ### With a dynamically defined name You can use [CI/CD variables](../variables/index.md) to dynamically define the @@ -227,17 +229,21 @@ unless the report is added as a regular artifact with `artifacts:paths`. You can download the artifacts archive for a specific job with a publicly accessible URL for the [job artifacts API](../../api/job_artifacts.md#download-the-artifacts-archive). -For example, to download the latest artifacts of a job named `build` in the `main` branch of a project on GitLab.com: +For example: -```plaintext -https://gitlab.com/api/v4/projects/<project-id>/jobs/artifacts/main/download?job=build -``` +- To download the latest artifacts of a job named `build` in the `main` branch of a project on GitLab.com: -For example, to download the file `review/index.html` from the latest job named `build` in the `main` branch of a project on GitLab.com: + ```plaintext + https://gitlab.com/api/v4/projects/<project-id>/jobs/artifacts/main/download?job=build + ``` -```plaintext -https://gitlab.com/api/v4/projects/<project-id>/jobs/artifacts/main/raw/review/index.html?job=build -``` +- To download the file `review/index.html` from the latest job named `build` in the `main` branch of a project on GitLab.com: + + ```plaintext + https://gitlab.com/api/v4/projects/<project-id>/jobs/artifacts/main/raw/review/index.html?job=build + ``` + + Files returned by this endpoint always have the `plain/text` content type. In both examples, replace `<project-id>` with a valid project ID, found at the top of the project details page. @@ -327,15 +333,21 @@ With this configuration, GitLab adds **artifact 1** as a link to `file.txt` to t > - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/16267) in GitLab 13.0. > - [Feature flag removed](https://gitlab.com/gitlab-org/gitlab/-/issues/229936) in GitLab 13.4. > - [Made optional with a CI/CD setting](https://gitlab.com/gitlab-org/gitlab/-/issues/241026) in GitLab 13.8. +> - Artifacts for [blocked](https://gitlab.com/gitlab-org/gitlab/-/issues/387087) or [failed](https://gitlab.com/gitlab-org/gitlab/-/issues/266958) pipelines no longer kept indefinitely in GitLab 16.7. + +By default artifacts are always kept for successful pipelines for the most recent commit on each ref. +Any [`expire_in`](#with-an-expiry) configuration does not apply to the most recent artifacts. -By default artifacts are always kept for successful pipelines for the most recent commit on -each ref. This means that the latest artifacts do not immediately expire according -to the `expire_in` configuration. +A pipeline's artifacts are only deleted according to the `expire_in` configuration +if a new pipeline runs for the same ref and: -If a pipeline for a new commit on the same ref completes successfully, the previous pipeline's -artifacts are deleted according to the `expire_in` configuration. The artifacts -of the new pipeline are kept automatically. If multiple pipelines run for the most -recent commit on the ref, all artifacts are kept. +- Succeeds. +- Fails. +- Stops running due to being blocked by a manual job. + +Additionally, artifacts are kept for the ref's last successful pipeline even if it +is not the latest pipeline. As a result, if a new pipeline run fails, the last successful pipeline's +artifacts are still kept. 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 @@ -352,7 +364,3 @@ Then the artifacts in the earlier pipeline for that ref are allowed to expire to You can disable this behavior for all projects on a self-managed instance in the [instance's CI/CD settings](../../administration/settings/continuous_integration.md#keep-the-latest-artifacts-for-all-jobs-in-the-latest-successful-pipelines). - -When **Keep artifacts from most recent successful jobs** is enabled, artifacts are always kept for [blocked](job_control.md#types-of-manual-jobs) -pipelines. These artifacts expire only after the blocking job is triggered and the pipeline completes. -[Issue 387087](https://gitlab.com/gitlab-org/gitlab/-/issues/387087) proposes to change this behavior. |