Skip to content
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

If "repo_server_path" changes, remotes for all repositoryes should be updated #4

Open
ivanhercaz opened this issue Apr 22, 2024 · 0 comments

Comments

@ivanhercaz
Copy link
Member

If we create a project with its respective repository and then, for any reason (e.g., a domain migration?), we need to change the repo_server_path on the plugins setting, it changes successfully and all the new projects and their repositories will be created correctly.

However, all the existing projects and their respective repositories, created with the previous repo_server_path will still be pointing to that previous value and all the features of cosmosys_git_rm will fail without any clear error in the UI.

The only way to confirm it is suspecting about the error given:

csys_rm-support  | App 851 output: remote: The project you were looking for could not be found or you don't have permission to view it.

Then, if we enter in the cosmoSys instance's container we can:

  1. First go to /home/redmine/gitbase/csys.
  2. Then enter in the affected repository directory.
  3. git remote get-url origin, it will return the remote origin with the previous repo_server_path.
  4. To solve it, git remote set-url origin <new_complete_origin_url>, where <new_complete_origin_url> must be equal to the one in cosmosys_git_rm plugin's setting UI, but replacing %project_id by the project for that project.

## Proposal

When the settings change, we should follow at least one or more of the next options:

  1. Automatically update the origins.
  2. Warns the user that already created projects still have the previous remote and asks (with a dialog or something else) to the user if they should be updated automatically by cosmosys_git_rm.
  3. Shows a table, in the settings, or somewhere, where the user can check if there are projects/repositories with remotes named origin that doesn't point to the current repo_server_path.

In case we decided to automatically update them after repo_server_path changes (1) or update them after the confirmation of the user (2), the implementation isn't hard, because cosmosys_git_rm will just need to traverse the repository directories and checks if its remote named origin matches with the current repo_server_path:

  1. If it matches, continue to the next directory.
  2. If it doesn't matches:
  3. Change the name of origin to previous_origin or origin_YEAR-MONTH-DAY (something that indicates us that there were a change).
  4. Set a new remote named origin with the current repo_server_path value but replacing %project_id%.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant