Closed JPGRodrigues closed 8 years ago
By default the $/Project/Drops
folder is Cloaked. Which would prevent adding files. Could this be the case?
I'm uploading a new version with better error handling in the NonFatalError handler.
Pushed a new version which should provide better error handling in this case I suspect. It would help if you'd be able to share your workspace mappings and the configuration of the task when posting error reports :)
I did change the workspace to not Cloak $/Project/Drops This configuration is working for TFVCCheckin. Going to run with the new version...
With the latest version, there is no error, but nothing (new files) is checked-in, although I've new files!
Starting task: Adding pending changes
Executing the powershell script: W:\b\Software\agent\tasks\TFVCAdd\1.0.103\TfvcAdd.ps1 0 1 2 Microsoft.TeamFoundation.Client, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a 0 1 2 Microsoft.TeamFoundation.Common, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a 0 1 2 Microsoft.TeamFoundation.VersionControl.Client, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a 0 1 2 Microsoft.TeamFoundation.WorkItemTracking.Client, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a 0 1 2 Microsoft.TeamFoundation.Diff, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a Adding ItemSpec: $/POCs/MyDatabase/MyDatabase, Recursive: True
Finishing task: TFVCAdd
Is there a way for me to debug the task?
Changed my configuration to add files from $/Project/D instead of $/Project/Drops and the behavior is the same (with the newest version: no file check-in and no error).
The current tasks are horrible to debug. With a couple of updates of the build agent, Microsoft will allow you to run the scripts locally. Currently the way to do it is to download the task from the github, publish it to your account manually (using tfx build tasks upload --task-root .\vsts-tfvc-add) if the version you publish manually has a higher version it should override the one installed from the marketplace.
Then sprinkle the code with Write-Debug to get useful information, though I'm afraid that the Client Object Model won't give you a lot of information.
If you access to the build agent you could run tf status /recursive
on the workspace of the build agent to see what it currently thinks the status is.
Is the folder mapped at all? Any folder you want to add files from needs to be mapped. Which is a shame if it already contains a lot of data, as the agent will download the files in order to allow you to manipulate the workspace.
Can you share the json of the build definition?
Apparently it's related to the wildcards identifying the items to be added. When using $(build.sourcesdirectory)\Drops\MyDatabase.\ nothing gets added. But if I use $(build.sourcesdirectory)\Drops\MyDatabase\MyDatabase.dacpac the item is added.
Here's the json of the build definition
{
"build": [
{
"enabled": true,
"continueOnError": false,
"alwaysRun": false,
"displayName": "Build solution $/POCs/MyDatabase/MyDatabase.sln",
"task": {
"id": "71a9a2d3-a98a-4caa-96ab-affca411ecda",
"versionSpec": "*"
},
"inputs": {
"solution": "$/POCs/MyDatabase/MyDatabase.sln",
"msbuildArgs": "",
"platform": "$(BuildPlatform)",
"configuration": "$(BuildConfiguration)",
"clean": "true",
"restoreNugetPackages": "false",
"vsVersion": "14.0",
"msbuildArchitecture": "x86",
"logProjectEvents": "true"
}
},
{
"enabled": false,
"continueOnError": false,
"alwaysRun": false,
"displayName": "Test Assemblies **\\$(BuildConfiguration)\\*test*.dll;-:**\\obj\\**",
"task": {
"id": "ef087383-ee5e-42c7-9a53-ab56c98420f9",
"versionSpec": "*"
},
"inputs": {
"testAssembly": "**\\$(BuildConfiguration)\\*test*.dll;-:**\\obj\\**",
"testFiltercriteria": "",
"runSettingsFile": "",
"overrideTestrunParameters": "",
"codeCoverageEnabled": "false",
"runInParallel": "false",
"vsTestVersion": "14.0",
"pathtoCustomTestAdapters": "",
"otherConsoleOptions": "",
"testRunTitle": "",
"platform": "$(BuildPlatform)",
"configuration": "$(BuildConfiguration)",
"publishRunAttachments": "true"
}
},
{
"enabled": false,
"continueOnError": true,
"alwaysRun": false,
"displayName": "Publish symbols path: ",
"task": {
"id": "0675668a-7bba-4ccb-901d-5ad6554ca653",
"versionSpec": "*"
},
"inputs": {
"SymbolsPath": "",
"SearchPattern": "**\\bin\\**\\*.pdb",
"SymbolsFolder": "",
"SkipIndexing": "false",
"TreatNotIndexedAsWarning": "false",
"SymbolsMaximumWaitTime": "",
"SymbolsProduct": "",
"SymbolsVersion": "",
"SymbolsArtifactName": "Symbols_$(BuildConfiguration)"
}
},
{
"enabled": true,
"continueOnError": false,
"alwaysRun": true,
"displayName": "Copy Files to: $/POCs/MyDatabase/",
"task": {
"id": "5bfb729a-a7c8-4a78-a7c3-8d717bb7c13c",
"versionSpec": "*"
},
"inputs": {
"SourceFolder": "$(build.sourcesdirectory)\\MyDatabase\\MyDatabase\\bin\\Release",
"Contents": "**",
"TargetFolder": "$(build.sourcesdirectory)\\Drops\\MyDatabase\\",
"CleanTargetFolder": "true",
"OverWrite": "false"
}
},
{
"enabled": false,
"continueOnError": false,
"alwaysRun": false,
"displayName": "Powershell: W:\\b\\test.ps1",
"task": {
"id": "e213ff0f-5d5c-4791-802d-52ea3e7be1f1",
"versionSpec": "*"
},
"inputs": {
"scriptName": "W:\\b\\test.ps1",
"arguments": "",
"workingFolder": ""
}
},
{
"enabled": true,
"continueOnError": false,
"alwaysRun": true,
"displayName": "Adding pending changes",
"task": {
"id": "2ef90ef1-5298-4f6a-8b99-12933fed4de4",
"versionSpec": "*"
},
"inputs": {
"ItemSpec": "$(build.sourcesdirectory)\\Drops\\MyDatabase\\*.*",
"Recursive": "true",
"ApplyLocalitemExclusions": "false"
}
},
{
"enabled": true,
"continueOnError": false,
"alwaysRun": true,
"displayName": "Check changes into source control",
"task": {
"id": "31f040e5-e040-4556-878a-59a47c7128bd",
"versionSpec": "*"
},
"inputs": {
"ConfirmUnderstand": "true",
"IncludeNoCIComment": "false",
"OverridePolicy": "false",
"OverridePolicyReason": "Override reason",
"ItemSpec": "$(build.sourcesdirectory)\\Drops\\MyDatabase\\*.*",
"Recursion": "Full",
"Comment": "Check-in comment",
"Notes": ""
}
}
],
"options": [
{
"enabled": false,
"definition": { "id": "7c555368-ca64-4199-add6-9ebaf0b0137d" },
"inputs": {
"multipliers": "[]",
"parallel": "false",
"continueOnError": "true",
"additionalFields": "{}"
}
},
{
"enabled": false,
"definition": { "id": "a9db38f9-9fdc-478c-b0f9-464221e58316" },
"inputs": {
"workItemType": "360933",
"assignToRequestor": "true",
"additionalFields": "{}"
}
},
{
"enabled": true,
"definition": { "id": "57578776-4c22-4526-aeb0-86b6da17ee9c" },
"inputs": { "additionalFields": "{}" }
}
],
"triggers": [
{
"branchFilters": [ "+$/POCs/MyDatabase" ],
"batchChanges": true,
"maxConcurrentBuildsPerBranch": 1,
"triggerType": "continuousIntegration"
}
],
"variables": {
"system.debug": {
"value": "true",
"allowOverride": true
},
"BuildConfiguration": {
"value": "release",
"allowOverride": true
},
"BuildPlatform": {
"value": "any cpu",
"allowOverride": true
}
},
"retentionRules": [
{
"branches": [ "+refs/heads/*" ],
"artifacts": [ "build.SourceLabel" ],
"daysToKeep": 10,
"minimumToKeep": 1,
"deleteBuildRecord": true,
"deleteTestResults": true
}
],
"_links": {
"self": { "href": "https://jpgrodrigues.visualstudio.com/DefaultCollection/8e3b9947-a4e6-486e-b48b-40d6ba56db15/_apis/build/Definitions/13" },
"web": { "href": "https://jpgrodrigues.visualstudio.com/DefaultCollection/_permalink/_build/index?collectionId=a0cc05be-d0e2-4e80-b623-db6a62542c05&projectId=8e3b9947-a4e6-486e-b48b-40d6ba56db15&definitionId=13" }
},
"buildNumberFormat": "$(date:yyyyMMdd)$(rev:.r)",
"jobAuthorizationScope": "projectCollection",
"jobTimeoutInMinutes": 60,
"repository": {
"properties": {
"labelSources": "0",
"tfvcMapping": "{\"mappings\":[{\"serverPath\":\"$/POCs\",\"mappingType\":\"map\",\"localPath\":\"\\\\\"},{\"serverPath\":\"$/POCs/Drops/MyDatabase\",\"mappingType\":\"map\",\"localPath\":\"\\\\Drops\\\\MyDatabase\"},{\"serverPath\":\"$/POCs/MHSBSubscriptions\",\"mappingType\":\"cloak\",\"localPath\":\"\\\\\"},{\"serverPath\":\"$/POCs/MyServiceBusTests\",\"mappingType\":\"cloak\",\"localPath\":\"\\\\\"},{\"serverPath\":\"$/POCs/SendGrid\",\"mappingType\":\"cloak\",\"localPath\":\"\\\\\"},{\"serverPath\":\"$/POCs/Drops\",\"mappingType\":\"cloak\",\"localPath\":\"\\\\\"},{\"serverPath\":\"$/POCs/MyDatabase\",\"mappingType\":\"map\",\"localPath\":\"\\\\MyDatabase\"}]}"
},
"id": "$/",
"type": "TfsVersionControl",
"name": "POCs",
"url": "https://jpgrodrigues.visualstudio.com/DefaultCollection/",
"defaultBranch": "$/POCs",
"rootFolder": "$/POCs",
"clean": "true",
"checkoutSubmodules": false
},
"quality": "definition",
"authoredBy": {
"id": "98465892-6034-44d9-8965-b559db354db1",
"displayName": "João Paulo Rodrigues",
"uniqueName": "jpgrodrigues@live.com",
"url": "https://jpgrodrigues.vssps.visualstudio.com/_apis/Identities/98465892-6034-44d9-8965-b559db354db1",
"imageUrl": "https://jpgrodrigues.visualstudio.com/DefaultCollection/_api/_common/identityImage?id=98465892-6034-44d9-8965-b559db354db1"
},
"queue": {
"pool": {
"id": 3,
"name": "JPRodrig-W530"
},
"id": 3,
"name": "JPRodrig-W530"
},
"uri": "vstfs:///Build/Definition/13",
"type": "build",
"revision": 104,
"createdDate": "2016-02-22T15:16:35.28Z",
"id": 13,
"name": "MyDatabase",
"url": "https://jpgrodrigues.visualstudio.com/DefaultCollection/8e3b9947-a4e6-486e-b48b-40d6ba56db15/_apis/build/Definitions/13",
"project": {
"id": "8e3b9947-a4e6-486e-b48b-40d6ba56db15",
"name": "POCs",
"url": "https://jpgrodrigues.visualstudio.com/DefaultCollection/_apis/projects/8e3b9947-a4e6-486e-b48b-40d6ba56db15",
"state": "wellFormed",
"revision": 448684375
}
}
So I think I found the problem. When the script pends the add, removing the parameter parameter $ApplyLocalitemExclusions from the call resolves the issue.
Additionally, the process is not pending delete files requests, although the command tf status /recursive identifies deleted files.
Looks like you have a trailing drops/.
I suspect you'll need drops/*
and recursive set to full.
The itemspec class takes a different set of wildcards than msbuild and the other tasks use... On Feb 22, 2016 17:50, "JPGRodrigues" notifications@github.com wrote:
So I think I found the problem. When the script pends the add, the value for parameter $ApplyLocalitemExclusions is always true (even selecting a different option in the build definition). Removing the parameter from the call resolves the issue.
— Reply to this email directly or view it on GitHub https://github.com/jessehouwing/vsts-tfvc-tasks/issues/16#issuecomment-187261195 .
There is indeed something very fishy going on with the ApplyLocalItemexclusions...
I've released a new version which should solve the PendAdd issues. At least it does what I expect it to do on my test rig.
Next I'll dig into the deletes, which were working last month, so I'll have to see what has changed.
I'm closing this item after confirmation that adds are now doing what they are supposed to do on your side. I must have broken something with the deletes, so I'll need to figure out a way to fix that...
Considering either a separate task or a checkbox on the Check-in task... I suppose it's caused by the fact that I added all the workspace evaluation code for notes, messages etc...
I've shared a private build to your account that has a Delete task.
Check-in for a folder is running as expected. Thank you!
Separate delete task has been added and published to the marketplace. I placed you account back on the published version of the task, so you won't receive any versions I broke between builds.
Thanks for your time debugging and providing the information about the localitemexclusions, that helped me narrow down the issues.
Starting task: Adding pending changes
Executing the powershell script: W:\b\Software\agent\tasks\TFVCAdd\1.0.98\TfvcAdd.ps1 0 1 2 Microsoft.TeamFoundation.Client, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a 0 1 2 Microsoft.TeamFoundation.Common, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a 0 1 2 Microsoft.TeamFoundation.VersionControl.Client, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a 0 1 2 Microsoft.TeamFoundation.WorkItemTracking.Client, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a 0 1 2 Microsoft.TeamFoundation.Diff, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a Adding ItemSpec: w:\b\1\s\Drops\MyDatabase., Recursive: True
NonFatalError
System.Management.Automation.MethodInvocationException: Exception calling "PendAdd" with "7" argument(s): "Cannot bind argument to parameter 'Message' because it is null." ---> System.Management.Automation.ParameterBindingValidationException: Cannot bind argument to parameter 'Message' because it is null.
at System.Management.Automation.ExceptionHandlingOps.CheckActionPreference(FunctionContext funcContext, Exception exception)
at System.Management.Automation.Interpreter.ActionCallInstruction`2.Run(InterpretedFrame frame)
at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame)
at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame)
at System.Management.Automation.Interpreter.Interpreter.Run(InterpretedFrame frame)
at System.Management.Automation.Interpreter.LightLambda.RunVoid1[T0](T0 arg0)
at System.Management.Automation.ScriptBlock.InvokeWithPipeImpl(ScriptBlockClauseToInvoke clauseToInvoke, Boolean createLocalScope, Dictionary
2 functionsToDefine, List
1 variablesToDefine, ErrorHandlingBehavior errorHandlingBehavior, Object dollarUnder, Object input, Object scriptThis, Pipe outputPipe, InvocationInfo invocationInfo, Object[] args)at System.Management.Automation.ScriptBlock.<>cDisplayClassa.b 8()
at System.Management.Automation.Runspaces.RunspaceBase.RunActionIfNoRunningPipelinesWithThreadCheck(Action action)
at System.Management.Automation.ScriptBlock.InvokeWithPipe(Boolean useLocalScope, ErrorHandlingBehavior errorHandlingBehavior, Object dollarUnder, Object input, Object scriptThis, Pipe outputPipe, InvocationInfo invocationInfo, Boolean propagateAllExceptionsToTop, List
1 variablesToDefine, Dictionary
2 functionsToDefine, Object[] args)at System.Management.Automation.ScriptBlock.InvokeAsDelegateHelper(Object dollarUnder, Object dollarThis, Object[] args)
at Microsoft.TeamFoundation.VersionControl.Client.Client.OnNonFatalError(ExceptionEventArgs e)
at Microsoft.TeamFoundation.VersionControl.Client.Workspace.PendAdd(String[] paths, Boolean isRecursive, String fileType, LockLevel lockLevel, Boolean treatMissingItemsAsFiles, Boolean silent, Boolean applyLocalItemExclusions)
at CallSite.Target(Closure , CallSite , Object , Object[] , String , Object , LockLevel , Boolean , Boolean , String )
--- End of inner exception stack trace ---
at System.Management.Automation.ExceptionHandlingOps.CheckActionPreference(FunctionContext funcContext, Exception exception)
at System.Management.Automation.Interpreter.ActionCallInstruction`2.Run(InterpretedFrame frame)
at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame)
at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame)
at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame)
Finishing task: TFVCAdd
System.Exception: Task TFVCAdd failed. This caused the job to fail. Look at the logs for the task for more details.
at Microsoft.TeamFoundation.DistributedTask.Worker.JobRunner.Run(IJobContext jobContext, IJobRequest job, IJobExtension jobExtension, CancellationTokenSource tokenSource)