Skip to content

Don't preserve old repository on URL change #107

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

Merged
merged 1 commit into from
Mar 21, 2022
Merged

Don't preserve old repository on URL change #107

merged 1 commit into from
Mar 21, 2022

Conversation

per1234
Copy link
Contributor

@per1234 per1234 commented Mar 17, 2022

The library maintainers may request a change to the repository URL in the library registration data.

This operation is performed by the backend maintainer via the command:

libraries-repository-engine modify --repo-url

Previously, this command did three things:

  • Update the DB entry for the library
  • Move the release archives to the new location (the storage structure is based on the repository URL for some reason)
  • Move the cached library repository clone to the new location

Problem

The last of these is problematic because the remote of that repository is still configured for the original URL, meaning
the fetch done during the sync command execution were still done against the old URL.

This bug is not noticeable under either of the following scenarios:


The repository was renamed or transferred

This produces a redirect from the old URL to the new one, so the fetch is done from the intended repo despite the
outdated remote configuration.


The original repository was deleted

If a fetch fails, the engine deletes the repository and clones from the URL in the DB. The newly cloned repo will have
the correct remote configuration.


The bug is noticeable under the following scenario:


The original repository still exists

The sync process continues to fetch from the old URL.

Example: arduino/library-registry#1179 (comment)


Solution

Change the modify --repo-url command behavior to delete the cached library repository clone.

The repository will be cloned from the updated URL on the next run of the sync command.

The library maintainers may request a change to the repository URL in the library registration data.

This operation is performed by the backend maintainer via the command:

libraries-repository-engine modify --repo-url

Previously, this command did three things:

- Update the DB entry for the library
- Move the release archives to the new location (the storage structure is based on the repository URL for some reason)
- Move the cached library repository clone to the new location

Problem
-------

The last of these is problematic because the remote of that repository is still configured for the original URL, meaning
the fetch done during the `sync` command execution were still done against the old URL.

This bug is not noticeable under either of the following scenarios:

The repository was renamed or transferred
=========================================

This produces a redirect from the old URL to the new one, so the fetch is done from the intended repo despite the
outdated remote configuration.

The original repository was deleted
===================================

If a fetch fails, the engine deletes the repository and clones from the URL in the DB. The newly cloned repo will have
the correct remote configuration.

The bug is noticeable under the following scenario:

The original repository still exists
====================================

The sync process continues to fetch from the old URL.

Solution
--------

Change the `modify --repo-url` command behavior to delete the cached library repository clone.

The repository will be cloned from the updated URL on the next run of the `sync` command.
@per1234 per1234 added topic: code Related to content of the project itself type: imperfection Perceived defect in any part of project labels Mar 17, 2022
@per1234 per1234 self-assigned this Mar 17, 2022
@per1234 per1234 merged commit 4999750 into arduino:main Mar 21, 2022
@per1234 per1234 deleted the fix-modify-url branch March 21, 2022 04:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic: code Related to content of the project itself type: imperfection Perceived defect in any part of project
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants