Skip to content
Snippets Groups Projects

Cleanup stuck CI builds

Merged Kamil Trzcińśki requested to merge drop-old-builds into master

Merge request reports

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
4
5 recurrence { daily }
6
7 def perform
8 Rails.logger.info 'Cleaning stuck builds'
9
10 Ci::Build.pending.where('created_at < ?', 1.day.ago).find_each(batch_size: 50).each do |build|
11 Rails.logger.debug "Dropping pending build #{build.id}"
12 build.drop
13 end
14
15 Ci::Build.running.where('started_at < ?', 1.day.ago).find_each(batch_size: 50).each do |build|
16 Rails.logger.debug "Dropping running build #{build.id}"
17 build.drop
18 end
19 end
  • However, we should execute the following code once for GitLab.com.

    @ayufan what do you mean?

  • @dzaporozhets I think @ayufan is eager to run this cleanup on gitlab.com now, instead of in a month.

  • Once this gets merged we can just install the file on some of the gitlab.com servers.

  • Added 1 commit:

    • 89a05880 - 1 commit from branch master
  • Author Maintainer
  • mentioned in issue #3143 (closed)

  • @ayufan looks good. Merge it

  • username-removed-444 Milestone changed to 8.2

    Milestone changed to 8.2

  • Kamil Trzcińśki Title changed from Cleanup stuck CI builds to WIP: Cleanup stuck CI builds

    Title changed from Cleanup stuck CI builds to WIP: Cleanup stuck CI builds

  • Author Maintainer

    @dzaporozhets We had talk with @jacobvosmaer and @razer6 about it and it will not be good solution to set the hard limit for running builds. I'll change it to relay on updated_at for pending and running builds as indication if the build is dead or not.

  • The reason was that some people have CI builds that take days.

  • Added 1 commit:

    • 37e67f1f - Cleanup stuck CI builds daily
  • Kamil Trzcińśki Title changed from WIP: Cleanup stuck CI builds to Cleanup stuck CI builds

    Title changed from WIP: Cleanup stuck CI builds to Cleanup stuck CI builds

  • Kamil Trzcińśki Added 177 commits:

    Added 177 commits:

    • 37e67f1f...5782217b - 176 commits from branch master
    • 4357736c - Cleanup stuck CI builds daily
  • @ayufan looks good. Make tests green and merge

  • Reassigned to @ayufan

  • Kamil Trzcińśki Added 20 commits:

    Added 20 commits:

    • 4357736c...fb2f8be4 - 19 commits from branch master
    • 8d2758e0 - Cleanup stuck CI builds daily
  • Kamil Trzcińśki Status changed to merged

    Status changed to merged

  • mentioned in commit 77ef4855

  • mentioned in issue #27523 (closed)

  • Please register or sign in to reply
    Loading