Open jcansdale opened 4 years ago
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
@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
@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.
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. 🤔
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
E.g.
See https://docs.microsoft.com/en-us/dotnet/core/tools/dotnet-nuget-delete