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

Could this be a problem with Nexus?

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…

27/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 ‘https://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?

This suggests Nexus is not being used.

well it is, to an extent, we do have a proxy to nuget, but its says this…

[Check Status https://api.nuget.org] *UNKNOWN org.sonatype.nexus.repository.httpclient.internal.HttpClientFacetImpl - Repository status for NuGetProxy continued as AUTO_BLOCKED_UNAVAILABLE until 2023-02-22T17:25:27.366Z - reason java.net.UnknownHostException: api.nuget.org: Name or service not known for https://api.nuget.org (previous reason was java.net.UnknownHostException: api.nuget.org: Name or service not known for https://api.nuget.org)

The earlier logs seemed to be client side errors.

For this Nexus error the key part is UnknownHostException, for whatever reason your Nexus instance cannot resolve the DNS entry for api.nuget.org