-
Notifications
You must be signed in to change notification settings - Fork 5.6k
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
fix: Allow to delete repos with invalid urls (#20921) #20975
fix: Allow to delete repos with invalid urls (#20921) #20975
Conversation
❌ Preview Environment deleted from BunnyshellAvailable commands (reply to this comment):
|
a4ca51c
to
1d7b5e3
Compare
Fixes argoproj#20921 Normalization of repo url is attempted during repo deletion before comparison with existing repos. Before this change, it'd fail on invalid urls and return "", resulting in permission denied. This ended up in a state where people can add repos with invalid urls but couldn't delete them. Return raw repo url if url parsing failed. Add a test to validate the deletion can be performed and make sure it fails without the main change. This needs to be cherry-picked to v2.11-2.13 Signed-off-by: Andrii Korotkov <[email protected]>
1d7b5e3
to
6ccd0fc
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #20975 +/- ##
=========================================
Coverage ? 55.02%
=========================================
Files ? 324
Lines ? 55472
Branches ? 0
=========================================
Hits ? 30522
Misses ? 22329
Partials ? 2621 ☔ View full report in Codecov by Sentry. |
util/git/git.go
Outdated
// Similar to NormalizeGitURL, except returning a not fully normalized string when the url is invalid. | ||
// Needed to allow a deletion of repos with invalid urls. See https://github.com/argoproj/argo-cd/issues/20921. | ||
func NormalizeGitURLAllowInvalid(repo string) string { | ||
return normalizeGitURL(repo, true) |
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 think it will be better not to add allowInvalid parameter to private function. Can we just return original "repo" in case if error happens ? In such case you will not need to modify with additional conditions normalizeGitURL function
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've made the change.
Signed-off-by: Andrii Korotkov <[email protected]>
@pasha-codefresh, can we cherry pick this into 2.11-2.13, please? |
…oj#20975) * fix: Allow to delete repos with invalid urls (argoproj#20921) Fixes argoproj#20921 Normalization of repo url is attempted during repo deletion before comparison with existing repos. Before this change, it'd fail on invalid urls and return "", resulting in permission denied. This ended up in a state where people can add repos with invalid urls but couldn't delete them. Return raw repo url if url parsing failed. Add a test to validate the deletion can be performed and make sure it fails without the main change. This needs to be cherry-picked to v2.11-2.13 Signed-off-by: Andrii Korotkov <[email protected]> * Don't modify the original NormalizeGitURL Signed-off-by: Andrii Korotkov <[email protected]> --------- Signed-off-by: Andrii Korotkov <[email protected]> Signed-off-by: Adrian Aneci <[email protected]>
/cherry-pick release-2.13 |
/cherry-pick release-2.12 |
* fix: Allow to delete repos with invalid urls (#20921) Fixes #20921 Normalization of repo url is attempted during repo deletion before comparison with existing repos. Before this change, it'd fail on invalid urls and return "", resulting in permission denied. This ended up in a state where people can add repos with invalid urls but couldn't delete them. Return raw repo url if url parsing failed. Add a test to validate the deletion can be performed and make sure it fails without the main change. This needs to be cherry-picked to v2.11-2.13 Signed-off-by: Andrii Korotkov <[email protected]> * Don't modify the original NormalizeGitURL Signed-off-by: Andrii Korotkov <[email protected]> --------- Signed-off-by: Andrii Korotkov <[email protected]>
/cherry-pick release-2.11 |
* fix: Allow to delete repos with invalid urls (#20921) Fixes #20921 Normalization of repo url is attempted during repo deletion before comparison with existing repos. Before this change, it'd fail on invalid urls and return "", resulting in permission denied. This ended up in a state where people can add repos with invalid urls but couldn't delete them. Return raw repo url if url parsing failed. Add a test to validate the deletion can be performed and make sure it fails without the main change. This needs to be cherry-picked to v2.11-2.13 Signed-off-by: Andrii Korotkov <[email protected]> * Don't modify the original NormalizeGitURL Signed-off-by: Andrii Korotkov <[email protected]> --------- Signed-off-by: Andrii Korotkov <[email protected]>
Cherry-pick failed with |
2.11 has some conflicts, need to do it manually @andrii-korotkov-verkada |
* fix: Allow to delete repos with invalid urls (#20921) Fixes #20921 Normalization of repo url is attempted during repo deletion before comparison with existing repos. Before this change, it'd fail on invalid urls and return "", resulting in permission denied. This ended up in a state where people can add repos with invalid urls but couldn't delete them. Return raw repo url if url parsing failed. Add a test to validate the deletion can be performed and make sure it fails without the main change. This needs to be cherry-picked to v2.11-2.13 * Don't modify the original NormalizeGitURL --------- Signed-off-by: Andrii Korotkov <[email protected]> Co-authored-by: Andrii Korotkov <[email protected]>
* fix: Allow to delete repos with invalid urls (#20921) Fixes #20921 Normalization of repo url is attempted during repo deletion before comparison with existing repos. Before this change, it'd fail on invalid urls and return "", resulting in permission denied. This ended up in a state where people can add repos with invalid urls but couldn't delete them. Return raw repo url if url parsing failed. Add a test to validate the deletion can be performed and make sure it fails without the main change. This needs to be cherry-picked to v2.11-2.13 * Don't modify the original NormalizeGitURL --------- Signed-off-by: Andrii Korotkov <[email protected]> Co-authored-by: Andrii Korotkov <[email protected]>
Fixes #20921
Normalization of repo url is attempted during repo deletion before comparison with existing repos. Before this change, it'd fail on invalid urls and return "", resulting in permission denied. This ended up in a state where people can add repos with invalid urls but couldn't delete them. Return raw repo url if url parsing failed. Add a test to validate the deletion can be performed and make sure it fails without the main change.
This needs to be cherry-picked to v2.11-2.13
Checklist: