### Open the Rails console. This may take a moment to load.
sudo gitlab-rails console

### Find builds with artifacts
builds_with_artifacts = Ci::Build.with_artifacts_archive

### Clear out eveything more than a week old. You can adjust this time range to your preference
builds_to_clear = builds_with_artifacts.where("finished_at < ?", 1.week.ago)
builds_to_clear.each do |build|
  build.artifacts_expire_at = Time.now
  build.erase_erasable_artifacts!
end

Комментарии ()