All of a sudden NuGet issues Name or service not known retrying FinePackagesByIdAsync

With no changes, what so ever, NuGet all of a sudden is failing in the pipeline in the following maner:

$ dotnet test

[23] Determining projects to restore…

[24] Rules.Tests.csproj : error NU1301: Unable to load the service index for source h ttp s://api.
nuget.org/v3/index.json. [/builds/7cjjzF-Y/1/Rules.sln]

25/builds/7cjjzF-Y/1/Rules/Rules.csproj : error NU1301: Unable to load the service index for source h ttp s://api. nuget.org/v3/index.json. [/builds/7cjjzF-Y/1/Rules.sln]

[26](ht tp s://git.internal.xxx.com/project/-/jobs/25124#L26)/builds/7cjjzF-Y/1/Rules.Tests.csproj : error NU1301: Unable to load the service index for source h tt ps://api.nuget.org/v3/index.json. [/builds/7cjjzF-Y/1/Rules.sln]

[27](h ttp s:/ /git.
XXXX)/builds/7cjjzF-Y/1/enterprisebackendservices/project/callcomplianceapi/web.API.rules.Tests/web.API.rules.Tests.csproj : error NU1301: Unable to load the service index for source https://api.nuget.org/v3/index.json. [/builds/7cjjzF-Y/1/enterprisebackendservices/apiservices/project/web.API.Rules.sln]

[28] Retrying ‘FindPackagesByIdAsync’ for source ‘h ttp s:// api.nuget.org/v3-flatcontainer/amazon.lambda.aspnetcoreserver.hosting/index.json’.

[29] Name or service not known (api.nuget.org:443)

[30]Name or service not known

[31]Retrying ‘FindPackagesByIdAsync’ for source ‘https://api. nuget.org/v3-flatcontainer/dapper.sqlbuilder/index.json’.

[32]Name or service not known (api. nuget.org:443)

etc etc etc…

Here is the pipeline

variables:
  # Update this for new version builds. - TODO: This will be removed at some point once Jim figures out automatic versioning based on git tags.
  VERSION: "1.0.$CI_PIPELINE_IID"
  VERSION_SUFFIX: "$CI_COMMIT_REF_SLUG-$CI_PIPELINE_IID-$CI_COMMIT_SHORT_SHA"
  # NOTE: If you change your package name, you should also change this to match.
  PACKAGE_NAME: "Reporting.CitiHoldingQueueReport"

image: $CICD_IMAGE

stages:
  - test
  - deploy
  - deploy_runner

Test:
  stage: test
  before_script:
    - dotnet nuget add source $REPORTS_NUGET_SOURCE -n Nexus
    - "echo | dotnet --version" # must be v 2.2.300 or later for reporter tool to work
    - dotnet --info
    - dotnet restore --verbosity detailed
    - dotnet tool install dotnet-reportgenerator-globaltool --tool-path tools
  script:
    - dotnet test --logger "junit" --collect:"XPlat Code Coverage"
    # each reporttype must be a separate line, doesn't work together ; separated
    - ./tools/reportgenerator "-reports:${CI_PROJECT_DIR}/**/TestResults/*/coverage.cobertura.xml" "-targetdir:Reports_Coverage" -reportTypes:TextSummary;
    - ./tools/reportgenerator "-reports:${CI_PROJECT_DIR}/**/TestResults/*/coverage.cobertura.xml" "-targetdir:Reports_Coverage" -reportTypes:Html;
    - cat ./Reports_Coverage/Summary.txt
    - echo 'End Summary'
  coverage: /Line coverage[\s\S].+%/
  artifacts:
    paths:
      - Reports_Coverage/
    reports:
      junit:
        - "*.Test/TestResults/TestResults.xml"
        - "*.Tests/TestResults/TestResults.xml"

NuGet Publish:
  stage: deploy
  before_script:
    # Add our custom NuGet repository group so nuget restore works
    - dotnet nuget add source $REPORTS_NUGET_SOURCE -n Nexus
  script:
    # Pack the project into a NuGet package
    - dotnet pack -c Release -p:PackageVersion=${VERSION} -o ./build/packages --version-suffix "$VERSION_SUFFIX" --include-symbols

    - dotnet nuget push ./build/packages/**/*.symbols.nupkg -k ${NEXUS_NUGET_KEY} -s $REPORTS_DEPLOY_NUGET_SOURCE
  only:
    - master

So yes we use nexus Sonatype, but everyone seems fine. Whats odd is that allowing v3 nuget to pass, now it works, but then will fail, but then work again, and then fail again. Also when i say work, i still get the above error messages, but the pipeline will be fine.

Its very odd, that nothing was touched and nuget packages cannot be restored. Is there any other way this can be done?

1 Like

Hello,

We are facing the same issue on CircleCi. I thought it was CircleCi the problem, but according to your post, it seems to be something else.

Is you build running on a docker image ? On our side it’s launched on dotnet 6 sdk docker image.