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

Download package on Agent fails for authenticated external feeds #2962

Closed
michaelnoonan opened this issue Nov 29, 2016 · 4 comments
Closed
Assignees
Labels
kind/bug This issue represents a verified problem we are committed to solving
Milestone

Comments

@michaelnoonan
Copy link
Contributor

Split out from #2926

I discovered this problem while testing all the different ways we interact with NuGet feeds. In this case Calamari fails when attempting to download a package from an authenticated feed (one which requires credentials).

Workarounds

Some workarounds are available until this is fixed:

  1. Let Octopus Server download the package and stream it to the Tentacle
  2. Use an unauthenticated feed

Steps to reproduce

  1. Create an external feed in Octopus Server targeting a NuGet feed which requires credentials
  2. Test the feed configuration works as expected by searching for some packages.
  3. Create a package step using a package from this feed.
  4. Calamari will fail to download the package with an error log like the one shown below.

Sample error log

06:06:31   Verbose  |         Attempt 5 of 5: Unable to download package: System.InvalidOperationException: This instance has already started one or more requests. Properties can only be modified before sending the first request.
06:06:31   Verbose  |         at Calamari.Integration.Packages.NuGet.NuGetV3Downloader.CreateHttpClient(ICredentials credentials) in Z:\buildAgent\workDir\14ffc968155e4956\source\Calamari\Integration\Packages\NuGet\NuGetV3Downloader.cs:line 47
06:06:31   Verbose  |         at Calamari.Integration.Packages.NuGet.NuGetV3Downloader.GetHttp(Uri uri, ICredentials credentials, Action`1 processContent) in Z:\buildAgent\workDir\14ffc968155e4956\source\Calamari\Integration\Packages\NuGet\NuGetV3Downloader.cs:line 61
06:06:31   Verbose  |         at Calamari.Integration.Packages.NuGet.NuGetV3Downloader.GetPackageBaseUri(Uri feedUri, ICredentials feedCredentials) in Z:\buildAgent\workDir\14ffc968155e4956\source\Calamari\Integration\Packages\NuGet\NuGetV3Downloader.cs:line 88
06:06:31   Verbose  |         at Calamari.Integration.Packages.NuGet.NuGetV3Downloader.DownloadPackage(String packageId, NuGetVersion version, Uri feedUri, ICredentials feedCredentials, String targetFilePath) in Z:\buildAgent\workDir\14ffc968155e4956\source\Calamari\Integration\Packages\NuGet\NuGetV3Downloader.cs:line 25
06:06:31   Verbose  |         at Calamari.Integration.Packages.NuGet.NuGetPackageDownloader.DownloadPackage(String packageId, NuGetVersion version, Uri feedUri, ICredentials feedCredentials, String targetFilePath, Action`5 action) in Z:\buildAgent\workDir\14ffc968155e4956\source\Calamari\Integration\Packages\NuGet\NuGetPackageDownloader.cs:line 44
06:06:31   Error    |         Unable to download package: This instance has already started one or more requests. Properties can only be modified before sending the first request.
06:06:31   Error    |         Failed to download package NuGet.Versioning 3.4.3 from feed: 'https://octopus.myget.org/F/mike-test/api/v3/index.json'
06:06:31   Error    |         System.Exception: The package could not be downloaded from NuGet. If you are getting a package verification error, try switching to a Windows File Share package repository to see if that helps.
06:06:31   Error    |         at Calamari.Integration.Packages.NuGet.NuGetPackageDownloader.DownloadPackage(String packageId, NuGetVersion version, Uri feedUri, ICredentials feedCredentials, String targetFilePath, Action`5 action) in Z:\buildAgent\workDir\14ffc968155e4956\source\Calamari\Integration\Packages\NuGet\NuGetPackageDownloader.cs:line 63
06:06:31   Error    |         at Calamari.Integration.Packages.NuGet.NuGetPackageDownloader.DownloadPackage(String packageId, NuGetVersion version, Uri feedUri, ICredentials feedCredentials, String targetFilePath) in Z:\buildAgent\workDir\14ffc968155e4956\source\Calamari\Integration\Packages\NuGet\NuGetPackageDownloader.cs:line 32
06:06:31   Error    |         at Calamari.Integration.Packages.Download.PackageDownloader.DownloadPackage(String packageId, NuGetVersion version, Uri feedUri, ICredentials feedCredentials, String cacheDirectory, LocalNuGetPackage& downloaded, String& downloadedTo) in Z:\buildAgent\workDir\14ffc968155e4956\source\Calamari\Integration\Packages\Download\PackageDownloader.cs:line 133
06:06:31   Error    |         at Calamari.Integration.Packages.Download.PackageDownloader.DownloadPackage(String packageId, NuGetVersion version, String feedId, Uri feedUri, ICredentials feedCredentials, Boolean forcePackageDownload, String& downloadedTo, String& hash, Int64& size) in Z:\buildAgent\workDir\14ffc968155e4956\source\Calamari\Integration\Packages\Download\PackageDownloader.cs:line 53
06:06:31   Error    |         at Calamari.Commands.DownloadPackageCommand.Execute(String[] commandLineArguments) in Z:\buildAgent\workDir\14ffc968155e4956\source\Calamari\Commands\DownloadPackageCommand.cs:line 61
                    |       
@michaelnoonan michaelnoonan added the kind/bug This issue represents a verified problem we are committed to solving label Nov 29, 2016
@michaelnoonan michaelnoonan self-assigned this Nov 29, 2016
@droyad
Copy link
Contributor

droyad commented Feb 7, 2017

#3135 Could be related

@markryd
Copy link

markryd commented Feb 7, 2017

Yes, this is a dupe of #3135.
https://github.com/OctopusDeploy/Calamari/blob/3207c4e6abbc2098174152ad36d6225ab03d3e8b/source/Calamari/Integration/Packages/NuGet/NuGetV3Downloader.cs#L43 fails when we try to set credentials on the WebRequestHandler we have just newed up, because it is somehow already in use.

@droyad
Copy link
Contributor

droyad commented Feb 8, 2017

Release Notes: Fixed error downloading from NuGet V3 feeds on the Tentacle

@lock
Copy link

lock bot commented Nov 25, 2018

This thread has been automatically locked since there has not been any recent activity after it was closed. If you think you've found a related issue, please contact our support team so we can triage your issue, and make sure it's handled appropriately.

@lock lock bot locked as resolved and limited conversation to collaborators Nov 25, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
kind/bug This issue represents a verified problem we are committed to solving
Projects
None yet
Development

No branches or pull requests

4 participants