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

Reliability issues while publishing packages to GPR, using GitHub Actions #10045

Closed
anangaur opened this issue Sep 17, 2020 · 16 comments
Closed
Assignees

Comments

@anangaur
Copy link
Member

This is a new issue forked from the closed issue: dotnet nuget push to GPR -- Invalid or unrecognized response #8580

Pasting some of the responses from that issue:


@JB101UK commented:
I've been attempting to upload dotnet nupkgs to GitHub packages. I've followed all of the troubleshooting advice, I've got my tokens, my repository url set, my nuget.config file configured, but I find that both pushing/pulling packages is relatively intermittent. Sometimes it just works - other times I get the following error:

Pushing to "http://nuget.pkg.github.com/ PUT https://nuget.pkg.github.com// An error encountered when fetching PUT http://nuget.pkg.github.com/. The request will now be retried. An error occurred while sending the request. The response ended prematurely. PUT https://nuget.pkg.github.com/ An error encountered when fetching PUT http://nuget.pkg.github.com/. The request will now be retried. An error occurred while sending the request. The response ended prematurely. PUT https://nuget.pkg.github.com/ error: An error occurred while sending the request. error: The response ended prematurely.

It's frustrating because sometimes it just works.
Package is pushed.

And other times I can keep re-submitting the same request and it will fail for a while, and eventually just push, without any changes/modification to my code/dotnet nuget push statement.

I see there's been a lot of discussion about this on the forums. I'm presuming it's just a temperamental fault that will be rectified?

Thanks


@bjorhn commented

'm having the exact same problem as @JB101UK. I have two private repos set up, they're both designed to build and push packages to GitHub and they're set up with near-identical scripts. In one of the repos the push succeeds 100% of the time, and in the other repo it only succeeds about 20-25% of the time. All I have to do in order to make it work is run the same action over and over until it goes through. I don't even have to create a new PR, I just keep clicking on the failed workflow -> "Re-run jobs" until it works.

My failing action looks like this:

name: Release

on:
  push:
    branches:
      - master

jobs:
  build:
    name: Build & Publish
    runs-on: windows-latest
    steps:
      - uses: actions/checkout@v2
      - name: Setup .NET Core
        uses: actions/setup-dotnet@v1
        with:
          dotnet-version: '3.1.201' # SDK Version to use.
          source-url: https://nuget.pkg.github.com/bjorhn/index.json
        env:
          NUGET_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}}
      - name: Restore Nuget packages
        run: dotnet restore
      - name: Create the nuget package
        run: dotnet pack MyProject.csproj --configuration Release --no-build --output bin/Release/Publish
      - name: Publish to GitHub
        run: dotnet nuget push bin/Release/Publish/**/*.nupkg --skip-duplicate

The only difference between the working and the failing repo/action is that the working one performs a dotnet build instead of a dotnet restore, and doesn't set the --no-build flag when calling dotnet pack.


@bgilbert6 commented

No matter what I try I only ever get this reply:
warn : No API Key was provided and no API Key could be found for 'https://nuget.pkg.github.com/ORG'. To save an API Key for a source use the 'setApiKey' command. info : Pushing pkg.0.0.5.nupkg to 'https://nuget.pkg.github.com/ORG'... info : PUT https://nuget.pkg.github.com/ORG/ info : NotFound https://nuget.pkg.github.com/ORG/ 519ms error: Response status code does not indicate success: 404 (Not Found).

I can manually go to the nuget.pkg.github.com url and there is definitely something there. But the PUT request 404s


@RehanSaeed commented

