profileRyan KesPGP keyI build stuffEmailGithubTwitterLast.fmMastodonMatrix

Gitlab

Troubleshooting

Artifacts1

Delete artifacts older than a specific date

From gitlab-rails console:

builds_to_clear = builds_with_artifacts.where("finished_at < ?", 1.week.ago)
builds_to_clear.find_each do |build|
  build.artifacts_expire_at = Time.now
  build.erase_erasable_artifacts!
end

The same can be done to include logs as well:

builds_to_clear = builds_with_artifacts.where("finished_at < ?", 1.week.ago)
builds_to_clear.find_each do |build|
  print "Ci::Build ID #{build.id}... "

  if build.erasable?
    build.erase(erased_by: admin_user)
    puts "Erased"
  else
    puts "Skipped (Nothing to erase or not erasable)"
  end
end

Expiration cron job

In /etc/gitlab/gitlab.rb enable gitlab_rails['expire_build_artifacts_worker_cron'] = "*/7 * * * *".

Footnotes