GITLAB_ARTIFACT_EXPIRED cicd resource_error ai_generated true

ERROR: Job failed: artifact 'build.zip' has expired. Artifacts are kept for 30 days by default.

ID: cicd/gitlab-ci-artifact-expired

Also available as: JSON · Markdown · 中文
90%Fix Rate
84%Confidence
1Evidence
2024-04-15First Seen

Version Compatibility

VersionStatusIntroducedDeprecatedNotes
GitLab CE/EE 16.5.x active
GitLab CE/EE 16.6.x active
GitLab Runner 16.5.x active

Root Cause

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.

generic

中文

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

Official Documentation

https://docs.gitlab.com/ee/ci/yaml/#artifactsexpire_in

Workarounds

  1. 95% success 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"`
    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. 85% success 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`
    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`

中文步骤

  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`

Dead Ends

Common approaches that don't work:

  1. 80% fail

    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.

  2. 90% fail

    Re-running the failed job without re-running the dependency job that produced the artifact will still reference the expired artifact and fail again.