# 错误：作业失败：工件 'build.zip' 已过期。工件默认保留 30 天。

- **ID:** `cicd/gitlab-ci-artifact-expired`
- **领域:** cicd
- **类别:** resource_error
- **错误码:** `GITLAB_ARTIFACT_EXPIRED`
- **验证级别:** ai_generated
- **修复率:** 90%

## 根因

GitLab CI 作业失败，因为它尝试从之前已超过保留期的作业下载工件，当依赖项依赖于过期工件时，导致管道中断。

## 版本兼容性

| 版本 | 状态 | 引入 | 弃用 |
|------|------|------|------|
| GitLab CE/EE 16.5.x | active | — | — |
| GitLab CE/EE 16.6.x | active | — | — |
| GitLab Runner 16.5.x | active | — | — |

## 解决方案

1. ```
   Re-run the entire pipeline from the beginning to regenerate all artifacts: navigate to the pipeline page and click 'Run Pipeline' or trigger a new pipeline via API: `curl --request POST --header "PRIVATE-TOKEN: $TOKEN" "https://gitlab.com/api/v4/projects/$PROJECT_ID/trigger/pipeline?ref=main"`
   ```
2. ```
   If only specific artifacts are needed, re-run the job that produces the artifact using `CI_JOB_TOKEN` to download fresh artifacts: `job: stage: build script: - echo "Rebuilding artifact" artifacts: paths: [build.zip] expire_in: 7 days`
   ```

## 无效尝试

- **** — Increasing the artifact retention period in the project settings does not retroactively extend the expiration of already-uploaded artifacts; only new artifacts will have the updated policy. (80% 失败率)
- **** — Re-running the failed job without re-running the dependency job that produced the artifact will still reference the expired artifact and fail again. (90% 失败率)
