maikvandergaag / msft-extensions

Repository for extensions mainly used for Azure DevOps Extensions
https://msftplayground.com
MIT License
125 stars 80 forks source link

Trigger Azure DevOps Pipeline #403

Closed jhaughs closed 2 years ago

jhaughs commented 2 years ago

Describe the issue Was working for months but started failing on 04/05/22 with the following error:

[error]The underlying connection was closed: An unexpected error occurred on a send.

Extension

Log info

[debug]Evaluating condition for step: 'Trigger Electron BVT'

[debug]Evaluating: succeeded()

[debug]Evaluating succeeded:

[debug]=> True

[debug]Result: True

[section]Starting: Trigger Electron BVT

============================================================================== Task : Trigger Azure DevOps Pipeline Description : Build and Release Management task to trigger a Azure DevOps release or build pipeline. Version : 2.0.0 Author : Maik van der Gaag Help :

[debug]VstsTaskSdk 0.10.0 commit 787a46ec0a2df5b4d12c2e801bd3f319975c054c

[debug]Entering E:\WBA_tasks\TriggerPipeline_05485ce0-4948-481c-a89f-f21fa2fe9a74\2.0.0\run.ps1.

[debug]INPUT_CONNECTEDSERVICENAME: '9f5d096f-58ac-4c00-b824-af0546ec555e'

[debug]ENDPOINT_URL_9f5d096f-58ac-4c00-b824-af0546ec555e: 'https://dev.azure.com/acvs'

[debug]ENDPOINT_AUTH_9f5d096f-58ac-4c00-b824-af0546ec555e: '****'

[debug]ENDPOINT_DATA_9f5d096f-58ac-4c00-b824-af0546ec555e: '{"releaseUrl":"https://vsrm.dev.azure.com/[organization]"}'

[debug]INPUT_PROJECT: 'c7bc4372-f886-4c05-8fba-73510aec3e70'

[debug]INPUT_BUILDDEFINITION: 'jci-acvs-unified-electronclient-bvt'

[debug]INPUT_RELEASEDEFINITION (empty)

[debug]INPUT_PIPELINE: 'Build'

[debug]INPUT_DESCRIPTION (empty)

[debug]INPUT_BRANCH (empty)

[debug]INPUT_BUILDNUMBER (empty)

[debug]INPUT_STAGES (empty)


Service Connection: 9f5d096f-58ac-4c00-b824-af0546ec555e Release Url: https://vsrm.dev.azure.com/[organization] Organization Url: https://dev.azure.com/acvs Token: * Project name: c7bc4372-f886-4c05-8fba-73510aec3e70 Pipeline: Build Build pipeline: jci-acvs-unified-electronclient-bvt Release pipeline: Description: Branch: BuildNumber: ** Stages:


[debug]GET https://dev.azure.com/acvs/c7bc4372-f886-4c05-8fba-73510aec3e70/_apis/build/definitions?name=jci-acvs-unified-electronclient-bvt with 0-byte payload

[debug]Leaving E:\WBA_tasks\TriggerPipeline_05485ce0-4948-481c-a89f-f21fa2fe9a74\2.0.0\run.ps1.

[debug]Caught exception from task script.

[debug]Error record:

[debug]Invoke-RestMethod : The underlying connection was closed: An unexpected error occurred on a send.

[debug]At E:\WBA_tasks\TriggerPipeline_05485ce0-4948-481c-a89f-f21fa2fe9a74\2.0.0\run-build.ps1:30 char:21

[debug]+ ... finitions = Invoke-RestMethod -Uri $buildUri -Method Get -ContentType ...

[debug]+ ~~~~~~~~~~~~~

[debug] + CategoryInfo : InvalidOperation: (System.Net.HttpWebRequest:Htt pWebRequest) [Invoke-RestMethod], WebException

[debug] + FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShe ll.Commands.InvokeRestMethodCommand

[debug]

[debug]Script stack trace:

[debug]at , E:\WBA_tasks\TriggerPipeline_05485ce0-4948-481c-a89f-f21fa2fe9a74\2.0.0\run-build.ps1: line 30

[debug]at , E:\WBA_tasks\TriggerPipeline_05485ce0-4948-481c-a89f-f21fa2fe9a74\2.0.0\run.ps1: line 43

[debug]at , : line 1

[debug]at , : line 22

[debug]at , : line 18

[debug]at , : line 1

[debug]Exception:

[debug]System.Net.WebException: The underlying connection was closed: An unexpected error occurred on a send. ---> System.IO.IOException: Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host. ---> System.Net.Sockets.SocketException: An existing connection was forcibly closed by the remote host

[debug] at System.Net.Sockets.Socket.EndReceive(IAsyncResult asyncResult)

[debug] at System.Net.Sockets.NetworkStream.EndRead(IAsyncResult asyncResult)

[debug] --- End of inner exception stack trace ---

[debug] at System.Net.TlsStream.EndWrite(IAsyncResult asyncResult)

[debug] at System.Net.ConnectStream.WriteHeadersCallback(IAsyncResult ar)

[debug] --- End of inner exception stack trace ---

[debug] at Microsoft.PowerShell.Commands.WebRequestPSCmdlet.GetResponse(WebRequest request)

[debug] at Microsoft.PowerShell.Commands.WebRequestPSCmdlet.ProcessRecord()

[error]The underlying connection was closed: An unexpected error occurred on a send.

[debug]Processed: ##vso[task.logissue type=error]The underlying connection was closed: An unexpected error occurred on a send.

[debug]Processed: ##vso[task.complete result=Failed]

[section]Finishing: Trigger Electron BVT

Additional information Add any other context about the problem here.

jhaughs commented 2 years ago

FYI

It appears to be TLS related, I managed to script it with powershell instead but I needed to add this line to get it to work [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls -bor [Net.SecurityProtocolType]::Tls11 -bor

maikvandergaag commented 2 years ago

Made a fix to the extension. It will be published in about 30 minutes