WebProxy not used during acquire packages?

daniel.would's Avatar

daniel.would

27 Feb, 2018 01:55 PM

I have a set of tentacles behind a proxy that need to fetch packages from a nuget server. The octopus server connects to them fine via the proxy. and I also have each tentacle configured with a web proxy.
If I use script console to request the tentacle make a webrequest to the proget server I see the request go via the proxy and everything works great. However if I run a build that needs to acquire packages from the same proget server I see no request to the proxy and I get an error ( System.Net.Sockets.SocketException: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond) that indicates it tries to go straight to the nuget server which fails.
Am I missing some part of setup? My understand is the tentacle should use the proxy during acquire packages. (tentacle version 3.16, server version 3.17.3)

In case it helps indicate whether it should be picking things up correctly, here is the remainder of the stack from the connection exception

at System.Net.Sockets.Socket.DoConnect(EndPoint endPointSnapshot, SocketAddress socketAddress)
February 27th 2018 12:08:55Error
   at System.Net.ServicePoint.ConnectSocketInternal(Boolean connectFailure, Socket s4, Socket s6, Socket& socket, IPAddress& address, ConnectSocketState state, IAsyncResult asyncResult, Exception& exception)
February 27th 2018 12:08:55Error
   --- End of inner exception stack trace ---
February 27th 2018 12:08:55Error
   at System.Net.HttpWebRequest.GetResponse()
February 27th 2018 12:08:55Error
   at NuGet.RequestHelper.GetResponse()
February 27th 2018 12:08:55Error
   at NuGet.RedirectedHttpClient.GetResponseUri(HttpClient client)
February 27th 2018 12:08:55Error
   at NuGet.RedirectedHttpClient.EnsureClient()
February 27th 2018 12:08:55Error
   at System.Lazy`1.CreateValue()
February 27th 2018 12:08:55Error
   at System.Lazy`1.LazyInitValue()
February 27th 2018 12:08:55Error
   at NuGet.MemoryCache.GetOrAdd[T](Object cacheKey, Func`1 factory, TimeSpan expiration, Boolean absoluteExpiration)
February 27th 2018 12:08:55Error
   at NuGet.RedirectedHttpClient.get_CachedClient()
February 27th 2018 12:08:55Error
   at NuGet.RedirectedHttpClient.get_Uri()
February 27th 2018 12:08:55Error
   at NuGet.DataServicePackageRepository.get_Context()
February 27th 2018 12:08:55Error
   at NuGet.DataServicePackageRepository.FindPackage(String packageId, SemanticVersion version)
February 27th 2018 12:08:55Error
   at NuGet.PackageRepositoryExtensions.FindPackage(IPackageRepository repository, String packageId, SemanticVersion version, IPackageConstraintProvider constraintProvider, Boolean allowPrereleaseVersions, Boolean allowUnlisted)
February 27th 2018 12:08:55Error
   at Calamari.Integration.Packages.NuGet.NuGetV2Downloader.FindPackage(String packageId, String packageVersion, Uri feed, PackageDownloader& downloader)
February 27th 2018 12:08:55Error
   at Calamari.Integration.Packages.NuGet.NuGetV2Downloader.DownloadPackage(String packageId, String packageVersion, Uri feedUri, ICredentials feedCredentials, String targetFilePath)
February 27th 2018 12:08:55Error
   at Calamari.Integration.Packages.NuGet.NuGetPackageDownloader.DownloadPackage(String packageId, NuGetVersion version, Uri feedUri, ICredentials feedCredentials, String targetFilePath, Int32 maxDownloadAttempts, TimeSpan downloadAttemptBackoff, Action`5 action)
February 27th 2018 12:08:55Error
System.Exception
February 27th 2018 12:08:55Error
   at Calamari.Integration.Packages.NuGet.NuGetPackageDownloader.DownloadPackage(String packageId, NuGetVersion version, Uri feedUri, ICredentials feedCredentials, String targetFilePath, Int32 maxDownloadAttempts, TimeSpan downloadAttemptBackoff, Action`5 action)
February 27th 2018 12:08:55Error
   at Calamari.Integration.Packages.Download.PackageDownloader.DownloadPackage(String packageId, NuGetVersion version, Uri feedUri, ICredentials feedCredentials, String cacheDirectory, Int32 maxDownloadAttempts, TimeSpan downloadAttemptBackoff, LocalNuGetPackage& downloaded, String& downloadedTo)
February 27th 2018 12:08:55Error
   at Calamari.Integration.Packages.Download.PackageDownloader.DownloadPackage(String packageId, NuGetVersion version, String feedId, Uri feedUri, ICredentials feedCredentials, Boolean forcePackageDownload, Int32 maxDownloadAttempts, TimeSpan downloadAttemptBackoff, String& downloadedTo, String& hash, Int64& size)
February 27th 2018 12:08:55Error
   at Calamari.Commands.DownloadPackageCommand.Execute(String[] commandLineArguments)
February 27th 2018 12:08:55Error
--Inner Exception--
February 27th 2018 12:08:55Error
Unable to connect to the remote server
February 27th 2018 12:08:55Error
System.Net.WebException
February 27th 2018 12:08:55Error
   at System.Net.HttpWebRequest.GetResponse()
February 27th 2018 12:08:55Error
   at NuGet.RequestHelper.GetResponse()
February 27th 2018 12:08:55Error
   at NuGet.RedirectedHttpClient.GetResponseUri(HttpClient client)
February 27th 2018 12:08:55Error
   at NuGet.RedirectedHttpClient.EnsureClient()
February 27th 2018 12:08:55Error
   at System.Lazy`1.CreateValue()
February 27th 2018 12:08:55Error
   at System.Lazy`1.LazyInitValue()
February 27th 2018 12:08:55Error
   at NuGet.MemoryCache.GetOrAdd[T](Object cacheKey, Func`1 factory, TimeSpan expiration, Boolean absoluteExpiration)
