-
Notifications
You must be signed in to change notification settings - Fork 28
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(api/admin): add endpoint to clean pending / running builds #863
Conversation
Codecov Report
@@ Coverage Diff @@
## main #863 +/- ##
==========================================
+ Coverage 66.13% 66.26% +0.13%
==========================================
Files 297 300 +3
Lines 13876 13930 +54
==========================================
+ Hits 9177 9231 +54
Misses 4252 4252
Partials 447 447
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i wouldn't mind seeing some INFO-level logging between each table cleanup.
|
||
// ensure the mock expects the name query | ||
_mock.ExpectExec(`UPDATE "builds" SET "status"=$1,"error"=$2,"finished"=$3,"deploy_payload"=$4 WHERE created < $5 AND (status = 'running' OR status = 'pending')`). | ||
WithArgs("error", "msg", time.Now().UTC().Unix(), AnyArgument{}, 3). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this going to create a flaky test? Because timestamp is calculated both in the test and in the code under test.
Ditto for the step and service clean tests.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would if we were comparing the objects, but all we do is check the count in the test
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice
Oftentimes during upgrades, network blips, or failures in worker-server communication, builds, steps, and or services, never make it out of
pending
orrunning
states. This endpoint gives platform admins the power to clean build resources that have been pending or running for longer than a specified time as well as give the builds a specified error message.