Skip to content
GitLab
Next
    • GitLab: the DevOps platform
    • Explore GitLab
    • Install GitLab
    • How GitLab compares
    • Get started
    • GitLab docs
    • GitLab Learn
  • Pricing
  • Talk to an expert
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
    Projects Groups Topics Snippets
  • Register
  • Sign in
  • GitLab GitLab
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributor statistics
    • Graph
    • Compare revisions
    • Locked files
  • Issues 51,948
    • Issues 51,948
    • List
    • Boards
    • Service Desk
    • Milestones
    • Iterations
    • Requirements
  • Merge requests 1,580
    • Merge requests 1,580
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Artifacts
    • Schedules
    • Test cases
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Container Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Metrics
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Code review
    • Insights
    • Issue
    • Repository
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • GitLab.orgGitLab.org
  • GitLabGitLab
  • Issues
  • #266958
Closed
Open
Issue created Oct 12, 2020 by Jochen Ulrich@julrich

"Keep latest artifacts" keeps artifacts of failed pipelines

Summary

Until there is a successful pipeline, the "Keep latest artifacts" feature (#16267 (closed)) keeps the artifacts of all failing pipelines

Steps to reproduce

  1. Create a project and setup a CI/CD pipeline with some artifacts
  2. Add a job which fails, for example by setting the script to exit 1
  3. Run the pipeline a few times

Example Project

https://gitlab.com/julrich/gitlab-keep-latest-artifacts-failing-pipeline

Note: When browsing the artifacts via the UI in the example project, it is not possible to open the artifacts of the failed pipelines (it shows the 404 page). This is maybe related to #249132. However, if you download the artifacts archive, it actually contains the artifacts so they are really still there.

What is the current bug behavior?

GitLab keeps the artifacts of the successful jobs of all failing pipelines.

All those artifacts will expire as soon as there is one successful pipeline. However, if the artifacts are big and the job keeps failing for some time, then this can quickly fill up a GitLab instance.

What is the expected correct behavior?

GitLab should only keep artifacts of successful pipelines despite the expires_in setting. Artifacts from jobs of failed pipelines should expire according to the expires_in setting.

In doubt, it would probably be okay to keep the artifacts of the lastest failed pipeline as well. But keeping the artifacts of all failing pipelines since the last successful pipeline is not reasonable.

Relevant logs and/or screenshots

GitLabKeepLatestArtifactFailingPipeline

Also interesting to note: After the expiry time, the artifact download button vanishes from the pipeline page. Even for successful pipelines.

Output of checks

This bug happens on GitLab.com

Solution

I think we can unlock each pipeline as it fails with something like:

      before_transition any => :failed do |pipeline, transition|
        pipeline.locked = :unlocked
        transition.args.first.try do |reason|
          pipeline.failure_reason = reason
        end
      end

This page may contain information related to upcoming products, features and functionality. It is important to note that the information presented is for informational purposes only, so please do not rely on the information for purchasing or planning purposes. Just like with all projects, the items mentioned on the page are subject to change or delay, and the development, release, and timing of any products, features, or functionality remain at the sole discretion of GitLab Inc.

Edited Feb 07, 2022 by 🤖 GitLab Bot 🤖
Assignee
Assign to
Time tracking