Also been through a few iterations and approaches to this. Sometimes the following works, other times I get errors:

    - name: Publish to github
      run: dotnet nuget push **/*.nupkg -s https://nuget.pkg.github.com/[USERNAME]/index.json -k ${{ secrets.GITHUB_TOKEN }} --skip-duplicate --no-symbols true
      working-directory: src

[intermittent] errors with: An error was encountered when fetching 'PUT https://nuget.pkg.github.com/daltskin/'. The request will now be retried. An error occurred while sending the request.

Now, I'm just using curl to push the package and it seems more reliable :)

Replace [PACKAGE] with your package name
Replace [USERNAME] with your username

Github workflow extract:

    - name: Package
      run: dotnet pack --configuration Release --no-build -p:PackageVersion=${{ env.GitVersion_SemVer}}
    
    - name: Publish to github (using curl)
      run: curl -vX PUT -u "[USERNAME]:${{ secrets.GITHUB_TOKEN }}" -F package=@[PACKAGE].${{ env.GitVersion_SemVer}}.nupkg https://nuget.pkg.github.com/[USERNAME]/
      working-directory: src/bin/Release

@rido-min commented

I got it working with dotnet nuget push here
.. but didnt work when using a repo under a GitHub organization, so I switched to curl


@Fronix commented

I'm using my nuget action under an organization and this is what's been working for us after many trial and errors.

      - name: Publish backend nuget
        run: curl -vX PUT -u "user:${{ secrets.package_secret }}" -F package=@Publish/backend.${{env.VERSION}}.nupkg https://nuget.pkg.github.com/myorg/
        shell: bash
        working-directory: ${{env.backend-directory}}
      - name: Publish frontend nuget
        run: curl -vX PUT -u "user:${{ secrets.package_secret }}" -F package=@Publish/backend.${{env.VERSION}}.nupkg https://nuget.pkg.github.com/myorg/
        shell: bash
        working-directory: ${{env.frontend-directory}}

@Airn5475 commented

I know this issue is closed, but I continue to see issues with the methods mentioned above. One time it works and then another time it doesn't. I am also working under and organization. This is SO Frustrating!

@anangaur anangaur changed the title Reliability issues while publishing packages to GPR, using GitHub Actions) Reliability issues while publishing packages to GPR, using GitHub Actions Sep 17, 2020
@aortiz-msft aortiz-msft added the Priority:2 Issues for the current backlog. label Oct 1, 2020
@erdembayar erdembayar self-assigned this Mar 7, 2022
@erdembayar
Copy link
Contributor

@anangaur
Do you know contact to GPR team? I need to ask questions.

@erdembayar
Copy link
Contributor

@anangaur
I want ask if Github Package Repository team have logging and metrics for failure/fault.

@nadesu
Copy link

nadesu commented Mar 16, 2022

Hey, my team supports GitHub Packages for Nuget registry. We just received a lead to this thread. Pls let us know how we can help

@erdembayar erdembayar added this to the Sprint 2022-04 milestone Mar 20, 2022
@NamrataJha
Copy link

NamrataJha commented Mar 21, 2022

Hey @anangaur @erdembayar I tried but I am unable to repro this. I tried publishing via both dotnet restore and dotnet build continuously for 4-5 hours in a workflow but didn't run into any failures.
Can you confirm if this issue is still relevant?

@erdembayar
Copy link
Contributor

dotnet nuget push

Thank you for testing this for us.
Did you run dotnet nuget push after each iteration of dotnet restore and dotnet build?
Could you be able to share your script here? I want to verify if's testing scenario we're interested in.
Also, one customer mentioned it doesn't work under Github organization repo. Did you test scenario too?

@NamrataJha
Copy link

I used the following workflows -

dotnet build

name: dotent-restore

on:
  push:
    branches:
      - main
  workflow_dispatch:

jobs:
  build:
    name: Build & Publish
    runs-on: windows-latest
    steps:
      - uses: actions/checkout@v2
      - name: Setup .NET Core
        uses: actions/setup-dotnet@v1
        with:
          dotnet-version: '5.0' # SDK Version to use.
          source-url: https://nuget.pkg.github.com/namratajha/index.json
        env:
          NUGET_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}}
      - name: Build Nuget packages
        run: dotnet build -p:PackageVersion=1.0.0-${{ github.sha }}
        env:
          sha: ${{ github.sha }}
      - name: Create the nuget package
        run: dotnet pack AppLogger.csproj -p:PackageVersion=1.0.0-${{ github.sha }} --configuration Release --output bin/Release/Publish
        env:
          sha: ${{ github.sha }}
      - name: Publish to GitHub
        run: dotnet nuget push bin/Release/Publish/**/*.nupkg --skip-duplicate
        env:
          sha: ${{ github.sha }}

