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 support for deleting packages #9

Open
jcansdale opened this issue Jan 22, 2020 · 5 comments
Open

Add support for deleting packages #9

jcansdale opened this issue Jan 22, 2020 · 5 comments

Comments

@jcansdale
Copy link
Owner

jcansdale commented Jan 22, 2020

E.g.

gpr delete MyPackage 1.0

See https://docs.microsoft.com/en-us/dotnet/core/tools/dotnet-nuget-delete

dotnet nuget delete [<PACKAGE_NAME> <PACKAGE_VERSION>] [--force-english-output] [--interactive] [-k|--api-key] [--no-service-endpoint]
    [--non-interactive] [-s|--source]
dotnet nuget delete [-h|--help]
@jasonycw
Copy link

jasonycw commented Sep 14, 2020

I pulled the latest gpr and see there is gpr delete already

But when I tried

gpr delete --docker-clean-up --force --api-key ACCESS_KEY ownerName/projectName

Nothing is deleted from ownerName/projectName's package


I also tried

gpr delete --docker-clean-up --force --api-key ACCESS_KEY 'ownerName/projectName'

Still nothing happen

@jcansdale
Copy link
Owner Author

@jasonycw,

The --docker-clean-up switch will only delete docker images that failed to publish properly.

If you want to delete all packages versions associated with ownerName/projectName, you should only use the --force switch.

Could you try:

gpr delete <ownerName/projectName> --force --api-key ACCESS_KEY

@jasonycw
Copy link

@jcansdale
Thanks, this seems working

PS > gpr delete 'ownerName/projectName' --force --api-key ACCESS_KEY
deleted_67989e40-be0e-42b0-848d-08de62955ef3
deleted_f066f8c7-f4ca-49c3-85ba-86a7342d5588
Package.A
  Deleting '1.2.5'
  Deleting '1.2.4'
  Deleting '1.2.3'
  Deleting '1.2.2'
Package.B
  Deleting '1.2.5'
  Deleting '1.2.4'
  Deleting '1.2.3'
  Deleting '1.2.2'
Package.C
PS >

However, I found a bug in Github package where there is a phantom package with no version and no way to delete and push again.
In the above, Package.C seems to have no version? And it cannot be found in the Github package page or in VS nuget page.
gpr delete seems also cannot delete Package.C

When I run gpr push --api-key ACCESS_KEY <Package.C>, I get

[Package.C.1.2.6.nupkg]: Repository url: https://github.com/ownerName/projectName. Version: 1.2.6. Size: 27216 bytes.
[Package.C.1.2.6.nupkg]: Uploading package.
[Package.C.1.2.6.nupkg]: Error: Version 1.2.6 of "Package.C" has already been pushed.

@jcansdale
Copy link
Owner Author

Hi @jasonycw,

I tried reproducing this issue with the following workflow, but it seems to work fine.

on:
  push:

jobs:
  push-delete-push:
    runs-on: ubuntu-latest

    env:
      PACKAGE: Package.C

    steps:
      - run: dotnet new console --name ${{ env.PACKAGE }}
      - run: dotnet pack ${{ env.PACKAGE }}
      - run: dotnet tool install gpr -g
      - run: gpr delete ${{ github.repository }}/${{ env.PACKAGE }} --force -k ${{ github.token }}
      - run: gpr push **/*.nupkg --repository ${{ github.repository }} -k ${{ github.token }}
      - run: gpr delete ${{ github.repository }}/${{ env.PACKAGE }} --force -k ${{ github.token }}
      - run: gpr push **/*.nupkg --repository ${{ github.repository }} -k ${{ github.token }}

Could you try adding this workflow to the same repository as your Package.C project? I would be interested to know if it completes successfully. 🤔

@jasonycw
Copy link

Hi @jcansdale
I tried the following

> gpr delete 'ownerName/projectName/Package.C' --force --api-key ACCESS_KEY
Package.C

It only listed the name of the package and didn't seem to delete anything

Then I tried, still same thing happened

> gpr push --api-key ACCESS_KEY <Package.C>
[Package.C.1.2.6.nupkg]: Repository url: https://github.com/ownerName/projectName. Version: 1.2.6. Size: 27216 bytes.
[Package.C.1.2.6.nupkg]: Uploading package.
[Package.C.1.2.6.nupkg]: Error: Version 1.2.6 of "Package.C" has already been pushed.

FYI, that package was the one I used to test this issue https://github.community/t/push-nuget-package-from-difference-owner/131732
I did pushed and delete the same package multiple times to test difference <RepositoryUrl> combination.

What I finally decided was to move the ownership of that private personal repo to under the organization.
But I am not sure when and why that Package.C was stuck with no version and not searchable under that repo with the new owner

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

2 participants