zendesk / samson

Web interface for deployments, with plugin architecture and kubernetes support
Other
1.45k stars 234 forks source link

Losing functionality after moving Github repo across Github organization #3983

Closed dimmaski closed 3 years ago

dimmaski commented 3 years ago

Some of the Samson functionality gets lost after migrating a GitHub repository between orgs, even if the GITHUB_TOKEN has access to both of the organizations and repo. If one tries to change the github repository URL in order to mitigate the issue the following error shows up: Screen Shot 2021-10-26 at 3 46 12 PM.

I can see in the logs that the operation Started PATCH "/projects/<project>" does not show any significant errors. Samson version: v3318

grosser commented 3 years ago

try clearing the cache of that repo so it does a clean checkout (go into the the samson host and delete the directory, it will be inside cached_repos directory)

dimmaski commented 3 years ago

Thank you for the tip @grosser! I've tried that but without luck, still can't change the Repository url config at the project level, git checkouts function properly, Github is automatically redirecting some of the requests from the old org to the new org.

grosser commented 3 years ago

try using a url that does not involve redirects, that might be causing the issue try running this on the samson host and see if it works:

https://github.com/zendesk/samson/blob/ee74690e0740174854fed9cc5b5d801d6e7ce88d/app/models/git_repository.rb#L72
dimmaski commented 3 years ago

That is precisely what I want to do, I want to avoid using the URL pointing to old github organization (which gets redirected), but samson is not allowing me to change the URL.

grosser commented 3 years ago

if you have a rails console then step through the validation to see how it breaks I'd think it's that git call that causes the issue otherwise can directly update the url via Project.find_by_permalink('foo').update_coumn(:repository_url, "new url goes here")

On Tue, Oct 26, 2021 at 9:31 AM Diogo Fernandes @.***> wrote:

That is precisely what I want to do, I want to avoid using the URL pointing to old github organization (which gets redirected), but samson is not allowing me to change the URL.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/zendesk/samson/issues/3983#issuecomment-952111671, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAACYZ4NKIDHT7DJBHRWFK3UI3QXTANCNFSM5GYBPM2A . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

dimmaski commented 3 years ago

Is running that command suitable for production? I'm not sure of the impacts it might have. Would it have the same effect to change the URL directly in the database?

dimmaski commented 3 years ago

I changed the DB column directly and it worked, thanks 👍