dotnet restore

name: dotent-restore

on:
  push:
    branches:
      - main
  workflow_dispatch:

jobs:
  build:
    name: Build & Publish
    runs-on: windows-latest
    steps:
      - uses: actions/checkout@v2
      - name: Setup .NET Core
        uses: actions/setup-dotnet@v1
        with:
          dotnet-version: '5.0' # SDK Version to use.
          source-url: https://nuget.pkg.github.com/namratajha/index.json
        env:
          NUGET_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}}
      - name: Restore Nuget packages
        run: dotnet restore -p:PackageVersion=1.0.0-${{ github.sha }}
        env:
          sha: ${{ github.sha }}
      - name: Create the nuget package
        run: dotnet pack nuget-test.csproj -p:PackageVersion=1.0.0-${{ github.sha }} --configuration Release --no-build --output bin/Release/Publish
        env:
          sha: ${{ github.sha }}
      - name: Publish to GitHub
        run: dotnet nuget push bin/Release/Publish/**/*.nupkg --skip-duplicate
        env:
          sha: ${{ github.sha }}

Haven't checked under Github organization repo. Will test this scenario as well.

@erdembayar
Copy link
Contributor

Related to: #9775

@erdembayar
Copy link
Contributor

erdembayar commented Apr 5, 2022

@NamrataJha
Did you test organization scenario?

Also is it possible for me create organization account for testing? Does it cost $$ to do that?

@erdembayar
Copy link
Contributor

erdembayar commented Apr 15, 2022

@nadesu @NamrataJha
Could you validate this organization account? Probably try with larger size packrepository 1 more time.
Do you have any metrics which record this kind of errors where you can filter by "dotnet nuget push" scenario?

@NamrataJha
Copy link

@erdembayar apologies for the delay. Will check for the org account and get back to you. Do you have any package that I can use for testing?
Meanwhile is there any repo from which you have encountered this error recently so I can look up in the logs?

@erdembayar
Copy link
Contributor

erdembayar commented Apr 21, 2022

@erdembayar apologies for the delay. Will check for the org account and get back to you. Do you have any package that I can use for testing? Meanwhile is there any repo from which you have encountered this error recently so I can look up in the logs?

I don't have any specific repo reported to me recently.
Please try this one, it should create quite large nupkg package.
https://github.com/erdembayar/JustLargePackage
Please test both personal and org accounts.

@erdembayar
Copy link
Contributor

erdembayar commented Apr 21, 2022

@JB101UK @bjorhn @RehanSaeed @rido-min @Airn5475

Sorry for resurrecting old thread. Do you still experience problems with "nuget push" in Github action? I was not able to repro this issue. Probably things improved during last 2 years. Please let me know if you're still experiencing this issue. We need recent log with error.

@RehanSaeed
Copy link

@erdembayar All good at the moment, thanks.

@NamrataJha
Copy link

NamrataJha commented Apr 22, 2022

@erdembayar tested from both user and org accounts. I am unable to repro the issue from either.

@erdembayar
Copy link
Contributor

@erdembayar tested from both user and org accounts. I am unable to repro the issue from either.

Thank you NamrataJha. I had been testing it for some time, it didn't repro for me too.

@nkolev92
Copy link
Member

Hey all,

This issue has been open for over 2 years, and at this point we aren't getting too many new reports or are able to repro this issue.

If you are still hitting similar problems, feel free to open new issues as appropriate.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

9 participants