jbramwell / VSTS-Tools

Various command-line utilities for interacting with Visual Studio Team Services (VSTS)
MIT License
11 stars 7 forks source link

VSTS-Tools Keep exception with .NET based build agent #6

Closed pascalberger closed 7 years ago

pascalberger commented 7 years ago

I've a build definition working fine with the legacy windows build agent. After switching to the .NET based build agent I receive the following error (myvststenant was the name of the VSTS tenant where the build was run):

******************************************************************************
Starting: VSTSToolsKeep
******************************************************************************
Preparing task execution handler.
Executing the powershell script: d:\work\_tasks\VSTSToolsKeep_dbfd5ff9-3134-4dce-b0ca-3232a0bfd381\1.4.1\keepbuild.ps1
PowerShellHandler.Execute - AddCommand(d:\work\_tasks\VSTSToolsKeep_dbfd5ff9-3134-4dce-b0ca-3232a0bfd381\1.4.1\keepbuild.ps1)
PowerShellHandler.Execute - Add inputParameters
PowerShellHandler.Execute - AddParameter(targetbranch=master)
PowerShellHandler.Execute - AddParameter(debugonly=false)
PowerShellHandler.Execute - Invoke
Entering: keepbuild.ps1
targetbranch: master
debugonly: false
Loading module from path 'D:\BuildAgent\externals\vstshost\Microsoft.TeamFoundation.DistributedTask.Task.Common\Microsoft.TeamFoundation.DistributedTask.Task.Common.psm1'.
Loading module from path 'D:\BuildAgent\externals\vstshost\Microsoft.TeamFoundation.DistributedTask.Task.LegacySDK.dll'.
Importing cmdlet 'Invoke-ResultPublisher'.
Importing cmdlet 'Publish-TestResults'.
Importing cmdlet 'Add-BuildArtifactLink'.
Importing cmdlet 'Add-BuildAttachment'.
Importing cmdlet 'Convert-String'.
Importing cmdlet 'Copy-BuildArtifact'.
Importing cmdlet 'Get-JavaDevelopmentKitPath'.
Importing cmdlet 'Get-MSBuildLocation'.
Importing cmdlet 'Get-ServiceEndpoint'.
Importing cmdlet 'Get-TaskVariable'.
Importing cmdlet 'Get-TfsClientCredentials'.
Importing cmdlet 'Get-ToolPath'.
Importing cmdlet 'Get-VisualStudioPath'.
Importing cmdlet 'Get-VssConnection'.
Importing cmdlet 'Invoke-Ant'.
Importing cmdlet 'Invoke-BatchScript'.
Importing cmdlet 'Invoke-Maven'.
Importing cmdlet 'Invoke-MSBuild'.
Importing cmdlet 'Invoke-Tool'.
Importing cmdlet 'Invoke-VSTest'.
Importing cmdlet 'Publish-BuildArtifact'.
Importing cmdlet 'Register-XamarinLicense'.
Importing cmdlet 'Unregister-XamarinLicense'.
Importing cmdlet 'Get-X509Certificate'.
Importing cmdlet 'Invoke-DeployTestAgent'.
Importing cmdlet 'Invoke-RunDistributedTests'.
Importing cmdlet 'Invoke-BlockEnvironment'.
Importing cmdlet 'Copy-FilesToAzureBlob'.
Importing cmdlet 'Copy-FilesToTargetMachine'.
Importing cmdlet 'Copy-ToAzureMachines'.
Importing cmdlet 'Remove-Environment'.
Importing cmdlet 'Remove-EnvironmentResources'.
Importing cmdlet 'Complete-EnvironmentOperation'.
Importing cmdlet 'Complete-EnvironmentResourceOperation'.
Importing cmdlet 'Complete-ResourceOperation'.
Importing cmdlet 'Get-Environment'.
Importing cmdlet 'Get-EnvironmentProperty'.
Importing cmdlet 'Get-EnvironmentResources'.
Importing cmdlet 'Get-ExternalIpAddress'.
Importing cmdlet 'Get-ParsedSessionVariables'.
Importing cmdlet 'Get-ProviderData'.
Importing cmdlet 'Invoke-EnvironmentOperation'.
Importing cmdlet 'Invoke-ResourceOperation'.
Importing cmdlet 'Invoke-PsOnRemote'.
Importing cmdlet 'New-OperationLog'.
Importing cmdlet 'Copy-FilesToRemote'.
Importing cmdlet 'Register-Environment'.
Importing cmdlet 'Register-EnvironmentDefinition'.
Importing cmdlet 'Register-Provider'.
Importing cmdlet 'Register-ProviderData'.
Importing cmdlet 'Invoke-UnblockEnvironment'.
Importing cmdlet 'Add-TaskIssue'.
Importing cmdlet 'Complete-Task'.
Importing cmdlet 'Find-Files'.
Importing cmdlet 'Get-LocalizedString'.
Importing cmdlet 'Set-TaskProgress'.
Importing cmdlet 'Set-TaskVariable'.
Importing cmdlet 'Write-TaskDetail'.
Importing cmdlet 'Enable-CodeCoverage'.
Importing cmdlet 'Publish-CodeCoverage'.
Exporting cmdlet 'Add-TaskIssue'.
Exporting cmdlet 'Complete-Task'.
Exporting cmdlet 'Find-Files'.
Exporting cmdlet 'Get-LocalizedString'.
Exporting cmdlet 'Set-TaskProgress'.
Exporting cmdlet 'Set-TaskVariable'.
Exporting cmdlet 'Write-TaskDetail'.
Importing cmdlet 'Add-TaskIssue'.
Importing cmdlet 'Complete-Task'.
Importing cmdlet 'Find-Files'.
Importing cmdlet 'Get-LocalizedString'.
Importing cmdlet 'Set-TaskProgress'.
Importing cmdlet 'Set-TaskVariable'.
Importing cmdlet 'Write-TaskDetail'.
URI: MYVSTSTENANT/_apis/build/builds/21361?api-version=2.0
Processing: ##vso[task.logissue type=error;]System.Net.WebException: The remote name could not be resolved: 'myvststenant'
System.Net.WebException: The remote name could not be resolved: 'myvststenant'
   at System.Net.HttpWebRequest.GetRequestStream(TransportContext& context)
   at System.Net.HttpWebRequest.GetRequestStream()
   at Microsoft.PowerShell.Commands.WebRequestPSCmdlet.SetRequestContent(WebRequest request, String content)
   at Microsoft.PowerShell.Commands.WebRequestPSCmdlet.ProcessRecord()
   at System.Management.Automation.CommandProcessor.ProcessRecord()
RESULT: 
PowerShell script completed with 1 errors.
pascalberger commented 7 years ago

Looking at the implementation here, it seems like $env:SYSTEM_TEAMFOUNDATIONSERVERURI is not set with the new agent.