navcontainerhelper icon indicating copy to clipboard operation
navcontainerhelper copied to clipboard

GitHub NuGet Handling fails for User Feeds

Open ChrisBlankDe opened this issue 8 months ago • 1 comments

Describe the issue The NuGetFeed Class currently only support orga feeds on github and fails on user feeds. https://github.com/microsoft/navcontainerhelper/blob/b2410696c2c9ce68b63f3ef1a65c0c09d0c58ed1/NuGet/NuGetFeedClass.ps1#L98

If we change the url to https://api.github.com/users/* this would work fine for users. Unfortunately there is no nice solution to distinguish users and orgs. but there are workarounds

especially for the evaluation of the possibilities it would be nice if the github handling would also work for users and not only for orgs

Scripts used to create container and cause the issue Triggert from GenerateBcNuGet Pipeline: https://github.com/ChrisBlankDe/GenerateBcNuGet/actions/runs/9468253923/job/26084188320#step:4

Full output of scripts

Run . (Join-Path $env:GITHUB_WORKSPACE "GenerateNuGetPackages.ps1")
  . (Join-Path $env:GITHUB_WORKSPACE "GenerateNuGetPackages.ps1")
  shell: /usr/bin/pwsh -command ". '{0}'"
  env:
    nuGetToken: ***
    nuGetServerUrl: https://nuget.pkg.github.com/ChrisBlankDe/index.json
    apps: ***
    symbolsOnly: 
    packageIdTemplate: {publisher}.{name}.{id}
Generate Runtime NuGet Packages
Downloading BcContainerHelper developer version from https://bccontainerhelper.blob.core.windows.net/public/preview.zip
BcContainerHelper version 6.0.19-preview1[2](https://github.com/ChrisBlankDe/GenerateBcNuGet/actions/runs/9467593906/job/26081968342#step:4:2)13
BC.HelperFunctions emits usage statistics telemetry to Microsoft
Running on Linux, PowerShell 7.4.2
Downloading /tmp/e5c4[3](https://github.com/ChrisBlankDe/GenerateBcNuGet/actions/runs/9467593906/job/26081968342#step:4:3)9ee-8938-48fa-839f-ad0ef509c2ff/apps.zip
Downloading AL Language Extension (Prerelease) to /home/runner/.bccontainerhelper/alLanguageExtension/1[4](https://github.com/ChrisBlankDe/GenerateBcNuGet/actions/runs/9467593906/job/26081968342#step:4:4).0.1037708.zip
using Expand-Archive
Setting execute permissions on altool
Search NuGetFeed https://nuget.pkg.github.com/ChrisBlankDe/index.json
Search package using https://api.github.com/orgs/ChrisBlankDe/packages?package_type=nuget&per_page=100&page=1
Error Message: Response status code does not indicate success: 404 (Not Found).
StackTrace: at Search, /tmp/344b009f-ec21-4fc3-b963-c83e7843f08d/BcContainerHelper/NuGet/NuGetFeedClass.ps1: line 103
at Find-BcNuGetPackage, /tmp/344b009f-ec21-4fc3-b963-c83e7843f08d/BcContainerHelper/NuGet/Find-BcNuGetPackage.ps1: line 63
at Get-BcNuGetPackage, /tmp/344b009f-ec21-4fc3-b963-c83e7843f08d/BcContainerHelper/NuGet/Get-BcNuGetPackage.ps1: line [5](https://github.com/ChrisBlankDe/GenerateBcNuGet/actions/runs/9467593906/job/26081968342#step:4:5)7
at <ScriptBlock>, /home/runner/work/GenerateBcNuGet/GenerateBcNuGet/GenerateNuGetPackages.ps1: line 20
at <ScriptBlock>, /home/runner/work/_temp/34eeb1b4-9b2f-4e7b-9ebd-1e8387afe5a[6](https://github.com/ChrisBlankDe/GenerateBcNuGet/actions/runs/9467593906/job/26081968342#step:4:6).ps1: line 2
at <ScriptBlock>, <No file>: line 1
Invoke-RestMethod: /tmp/344b009f-ec21-4fc3-b963-c83e[7](https://github.com/ChrisBlankDe/GenerateBcNuGet/actions/runs/9467593906/job/26081968342#step:4:7)843f08d/BcContainerHelper/NuGet/NuGetFeedClass.ps1:103
Line |
 103 |  …   $result = Invoke-RestMethod -Method GET -Headers $headers -Uri "$qu …
     |                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     |  {   "message": "Not Found",   "documentation_url":
     | "https://docs.github.com/rest/packages/packages#list-packages-for-an-organization",   "status": "404" }
Error: Process completed with exit code 1.

Additional context

  • does it happen all the time? Yes
  • did it use to work? No

ChrisBlankDe avatar Jun 11 '24 15:06 ChrisBlankDe