-
-
Notifications
You must be signed in to change notification settings - Fork 5.8k
Add migrations and doctor fixes #33556
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
Changes from 7 commits
ab21418
889082e
f81ec57
8e878f7
968f542
febad27
2443d8f
4bf5911
5bd7b27
0f947d8
45d9712
4d7eb81
b028b91
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
// Copyright 2025 The Gitea Authors. All rights reserved. | ||
// SPDX-License-Identifier: MIT | ||
|
||
package v1_24 //nolint | ||
|
||
import ( | ||
"xorm.io/xorm" | ||
) | ||
|
||
func UpdateOwnerIDOfRepoLevelRunners(x *xorm.Engine) error { | ||
if _, err := x.Exec("UPDATE `action_runner` SET `owner_id` = 0 WHERE `repo_id` > 0 AND `owner_id` > 0"); err != nil { | ||
return err | ||
} | ||
if _, err := x.Exec("UPDATE `action_variable` SET `owner_id` = 0 WHERE `repo_id` > 0 AND `owner_id` > 0"); err != nil { | ||
return err | ||
} | ||
_, err := x.Exec("UPDATE `secret` SET `owner_id` = 0 WHERE `repo_id` > 0 AND `owner_id` > 0") | ||
return err | ||
} | ||
lunny marked this conversation as resolved.
Show resolved
Hide resolved
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,6 +12,7 @@ import ( | |
issues_model "code.gitea.io/gitea/models/issues" | ||
"code.gitea.io/gitea/models/migrations" | ||
repo_model "code.gitea.io/gitea/models/repo" | ||
secret_model "code.gitea.io/gitea/models/secret" | ||
"code.gitea.io/gitea/modules/log" | ||
"code.gitea.io/gitea/modules/setting" | ||
) | ||
|
@@ -164,6 +165,24 @@ func prepareDBConsistencyChecks() []consistencyCheck { | |
Fixer: repo_model.DeleteOrphanedTopics, | ||
FixedMessage: "Removed", | ||
}, | ||
{ | ||
Name: "Repository level Runners with non-zero owner_id", | ||
Counter: actions_model.CountWrongRepoLevelRunners, | ||
Fixer: actions_model.UpdateWrongRepoLevelRunners, | ||
FixedMessage: "Corrected", | ||
}, | ||
Comment on lines
+168
to
+173
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I looked up some code, could the fixer of "Action Runners without existing owner" cause data loss in a theoretical scenario as it's precondition repo_id is null is only ensured after the fixer "Repository level Runners with non-zero owner_id" ran.
Anyways a complex scenario that came in my mind due to review comments of my artifact PR that the owner_id is not well maintained for artifact objects during repository move, if this did really ever happend just register a new runner There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That's why we need to update |
||
{ | ||
Name: "Repository level Variables with non-zero owner_id", | ||
Counter: actions_model.CountWrongRepoLevelVariables, | ||
Fixer: actions_model.UpdateWrongRepoLevelVariables, | ||
FixedMessage: "Corrected", | ||
}, | ||
{ | ||
Name: "Repository level Secrets with non-zero owner_id", | ||
Counter: secret_model.CountWrongRepoLevelSecrets, | ||
Fixer: secret_model.UpdateWrongRepoLevelSecrets, | ||
FixedMessage: "Corrected", | ||
}, | ||
} | ||
|
||
// TODO: function to recalc all counters | ||
|
Uh oh!
There was an error while loading. Please reload this page.