GITLAB_ARTIFACT_EXPIRED
cicd
resource_error
ai_generated
true
错误:作业失败:工件 'build.zip' 已过期。工件默认保留 30 天。
ERROR: Job failed: artifact 'build.zip' has expired. Artifacts are kept for 30 days by default.
ID: cicd/gitlab-ci-artifact-expired
90%修复率
84%置信度
1证据数
2024-04-15首次发现
版本兼容性
| 版本 | 状态 | 引入 | 弃用 | 备注 |
|---|---|---|---|---|
| GitLab CE/EE 16.5.x | active | — | — | — |
| GitLab CE/EE 16.6.x | active | — | — | — |
| GitLab Runner 16.5.x | active | — | — | — |
根因分析
GitLab CI 作业失败,因为它尝试从之前已超过保留期的作业下载工件,当依赖项依赖于过期工件时,导致管道中断。
English
GitLab CI job fails because it tries to download an artifact from a previous job that has exceeded its retention period, causing the pipeline to break when dependencies rely on expired artifacts.
官方文档
https://docs.gitlab.com/ee/ci/yaml/#artifactsexpire_in解决方案
-
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"`
-
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`
无效尝试
常见但无效的做法:
-
80% 失败
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.
-
90% 失败
Re-running the failed job without re-running the dependency job that produced the artifact will still reference the expired artifact and fail again.