MethodsAndPractices / vsteam

PowerShell module for accessing Azure DevOps Services and Azure DevOps Server (formerly VSTS or TFS)
https://methodsandpractices.github.io/vsteam-docs/
MIT License
445 stars 155 forks source link

Add-VSTeamBuild Issue #330

Closed GalenSmallen closed 4 years ago

GalenSmallen commented 4 years ago

Steps to reproduce

Add-VSTeamBuild -ProjectName Project -BuildDefinitionName Project.Test.Deploy -Verbose -Debug

Expected behavior

Starts a build on the Azure DevOps Server 2019 with that definition name.

Actual behavior

VERBOSE: Team Module/6.4.8 (Windows) PowerShell/5.1.17763.771
VERBOSE: GET http://#########/_apis/build/definitions?api-version=5.0&name=Radar.Dart.Module.Test.Deploy&includeAllProperties=T
rue&type=All with 0-byte payload
VERBOSE: received 10016-byte response of content type application/json; charset=utf-8; api-version=5.0
VERBOSE: return type: System.Management.Automation.PSCustomObject
VERBOSE: @{count=1; value=System.Object[]}
VERBOSE: Body {
    "definition":  {
                       "id":  260
                   }
}
VERBOSE: Team Module/6.4.8 (Windows) PowerShell/5.1.17763.771
VERBOSE: POST http://#######/_apis/build/builds?api-version=5.0 with -1-byte payload
VERBOSE: received 44799-byte response of content type application/json; charset=utf-8; api-version=5.0
VERBOSE: return type: System.Management.Automation.PSCustomObject
VERBOSE: @{count=9; value=System.Object[]}
You cannot call a method on a null-valued expression.
At C:\Program Files\WindowsPowerShell\Modules\vsteam\6.4.8\vsteam.functions.ps1:61 char:4
+    $item.logs.PSObject.TypeNames.Insert(0, 'Team.Logs')
+    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : InvokeMethodOnNull

You cannot call a method on a null-valued expression.
At C:\Program Files\WindowsPowerShell\Modules\vsteam\6.4.8\vsteam.functions.ps1:62 char:4
+    $item._links.PSObject.TypeNames.Insert(0, 'Team.Links')
+    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : InvokeMethodOnNull

You cannot call a method on a null-valued expression.
At C:\Program Files\WindowsPowerShell\Modules\vsteam\6.4.8\vsteam.functions.ps1:63 char:4
+    $item.project.PSObject.TypeNames.Insert(0, 'Team.Project')
+    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : InvokeMethodOnNull

You cannot call a method on a null-valued expression.
At C:\Program Files\WindowsPowerShell\Modules\vsteam\6.4.8\vsteam.functions.ps1:64 char:4
+    $item.requestedBy.PSObject.TypeNames.Insert(0, 'Team.User')
+    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : InvokeMethodOnNull

You cannot call a method on a null-valued expression.
At C:\Program Files\WindowsPowerShell\Modules\vsteam\6.4.8\vsteam.functions.ps1:65 char:4
+    $item.requestedFor.PSObject.TypeNames.Insert(0, 'Team.User')
+    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : InvokeMethodOnNull

You cannot call a method on a null-valued expression.
At C:\Program Files\WindowsPowerShell\Modules\vsteam\6.4.8\vsteam.functions.ps1:66 char:4
+    $item.lastChangedBy.PSObject.TypeNames.Insert(0, 'Team.User')
+    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : InvokeMethodOnNull

You cannot call a method on a null-valued expression.
At C:\Program Files\WindowsPowerShell\Modules\vsteam\6.4.8\vsteam.functions.ps1:67 char:4
+    $item.repository.PSObject.TypeNames.Insert(0, 'Team.Repository')
+    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : InvokeMethodOnNull

You cannot call a method on a null-valued expression.
At C:\Program Files\WindowsPowerShell\Modules\vsteam\6.4.8\vsteam.functions.ps1:68 char:4
+    $item.definition.PSObject.TypeNames.Insert(0, 'Team.BuildDefinitio ...
+    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : InvokeMethodOnNull

Environment data

OS

Server

Get-VSTeamAPIVersion

Name                           Value                                                                                                                           
----                           -----                                                                                                                           
Release                        5.0                                                                                                                             
Version                        AzD2019                                                                                                                         
MemberEntitlementManagement                                                                                                                                    
TaskGroups                     3.2-preview.1                                                                                                                   
DistributedTask                5.0                                                                                                                             
Core                           5.0                                                                                                                             
Packaging                                                                                                                                                      
ServiceFabricEndpoint          5.0                                                                                                                             
VariableGroups                 5.0                                                                                                                             
Build                          5.0                                                                                                                             
Git                            5.0                                                                                                                             
ExtensionsManagement           5.0                                                                                                                             
Graph                                                                                                                                                          
Policy                         5.0                                                                                                                             
Tfvc                           5.0  
$PSVersionTable

Name                           Value                                                                                                                           
----                           -----                                                                                                                           
PSVersion                      5.1.17763.771                                                                                                                   
PSEdition                      Desktop                                                                                                                         
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}                                                                                                         
BuildVersion                   10.0.17763.771                                                                                                                  
CLRVersion                     4.0.30319.42000                                                                                                                 
WSManStackVersion              3.0                                                                                                                             
PSRemotingProtocolVersion      2.3                                                                                                                             
SerializationVersion           1.1.0.1    
GalenSmallen commented 4 years ago

You can probably close this. They switched my Azure DevOps server to https. It seems that you can use the none secure url but it will redirect or fail to work. After i set the correct URL it worked. I don't know that there is anyway for this command to know that issue. Thanks.

SebastianSchuetze commented 4 years ago

So you configured the URL with http instead of https? If yes then it could be still an enhancement to either throw and error in the module or a warning about this problem.

Do you have the feeling the Azure DevOps itself is throwing the error?

I can see that in the log there is an object returned. Is this an error object? Could you provide the returned object the is shown with the output with:

VERBOSE: @{count=9; value=System.Object[]}
DarqueWarrior commented 4 years ago

On prem TFS servers don't have to require HTTPS. My test machines are HTTP not HTTPS. How can the module detect the mismatch of protocol their Server is configured with? If there is a way I say we investigate adding it. Otherwise I agree with @GalenSmallen and we just close this.

SebastianSchuetze commented 4 years ago

I made a quick check. Didn't find anything useful to check whether TFS is configured with HTTP or https. And I think we should only use the API to get the information if possible.

So I am closing this for now.