cake-build/resources

TLS Issue: build.ps1 - Could not download packages.config

Closed this issue ยท 8 comments

I have recently seen builds fail on Windows Server 2012 R2 build 9600 with the following:

D:\Jenkins\workspace\project-MFC7ZSI6BD4TDSTZ3QZN42CB6N4YSMKVGVEKCGPUBF3L2K2AFZCA>powershell .\build.ps1 
Preparing to run build script...
Could not download packages.config.
At D:\Jenkins\workspace\project-MFC7ZSI6BD4TDSTZ3QZN42CB6N4
YSMKVGVEKCGPUBF3L2K2AFZCA\build.ps1:126 char:9
+         Throw "Could not download packages.config."
+         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : OperationStopped: (Could not download packages.c 
   onfig.:String) [], RuntimeException
    + FullyQualifiedErrorId : Could not download packages.config.

This is due to the an issue with TLS during redirect from https://cakebuild.net/download/bootstrapper/packages to https://raw.githubusercontent.com/cake-build/resources/master/packages.config

Unwrapping the WebClient call results in the following exception:

Exception calling "DownloadFile" with "2" argument(s): "The request was aborted: Could not create SSL/TLS secure channel."

Same issue seen here, we also arrived at the same fix:

[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityProtocolType]::Tls12

The above work around solved this for us as well, thanks.

Philo commented

Just as an addition, make sure you add the line:

[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityProtocolType]::Tls12

after the CmdLetBinding section

CloudFlare has now sorted their issues and SSL handshake should now work as expected.

gep13 commented

@JeremyCade @richev @pants4robots @Philo if one of you could confirm that it is working again, without the workaround in place, we can get this issue closed out.

@gep13 happy to confirm that yes, the workaround is no longer needed.

Closing issue.

gep13 commented

@richev thank you for confirming! ๐Ÿ‘