zendesk/samson

Losing functionality after moving Github repo across Github organization

dimmaski opened this issue · 7 comments

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

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)

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.

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

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.

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?

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