-
-
Notifications
You must be signed in to change notification settings - Fork 5.4k
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
Cleanup resources when create/adopt/generate repository failed #31035
base: main
Are you sure you want to change the base?
Conversation
services/repository/create.go
Outdated
@@ -240,13 +241,13 @@ func CreateRepositoryDirectly(ctx context.Context, doer, u *user_model.User, opt | |||
ObjectFormatName: opts.ObjectFormatName, | |||
} | |||
|
|||
var rollbackRepo *repo_model.Repository | |||
needsUpdateStatus := opts.Status == 0 |
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.
needsUpdateStatus := opts.Status == 0 | |
needsUpdateStatus := opts.Status == repo_model.RepositoryReady |
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.
And the previous logic is wrong. It should be opts.Status != repo_model.RepositoryReady
.
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 also confused about it.
services/repository/adopt.go
Outdated
if err := repo_module.CreateRepositoryByExample(ctx, doer, u, repo, true, false); err != nil { | ||
return err | ||
} | ||
if err := repo_module.CreateRepositoryByExample(ctx, doer, u, repo, true, false); err != nil { |
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.
Will it be rollbacked when it failed?
If yes, then LGTM.
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.
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.
CreateRepositoryNotice has two same messages, maybe it is better to adjust them
I will try to have some tests. |
Fix #28144