Hello,
i am trying to manually delete old artifacts and i am following the steps in the documentation mentioned here : delete-job-artifacts-from-jobs-completed-before-a-specific-date
Steps to reproduce
builds_with_artifacts = Ci::Build.with_downloadable_artifacts
admin_user = User.find_by(username: 'admin_user')
builds_to_clear = builds_with_artifacts.where("finished_at < ?", 3.months.ago
irb(main):010:1* builds_to_clear.find_each do |build|
irb(main):011:1* print "Ci::Build ID #{build.id}... "
irb(main):012:1*
irb(main):013:2* if build.erasable?
irb(main):014:2* Ci::BuildEraseService.new(build, admin_user).execute
irb(main):015:2* puts "Erased"
irb(main):016:2* else
irb(main):017:2* puts "Skipped (Nothing to erase or not erasable)"
irb(main):018:1* end
irb(main):019:0> end
and finally i get this output
Ci::Build ID 34549... Erased
Ci::Build ID 34558... Erased
Ci::Build ID 34620... Erased
Ci::Build ID 34715... Erased
Ci::Build ID 34735... Erased
Ci::Build ID 34739... Erased
Ci::Build ID 34785... Erased
=> nil
and now when i want to fetch artifacts again using:
builds_with_artifacts = Ci::Build.with_downloadable_artifacts
builds_to_clear = builds_with_artifacts.where("finished_at < ?", 3.weeks.ago)
i get => an empty array which means that they don’t exist anymore normally
but when i enter the dashboard i found the same old size and old artifacts always there
i am using Gitlab community edition self managed
version: 16