bench icon indicating copy to clipboard operation
bench copied to clipboard

Bench Remote-Set-URL Fails When Repository Name Differs from App Name

Open husamhammad opened this issue 9 months ago • 0 comments

About Us:

We are RUKN Software, a company specializing in ERPNext and Frappe development, integrations, and custom solutions. We actively contribute to the Frappe ecosystem by building apps, optimizing workflows, and enhancing functionality. Our current work involves integrating ERPNext with Foodics through our app, rukn_foodics_connector, and we've encountered a limitation in bench remote-set-url that affects repositories with different naming conventions.

Describe the bug :chart_with_downwards_trend:

Attempting to change the remote URL using bench remote-set-url fails when the repository name differs from the app directory name. Specifically, if an app is named using underscores (e.g., rukn_foodics_connector), but its repository URL uses hyphens (rukn-foodics-connector), bench does not recognize the app and returns an error.

To Reproduce :page_with_curl:

Steps to reproduce the behavior:

Ensure the app rukn_foodics_connector is installed. Run the following command:

bench remote-set-url https://github.com/ruknsoftware/rukn-foodics-connector

The following error appears:

ERROR: No app named rukn-foodics-connector
Traceback (most recent call last):
  File "/usr/local/bin/bench", line 8, in <module>
    sys.exit(cli())
  File "/usr/local/lib/python3.10/dist-packages/bench/cli.py", line 132, in cli
    bench_command()
  File "/usr/lib/python3/dist-packages/click/core.py", line 1128, in __call__
    return self.main(*args, **kwargs)
  File "/usr/lib/python3/dist-packages/click/core.py", line 1053, in main
    rv = self.invoke(ctx)
  File "/usr/lib/python3/dist-packages/click/core.py", line 1659, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/lib/python3/dist-packages/click/core.py", line 1395, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/lib/python3/dist-packages/click/core.py", line 754, in invoke
    return callback(*args, **kwargs)
  File "/usr/local/lib/python3.10/dist-packages/bench/commands/git.py", line 18, in remote_set_url
    set_git_remote_url(git_url)
  File "/usr/local/lib/python3.10/dist-packages/bench/utils/__init__.py", line 320, in set_git_remote_url
    raise AppNotInstalledError(f"No app named {app}")
bench.exceptions.AppNotInstalledError: No app named rukn-foodics-connector

Expected behavior :chart_with_upwards_trend:

The command should successfully update the remote URL for the installed app, even if the repository name differs from the app directory name. Screenshots :crystal_ball:

If applicable, add screenshots to help explain your problem. OS (please complete the following information): :cyclone:

Linux: ubuntu 22.04

Version Information https://discuss.frappe.io/t/from-the-given-code-the-fetch-from-is-not-working-in-the-dialog-box/114226 Can be found by running bench version in your respective bench folder.

Bench Branch:
Frappe Version:
ERPNext Version:

Additional context :page_facing_up:

This issue arises because bench remote-set-url relies on matching the app name exactly with the repository name, but many repositories use different naming conventions (e.g., hyphens instead of underscores). Since Frappe apps are installed with underscores (_) in their names, but GitHub repositories often use hyphens (-), bench fails to find the app.

Possible Solution :bookmark_tabs: we can add options ( --app ) to Definition of app which want to change the url for it

1- Modify bench remote-set-url to support matching the app name with different naming conventions. 2- Allow an explicit argument for specifying the app name:

bench remote-set-url  --app rukn_foodics_connector https://github.com/ruknsoftware/rukn-foodics-connector

husamhammad avatar Feb 01 '25 13:02 husamhammad