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

Add script to delete packages #565

Merged
merged 6 commits into from
Dec 14, 2022
Merged

Add script to delete packages #565

merged 6 commits into from
Dec 14, 2022

Conversation

thomashoneyman
Copy link
Member

As described in #531, we have a lot of packages in the registry that cannot be solved. The full list is here:
https://gist.github.com/MonoidMusician/0f0c4ed70edf7c000a1da012bdca5134

We plan to remove unsolvable packages and update the API so that packages must solve to be added to the registry. However, since there are quite a lot of them, we need a script to help us do this automatically. This PR adds such a script as a CLI tool with two options.

First, you can delete an individual package:

$ registry-package-deleter --package [email protected]

Second, you can write a JSON file where keys are package names and values are arrays of versions:

{
  "fork": [ "1.0.0" ],
  "aff-bus": [ "0.0.1", "0.0.2" ]
}

and then delete them in bulk:

$ registry-package-deleter --file deletions.json

You must have @pacchettibotti credentials in order to run this script (not just anyone can run it).

Comment on lines 140 to 146
commitMetadataFile name >>= case _ of
Left err -> Console.log $ "Failed to commit metadata file for " <> PackageName.print name <> ": " <> err
Right _ -> pure unit

commitIndexFile name >>= case _ of
Left err -> Console.log $ "Failed to commit registry index file for " <> PackageName.print name <> ": " <> err
Right _ -> pure unit
Copy link
Member Author

@thomashoneyman thomashoneyman Dec 12, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we don't want a commit per package and just want to commit in one fell swoop then we'd need to remove these lines and instead add functions to commit the entire registry repo / commit the entire registry index repo (or to git add all the filepaths we know we touched and commit them in one go).

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hm okay, I think one fell swoop is ideal because the deletions don't necessarily make sense in isolation, since deleting package versions could break other package versions that depend on them (but we should also be deleting those in the same batch).

@thomashoneyman thomashoneyman merged commit f87837f into master Dec 14, 2022
@thomashoneyman thomashoneyman deleted the trh/deleter- branch December 14, 2022 13:59
@f-f
Copy link
Member

f-f commented Dec 14, 2022

Do we even need a script for this in the repo?

If we go by the plan detailed in #531 (comment), then we should forbid the upload of packages that do not solve before removing all the old packages that do not (otherwise this issue will continue to happen), and this operation is a one-off. Having easy automation available for removing packages makes me uneasy, and I wouldn't like to have it sitting there in the first place.

@thomashoneyman
Copy link
Member Author

I can alternately remove this script from the repo and keep it locally; I’ve had to delete and reupload packages several times and it’s super tedious.

Coming up we at least have removing packages that don’t solve and removing / reuploading packages with adjusted bounds once #567 lands.

The alternative is manually deleting entries from the metadata and index and going to the spaces UI to delete the relevant package version.

As far as it being dangerous to have this script: I agree, and certainly once we leave alpha it should be deleted, but the guardrail is that only people with access to the spaces secrets and pacchettibotti credentials can use it.

@f-f
Copy link
Member

f-f commented Dec 14, 2022

Yeah. We can leave it in for now, but we'll need to remember to remove it once we are out of alpha. Opened #570 to track this.

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

Successfully merging this pull request may close these issues.

3 participants