February 27th 2018 12:08:55Error
   at NuGet.RedirectedHttpClient.get_CachedClient()
February 27th 2018 12:08:55Error
   at NuGet.RedirectedHttpClient.get_Uri()
February 27th 2018 12:08:55Error
   at NuGet.DataServicePackageRepository.get_Context()
February 27th 2018 12:08:55Error
   at NuGet.DataServicePackageRepository.FindPackage(String packageId, SemanticVersion version)
February 27th 2018 12:08:55Error
   at NuGet.PackageRepositoryExtensions.FindPackage(IPackageRepository repository, String packageId, SemanticVersion version, IPackageConstraintProvider constraintProvider, Boolean allowPrereleaseVersions, Boolean allowUnlisted)
February 27th 2018 12:08:55Error
   at Calamari.Integration.Packages.NuGet.NuGetV2Downloader.FindPackage(String packageId, String packageVersion, Uri feed, PackageDownloader& downloader)
February 27th 2018 12:08:55Error
   at Calamari.Integration.Packages.NuGet.NuGetV2Downloader.DownloadPackage(String packageId, String packageVersion, Uri feedUri, ICredentials feedCredentials, String targetFilePath)
February 27th 2018 12:08:55Error
   at Calamari.Integration.Packages.NuGet.NuGetPackageDownloader.DownloadPackage(String packageId, NuGetVersion version, Uri feedUri, ICredentials feedCredentials, String targetFilePath, Int32 maxDownloadAttempts, TimeSpan downloadAttemptBackoff, Action`5 action)
February 27th 2018 12:08:55Error
--Inner Exception--
February 27th 2018 12:08:55Error
A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond 10.81.94.11:80
February 27th 2018 12:08:55Error
System.Net.Sockets.SocketException
February 27th 2018 12:08:55Error
   at System.Net.Sockets.Socket.DoConnect(EndPoint endPointSnapshot, SocketAddress socketAddress)
February 27th 2018 12:08:55Error
   at System.Net.ServicePoint.ConnectSocketInternal(Boolean connectFailure, Socket s4, Socket s6, Socket& socket, IPAddress& address, ConnectSocketState state, IAsyncResult asyncResult, Exception& exception)

  1. Support Staff 1 Posted by Michael Compton on 28 Feb, 2018 08:34 AM

    Michael Compton's Avatar

    Hi, thanks for getting in touch.

    Setting proxies must be done just right. Can you check your settings, because there are two settings for proxies. The one you want for the web proxy is set in the Octopus Tentacle Manager] (https://octopus.com/docs/infrastructure/windows-targets/proxy-suppo...), which is different to the setting for Octopus-tentacle communication.

    If that's not the solution you're looking for, please get back to me and we can work though getting a test my side of your settings to see if we can reproduce the problem.

    Michael

  2. 2 Posted by daniel.would on 28 Feb, 2018 08:50 AM

    daniel.would's Avatar

    Hi Michael,
    Thanks for the response. I'm setting both types of proxy since my tentacle installation happens in a segregated VPC in aws. We use DSC to deploy the tentacles to the servers

    so when I install the tentacle I both call:
     Invoke-AndAssert { & .\tentacle.exe proxy --proxyEnable=True --proxyHost=$WebProxyAddress --proxyPort=$WebProxyPort --console }

    and
    $registerArguments = @("register-with", "--instance", $name, "--server", $octopusServerUrl, "--name", $env:COMPUTERNAME, "--publicHostName", $ipAddress, "--apiKey", $apiKey, "--comms-style", "TentaclePassive", "--proxy",$ProxyAddress, "--force", "--console")
     Invoke-AndAssert { & .\tentacle.exe ($registerArguments) }

    The tentacle finds the octopus server via a reverse proxy so it is able to register with the server. Then the server is able to correctly use the proxy to communicate with the tentacles.
    As I mentioned with teh web proxy configured I can use script console to trigger a webrequest from the tentacle, and that does use the webproxy. However the acquire package step running on the tentacle does not.

    For the moment I've worked around this by creating another reverse proxy for our nuget server and putting in a custom hosts entry on the server.

  3. Support Staff 3 Posted by Michael Compton on 02 Mar, 2018 05:10 AM

    Michael Compton's Avatar

    Hi,

    Are you able to access the packages off a NuGet V3 endpoint, rather than V2? I get different behaviours when the code runs trying to access through a V3 end point than with a V2 endpoint.

    Michael

  4. 4 Posted by daniel.would on 05 Mar, 2018 10:28 AM

    daniel.would's Avatar

    I can only use the internal proget server we have so I don’t have different versions to try I’m afraid.
    I’m not sure why the proxy configuration would behave differently depending on the version of the target endpoint.
    It’s working fine with my reverse proxy setup so I’ll just leave it that way for now.

    Sincerely

    Daniel

Reply to this discussion

Internal reply

Formatting help / Preview (switch to plain text) No formatting (switch to Markdown)

Attaching KB article:

»

Attached Files

You can attach files up to 10MB

If you don't have an account yet, we need to confirm you're human and not a machine trying to post spam.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac