bluebasher / workitemupdater Goto Github PK
View Code? Open in Web Editor NEWSource code for the VSTS WorkItemUpdater build task
License: MIT License
Source code for the VSTS WorkItemUpdater build task
License: MIT License
AFAIK I'm on the latest build (unsure on quite how to check), however the errors reported in #2 are still being received when I try to use thin in a new test TFS 2017 Update 2 Git based project.
When you have a release pipeline that uses several build artifacts, only items that are in both artifacts have their status updated. (using diff between deployment as source of workitems)
For me it seems like the default behavior should be that workitems in any of the build artifacts should be updated.
An option to toggle this behavior could also be provided, but just reversing the way it works today would fix any issue in my opinion (otherwise it's counter intuitive)
I have a release pipeline with 5 artifacts coming from 5 different pipeline.
in that case the value coming from Build.BuildId cannot be trusted because it gave you only one (first one in the array for what I can tell).
by using the allWorkItemsSinceLastRelease it tries to retreive all workitem with the
getReleaseWorkItemsRefs, but i don't know why it seems to never retreive anything
i managed to get a list of workitems by tempering in the js of the activity and using the artifact list.
const releaseClient = yield vstsWebApi.getReleaseApi();
var currentRelease = yield releaseClient.getRelease(settings.projectId, settings.releaseId);
tl.debug(currentRelease.name);
tl.debug(currentRelease.artifacts.length);
for (let artifacts of currentRelease.artifacts)
{
tl.debug(`Looking at artifact [${artifacts.alias}]`);
tl.debug(`Build Number ID [${artifacts.definitionReference.version.id}]`);
var releaseWorkItemRefs = yield buildClient.getBuildWorkItemsRefs(settings.projectId, [parseInt(artifacts.definitionReference.version.id)]);
releaseWorkItemRefs.forEach((releaseWorkItem) => {
tl.debug('push :' + releaseWorkItem.id);
result.push({id: releaseWorkItem.id.toString(),
url: releaseWorkItem.url
});
});
}
return result;
Hi,
I have added this task in my VSTS build.
I just want to update my work item type "Issue" from any state to "Closed" after the successful build.
The build succeeds and I dont see any change in the Issue State.
I'm not using Kanban boards, is mandatory to use?
Can you please help me to make this work for me?
Thanks,
DKS
Hi,
I'm trying to update a "Bug" to "Fixed" State after a successful build. I see it failing in VSTS
Defaulted OM directory to: 'E:\agent_work_tasks\WorkItemUpdater_7164116a-ed17-48be-9c53-b440b2b1dd2e\1.3.712'
Testing whether type can be loaded: 'Microsoft.TeamFoundation.Build.WebApi.BuildHttpClient'
The type was not loaded.
Testing leaf path: 'E:\agent_work_tasks\WorkItemUpdater_7164116a-ed17-48be-9c53-b440b2b1dd2e\1.3.712\Microsoft.TeamFoundation.Build.WebApi.WebApi.dll'
Not found.
Testing leaf path: 'E:\agent_work_tasks\WorkItemUpdater_7164116a-ed17-48be-9c53-b440b2b1dd2e\1.3.712\Microsoft.TeamFoundation.Build.WebApi.dll'
Loading assembly: E:\agent_work_tasks\WorkItemUpdater_7164116a-ed17-48be-9c53-b440b2b1dd2e\1.3.712\Microsoft.TeamFoundation.Build.WebApi.dll
Testing whether type can be loaded: 'Microsoft.TeamFoundation.Build.WebApi.BuildHttpClient'
The type was loaded successfully.
Leaving Get-OMType.
Constructing HTTP client.
Leaving Get-VssHttpClient.
GetBuildWorkItemsRefsAsync 852fb03c-1a3b-46a6-a848-e5ef0774349a 614
Loop workItemsRefs
Found WorkItemRef: 3200
Found WorkItem: 3200
Updating WorkItem 3200
Found Kanban Lane:
Found KanbanColumn:
Patch: /fields/System.State Closed
You cannot call a method on a null-valued expression.
at CallSite.Target(Closure , CallSite , Object , String )
at System.Dynamic.UpdateDelegates.UpdateAndExecute2[T0,T1,TRet](CallSite site, T0 arg0, T1 arg1)
at System.Management.Automation.Interpreter.DynamicInstruction`3.Run(InterpretedFrame frame)
at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame)
Leaving E:\agent_work_tasks\WorkItemUpdater_7164116a-ed17-48be-9c53-b440b2b1dd2e\1.3.712\task.ps1.
Caught exception from task script.
Error record:
E:\agent_work_tasks\WorkItemUpdater_7164116a-ed17-48be-9c53-b440b2b1dd2e\1.3.712\task.ps1 : Cannot validate argument on parameter 'Result'. The argument "Error updating workitems" does not belong to the set "Succeeded,SucceededWithIssues,Failed,Cancelled,Skipped" specified by the ValidateSet attribute. Supply an argument that is in the set and then try the command again.
At line:1 char:1
Script stack trace:
at , E:\agent_work_tasks\WorkItemUpdater_7164116a-ed17-48be-9c53-b440b2b1dd2e\1.3.712\task.ps1: line 279
at , : line 1
at , : line 22
at , : line 18
at , : line 1
Exception:
System.Management.Automation.ParameterBindingValidationException: Cannot validate argument on parameter 'Result'. The argument "Error updating workitems" does not belong to the set "Succeeded,SucceededWithIssues,Failed,Cancelled,Skipped" specified by the ValidateSet attribute. Supply an argument that is in the set and then try the command again. ---> System.Management.Automation.ValidationMetadataException: The argument "Error updating workitems" does not belong to the set "Succeeded,SucceededWithIssues,Failed,Cancelled,Skipped" specified by the ValidateSet attribute. Supply an argument that is in the set and then try the command again.
at System.Management.Automation.ValidateSetAttribute.ValidateElement(Object element)
at System.Management.Automation.ParameterBinderBase.BindParameter(CommandParameterInternal parameter, CompiledCommandParameter parameterMetadata, ParameterBindingFlags flags)
--- End of inner exception stack trace ---
at System.Management.Automation.ExceptionHandlingOps.CheckActionPreference(FunctionContext funcContext, Exception exception)
at System.Management.Automation.Interpreter.ActionCallInstruction2.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.PSScriptCmdlet.RunClause(Action
1 clause, Object dollarUnderbar, Object inputToProcess)
at System.Management.Automation.PSScriptCmdlet.DoEndProcessing()
at System.Management.Automation.CommandProcessorBase.Complete()
Cannot validate argument on parameter 'Result'. The argument "Error updating workitems" does not belong to the set "Succeeded,SucceededWithIssues,Failed,Cancelled,Skipped" specified by the ValidateSet attribute. Supply an argument that is in the set and then try the command again.
Processed: ##vso[task.logissue type=error]Cannot validate argument on parameter 'Result'. The argument "Error updating workitems" does not belong to the set "Succeeded,SucceededWithIssues,Failed,Cancelled,Skipped" specified by the ValidateSet attribute. Supply an argument that is in the set and then try the command again.
Processed: ##vso[task.complete result=Failed]
Any thought to make this work?
Thanks,
DKS
We have a pretty "old" work item template and there are "several" states, but you can't choose the state as you want, because this is "managed" by a workflow.
e.g. A "bug" is "active" then "resolved" and then "closed", but you can't change the state from "closed" to "resolved" again, because you only are allowed to go back to the "active" state.
Long story short: Some of our bugs are "closed" manually, and with your workitem update our build fails with this:
2019-02-25T12:39:17.1961692Z Found WorkItem: 13537
2019-02-25T12:39:17.1962488Z Updating WorkItem 13537
2019-02-25T12:39:17.1964322Z Patch: /fields/System.State Resolved
2019-02-25T12:39:17.1964499Z Patch: /fields/WEF_3A292E1060A74F0D855805CD82AF410E_Kanban.Column.Done false
2019-02-25T12:39:17.2710005Z ##[error]Error: The field 'State' contains the value 'Resolved' that is not in the list of supported values
It would be nice if we could somehow say that this is "ok". If the workitemupdater can't set the state to "resolve" the reason might be that the bug is already closed, which is fine for us.
Let me know if you need any other information.
Thanks for your work - we are glad that the "tag" feature is working quite well! ๐
it would be great if it can update other fields like swimlane etc
Hi I am getting above error.
I have added this task as last item in the release pipeline.
2017-06-30T03:06:08.3880037Z ##[debug]Importing function 'Assert-Path'.
2017-06-30T03:06:08.3880037Z ##[debug]Importing function 'Find-Files'.
2017-06-30T03:06:08.3890038Z ##[debug]Importing function 'Find-Match'.
2017-06-30T03:06:08.3900039Z ##[debug]Importing function 'Get-AssemblyReference'.
2017-06-30T03:06:08.3910040Z ##[debug]Importing function 'Get-Endpoint'.
2017-06-30T03:06:08.3920041Z ##[debug]Importing function 'Get-Input'.
2017-06-30T03:06:08.3930042Z ##[debug]Importing function 'Get-LocString'.
2017-06-30T03:06:08.3940043Z ##[debug]Importing function 'Get-TaskVariable'.
2017-06-30T03:06:08.3950044Z ##[debug]Importing function 'Get-TaskVariableInfo'.
2017-06-30T03:06:08.3970046Z ##[debug]Importing function 'Get-TfsClientCredentials'.
2017-06-30T03:06:08.3980047Z ##[debug]Importing function 'Get-TfsService'.
2017-06-30T03:06:08.3990048Z ##[debug]Importing function 'Get-VssCredentials'.
2017-06-30T03:06:08.4010050Z ##[debug]Importing function 'Get-VssHttpClient'.
2017-06-30T03:06:08.4020051Z ##[debug]Importing function 'Import-LocStrings'.
2017-06-30T03:06:08.4030052Z ##[debug]Importing function 'Invoke-Tool'.
2017-06-30T03:06:08.4040053Z ##[debug]Importing function 'New-FindOptions'.
2017-06-30T03:06:08.4050054Z ##[debug]Importing function 'New-MatchOptions'.
2017-06-30T03:06:08.4060055Z ##[debug]Importing function 'Out-Default'.
2017-06-30T03:06:08.4070056Z ##[debug]Importing function 'Select-Match'.
2017-06-30T03:06:08.4080057Z ##[debug]Importing function 'Set-TaskVariable'.
2017-06-30T03:06:08.4090058Z ##[debug]Importing function 'Trace-EnteringInvocation'.
2017-06-30T03:06:08.4100059Z ##[debug]Importing function 'Trace-LeavingInvocation'.
2017-06-30T03:06:08.4120061Z ##[debug]Importing function 'Trace-Path'.
2017-06-30T03:06:08.4120061Z ##[debug]Importing function 'Write-AddAttachment'.
2017-06-30T03:06:08.4140063Z ##[debug]Importing function 'Write-AddBuildTag'.
2017-06-30T03:06:08.4140063Z ##[debug]Importing function 'Write-AssociateArtifact'.
2017-06-30T03:06:08.4150064Z ##[debug]Importing function 'Write-LogDetail'.
2017-06-30T03:06:08.4160065Z ##[debug]Importing function 'Write-SetProgress'.
2017-06-30T03:06:08.4170066Z ##[debug]Importing function 'Write-SetResult'.
2017-06-30T03:06:08.4180067Z ##[debug]Importing function 'Write-SetSecret'.
2017-06-30T03:06:08.4190068Z ##[debug]Importing function 'Write-SetVariable'.
2017-06-30T03:06:08.4200069Z ##[debug]Importing function 'Write-TaskDebug'.
2017-06-30T03:06:08.4230072Z ##[debug]Importing function 'Write-TaskError'.
2017-06-30T03:06:08.4240073Z ##[debug]Importing function 'Write-TaskVerbose'.
2017-06-30T03:06:08.4460095Z ##[debug]Importing function 'Write-TaskWarning'.
2017-06-30T03:06:08.4460095Z ##[debug]Importing function 'Write-UpdateBuildNumber'.
2017-06-30T03:06:08.4620111Z ##[debug]Importing function 'Write-UploadArtifact'.
2017-06-30T03:06:08.4630112Z ##[debug]Importing function 'Write-UploadBuildLog'.
2017-06-30T03:06:08.5110160Z ##[debug]BuildId 604
2017-06-30T03:06:08.5120161Z ##[debug]ProjectId 34147a9c-0c69-4132-aa13-4e2cd697ac95
2017-06-30T03:06:08.5130162Z ##[debug]requestedFor Sumit Yadam
2017-06-30T03:06:08.5130162Z ##[debug]workItemType User Story
2017-06-30T03:06:08.5130162Z ##[debug]WorkItemState Active
2017-06-30T03:06:08.5140163Z ##[debug]WorkItemKanbanState In Dev
2017-06-30T03:06:08.5140163Z ##[debug]WorkItemDone False
2017-06-30T03:06:08.5150164Z ##[debug]updateAssignedTo Never
2017-06-30T03:06:08.9090558Z Index was outside the bounds of the array.
2017-06-30T03:06:08.9100559Z at System.Management.Automation.Adapter.CompareOverloadCandidates(OverloadCandidate candidate1, OverloadCandidate candidate2, Object[] arguments)
2017-06-30T03:06:08.9100559Z at System.Management.Automation.Adapter.FindBestCandidate(IEnumerable`1 candidates, Object[] arguments)
2017-06-30T03:06:08.9110560Z at System.Management.Automation.Adapter.FindBestCandidate(IEnumerable`1 candidates, Object[] arguments, PSMethodInvocationConstraints invocationConstraints)
2017-06-30T03:06:08.9110560Z at System.Management.Automation.Adapter.FindBestMethod(MethodInformation[] methods, PSMethodInvocationConstraints invocationConstraints, Object[] arguments, String& errorId, String& errorMsg, Boolean& expandParamsOnBest)
2017-06-30T03:06:08.9110560Z at System.Management.Automation.Language.PSInvokeMemberBinder.InvokeDotNetMethod(DynamicMetaObject target, DynamicMetaObject[] args, BindingRestrictions restrictions, MethodInformation[] mi, Type errorExceptionType)
2017-06-30T03:06:08.9110560Z at System.Management.Automation.Language.PSInvokeMemberBinder.FallbackInvokeMember(DynamicMetaObject target, DynamicMetaObject[] args, DynamicMetaObject errorSuggestion)
2017-06-30T03:06:08.9110560Z at System.Management.Automation.PSObject.PSDynamicMetaObject.BindInvokeMember(InvokeMemberBinder binder, DynamicMetaObject[] args)
2017-06-30T03:06:08.9120561Z at System.Dynamic.DynamicMetaObjectBinder.Bind(Object[] args, ReadOnlyCollection`1 parameters, LabelTarget returnLabel)
2017-06-30T03:06:08.9120561Z at System.Runtime.CompilerServices.CallSiteBinder.BindCore[T](CallSite`1 site, Object[] args)
2017-06-30T03:06:08.9120561Z at System.Dynamic.UpdateDelegates.UpdateAndExecute3[T0,T1,T2,TRet](CallSite site, T0 arg0, T1 arg1, T2 arg2)
2017-06-30T03:06:08.9120561Z at System.Management.Automation.Interpreter.DynamicInstruction`4.Run(InterpretedFrame frame)
2017-06-30T03:06:08.9120561Z at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame)
2017-06-30T03:06:08.9710620Z ##[error]Cannot validate argument on parameter 'Result'. The argument "Error updating workitems" does not belong to the set "Succeeded,SucceededWithIssues,Failed,Cancelled,Skipped" specified by the ValidateSet attribute. Supply an argument that is in the set and then try the command again.
Hi,
This looks awesome, but it doesn't seem to want to successfully update Task items in the Agile process template.
I specifically set it to update Task items where the status is Active and set it to Closed. The task runs in the CI/CD process but nothing gets updated.
Thank you.
We have the a board column that is splitted in Doing / Done columns.
We use the task with the following configuration
- task: WorkItemUpdater@2
displayName: 'Update Bug (test)'
inputs:
workItemType: Bug
linkBuild: true
When a work item is already in the Done column, the WorkItemUpdater task will move it back to the Doing column.
We expect that not setting anything in the YAML configuration won't change the state of this column.
since kanban columns / lane is a dynamic field, constructed as {boardID}.Kanban.Column
if the workitem was never in that board as with new workitems or old workitems that was created before adding the kanban board, the script will break because the field isn't defined,
there needs be a check if the field exists and if doesn't skip
I am configuring this task in vsts via:
Update 'Assigned To' = Aways
Update 'Assigned To' with = Unassign the work item
this is causing my release to fail - here's the config and log:
2018-07-20T15:29:47.3904260Z ##[debug]Evaluating condition for step: 'Move Related Work Items to In QA'
2018-07-20T15:29:47.3946160Z ##[debug]Evaluating: succeeded()
2018-07-20T15:29:47.3973660Z ##[debug]Evaluating succeeded:
2018-07-20T15:29:47.4012230Z ##[debug]=> True
2018-07-20T15:29:47.4039900Z ##[debug]Result: True
2018-07-20T15:29:47.4061230Z ##[section]Starting: Move Related Work Items to In QA
2018-07-20T15:29:47.4180700Z ==============================================================================
2018-07-20T15:29:47.4194200Z Task : WorkItem Updater
2018-07-20T15:29:47.4207880Z Description : This task adds functionality to update WorkItems during a Build or Release.
2018-07-20T15:29:47.4221410Z Version : 2.4.784
2018-07-20T15:29:47.4238700Z Author : Blue Basher
2018-07-20T15:29:47.4262430Z Help :
2018-07-20T15:29:47.4278260Z ==============================================================================
2018-07-20T15:29:47.8424370Z ##[debug]agent.TempDirectory=/Users/vsts/agent/2.136.1/work/_temp
2018-07-20T15:29:47.8481360Z ##[debug]loading inputs and endpoints
2018-07-20T15:29:47.8505890Z ##[debug]loading INPUT_WORKITEMSSOURCE
2018-07-20T15:29:47.8530270Z ##[debug]loading INPUT_WORKITEMTYPE
2018-07-20T15:29:47.8554840Z ##[debug]loading INPUT_ALLWORKITEMSSINCELASTRELEASE
2018-07-20T15:29:47.8580770Z ##[debug]loading INPUT_WORKITEMSTATE
2018-07-20T15:29:47.8605710Z ##[debug]loading INPUT_WORKITEMCURRENTSTATE
2018-07-20T15:29:47.8631530Z ##[debug]loading INPUT_WORKITEMDONE
2018-07-20T15:29:47.8656100Z ##[debug]loading INPUT_LINKBUILD
2018-07-20T15:29:47.8694680Z ##[debug]loading INPUT_UPDATEASSIGNEDTO
2018-07-20T15:29:47.8733970Z ##[debug]loading INPUT_UPDATEASSIGNEDTOWITH
2018-07-20T15:29:47.8764100Z ##[debug]loading ENDPOINT_AUTH_SYSTEMVSSCONNECTION
2018-07-20T15:29:47.8799110Z ##[debug]loading ENDPOINT_AUTH_SCHEME_SYSTEMVSSCONNECTION
2018-07-20T15:29:47.8838480Z ##[debug]loading ENDPOINT_AUTH_PARAMETER_SYSTEMVSSCONNECTION_ACCESSTOKEN
2018-07-20T15:29:47.8877930Z ##[debug]loading SECRET_ANDROIDKEYSTOREPASSWORD
2018-07-20T15:29:47.8916810Z ##[debug]loading SECRET_ANDROIDKEYSTOREALIAS
2018-07-20T15:29:47.8955310Z ##[debug]loading SECRET_IOSDISTRIBUTIONPASSWORD
2018-07-20T15:29:47.8992560Z ##[debug]loaded 15
2018-07-20T15:29:47.9017680Z ##[debug]Agent.ProxyUrl=undefined
2018-07-20T15:29:47.9043300Z ##[debug]Agent.CAInfo=undefined
2018-07-20T15:29:47.9067420Z ##[debug]Agent.ClientCert=undefined
2018-07-20T15:29:47.9091570Z ##[debug]Agent.SkipCertValidation=undefined
2018-07-20T15:29:48.0244370Z ##[debug]System.TeamFoundationCollectionUri=https://redarrowlabs.visualstudio.com/
2018-07-20T15:29:48.0280600Z ##[debug]SYSTEMVSSCONNECTION auth param AccessToken = ***
2018-07-20T15:29:48.0305110Z ##[debug]Build.BuildId=23114
2018-07-20T15:29:48.0336040Z ##[debug]System.TeamProjectId=1e7b8740-5b44-4756-aeaf-363d1c1e4d5c
2018-07-20T15:29:48.0364940Z ##[debug]Build.RequestedFor=Ethan Frei
2018-07-20T15:29:48.0388830Z ##[debug]workitemsSource=Build
2018-07-20T15:29:48.0412200Z ##[debug]workitemsSourceQuery=null
2018-07-20T15:29:48.0435740Z ##[debug]allWorkItemsSinceLastRelease=false
2018-07-20T15:29:48.0459000Z ##[debug]workItemType=User Story
2018-07-20T15:29:48.0482330Z ##[debug]workItemState=In QA
2018-07-20T15:29:48.0505980Z ##[debug]workItemCurrentState=Active
2018-07-20T15:29:48.0544530Z ##[debug]workItemKanbanLane=null
2018-07-20T15:29:48.0567850Z ##[debug]workItemKanbanState=null
2018-07-20T15:29:48.0591120Z ##[debug]workItemDone=false
2018-07-20T15:29:48.0614480Z ##[debug]linkBuild=false
2018-07-20T15:29:48.0640640Z ##[debug]updateAssignedTo=Always
2018-07-20T15:29:48.0666220Z ##[debug]updateAssignedToWith=Unassigned
2018-07-20T15:29:48.0693430Z ##[debug]assignedTo=null
2018-07-20T15:29:48.0719620Z ##[debug]addTags=null
2018-07-20T15:29:48.0752060Z ##[debug]removeTags=null
2018-07-20T15:29:48.0775870Z ##[debug]Release.ReleaseId=45
2018-07-20T15:29:48.0804580Z ##[debug]Release.DefinitionId=1
2018-07-20T15:29:48.0838130Z ##[debug]Release.DefinitionEnvironmentId=1
2018-07-20T15:29:48.0869020Z ##[debug]BuildId 23114
2018-07-20T15:29:48.0901840Z ##[debug]ProjectId 1e7b8740-5b44-4756-aeaf-363d1c1e4d5c
2018-07-20T15:29:48.0941280Z ##[debug]ReleaseId 45
2018-07-20T15:29:48.0979640Z ##[debug]DefinitionId 1
2018-07-20T15:29:48.1005380Z ##[debug]DefinitionEnvironmentId 1
2018-07-20T15:29:48.1029110Z ##[debug]requestedFor Ethan Frei
2018-07-20T15:29:48.1059640Z ##[debug]workitemsSource Build
2018-07-20T15:29:48.1087130Z ##[debug]workitemsSourceQuery null
2018-07-20T15:29:48.1118010Z ##[debug]allWorkItemsSinceLastRelease false
2018-07-20T15:29:48.1156570Z ##[debug]workItemType User Story
2018-07-20T15:29:48.1195490Z ##[debug]WorkItemState In QA
2018-07-20T15:29:48.1234560Z ##[debug]workItemCurrentState Active
2018-07-20T15:29:48.1272640Z ##[debug]updateWorkItemKanbanLane null
2018-07-20T15:29:48.1311040Z ##[debug]WorkItemKanbanState null
2018-07-20T15:29:48.1341260Z ##[debug]WorkItemDone false
2018-07-20T15:29:48.1365830Z ##[debug]updateAssignedTo Always
2018-07-20T15:29:48.1397720Z ##[debug]updateAssignedToWith Unassigned
2018-07-20T15:29:48.1422710Z ##[debug]assignedTo null
2018-07-20T15:29:48.1454300Z ##[debug]addTags null
2018-07-20T15:29:48.1484940Z ##[debug]removeTags null
2018-07-20T15:29:48.1523940Z ##[debug]Get WorkItemTrackingApi
2018-07-20T15:29:48.3205560Z ##[debug]Get workItemsRefs
2018-07-20T15:29:48.3219250Z Using Build as WorkItem Source
2018-07-20T15:29:48.6539410Z ##[debug]Loop workItemsRefs
2018-07-20T15:29:48.6564740Z ##[debug]Found WorkItemRef: 23469
2018-07-20T15:29:48.8942720Z Found WorkItem: 23469
2018-07-20T15:29:48.8981730Z ##[debug]Using Unassigned as assignedTo.
2018-07-20T15:29:48.9020340Z ##[debug]Updating WorkItem: 23469
2018-07-20T15:29:48.9038990Z Updating WorkItem 23469
2018-07-20T15:29:48.9069610Z ##[debug]Found KanbanLane:
2018-07-20T15:29:48.9107940Z ##[debug]Found KanbanColumn: WEF_4AC7A1647A4E440492DEDC75041AA57A_Kanban.Column
2018-07-20T15:29:48.9140030Z ##[debug]Found KanbanColumnDone: WEF_4AC7A1647A4E440492DEDC75041AA57A_Kanban.Column.Done
2018-07-20T15:29:48.9153700Z Patch: /fields/System.State In QA
2018-07-20T15:29:48.9167670Z Patch: /fields/WEF_4AC7A1647A4E440492DEDC75041AA57A_Kanban.Column.Done false
2018-07-20T15:29:48.9181260Z Patch: /fields/System.AssignedTo null
2018-07-20T15:29:48.9204940Z ##[debug]Start UpdateWorkItem
2018-07-20T15:29:49.0157080Z ##[debug]Caught an error in main: Error: Value cannot be null.
2018-07-20T15:29:49.0182080Z ##[debug]task result: Failed
2018-07-20T15:29:49.0316320Z ##[error]Error: Value cannot be null.
2018-07-20T15:29:49.0373770Z ##[debug]Processed: ##vso[task.issue type=error;]Error: Value cannot be null.
2018-07-20T15:29:49.0430990Z ##[debug]Processed: ##vso[task.complete result=Failed;]Error: Value cannot be null.
2018-07-20T15:29:49.1811240Z ##[section]Finishing: Move Related Work Items to In QA
I set up the workitemupdater task on a release pipeline and checked the "Bypass rules" checkbox on the task. but i get the following error.
I am not sure which user the error message is referring to. Is it the user that triggered the release or the agent that's performing the deployment.
Please note that we have policies setup on workitems.
@BlueBasher thanks for the extension, very helpful.
Do you have any plans to switch to the latest npm packages from MS?
https://www.npmjs.com/package/vso-node-api
https://www.npmjs.com/package/vsts-task-lib
These 2 have been replaced by:
https://www.npmjs.com/package/azure-devops-node-api
https://www.npmjs.com/package/azure-pipelines-task-lib
Hello after the update 2.5.801 originating from Azure DevOps the bypass rules does not work anymore. Now the WorkitemUpdater is not able to update tickets for me. Is it possible something in this update created a bug?
We use this in production and would like to fix it as soon as possible.
I have run into another variant of the StackOverFlow Exception as a result of the call to "UpdateWorkItemAsync".
After doing some digging and debugging I managed to find that the problem was caused by you always setting the "Done" field of the Kanban column to either true/false based on the checkbox. I have the work item in an "In Progress" column and wanted it to automatically move into the next "Pull Request" column and neither of these are split columns.
I suggest that you wrap the setting of the "Done" field with a check to see if the checkbox is true and only perform the change in this instance.
I was trying to use this task into release (and build) pipeline as a step but I cannot choose anything from WorkItem Type drop-down.
Even with the new 1.3.6 version released, I still receive an error on certain cases.
******************************************************************************
Starting: WorkItem Updater
******************************************************************************
==============================================================================
Task : WorkItem Updater
Description : This task allows to update WorkItems linked to the build.
Version : 1.3.6
Author : Blue Basher
Help :
==============================================================================
VstsTaskSdk 0.8.1 commit
Importing function 'Assert-Path'.
Importing function 'Find-Files'.
Importing function 'Find-Match'.
Importing function 'Get-AssemblyReference'.
Importing function 'Get-Endpoint'.
Importing function 'Get-Input'.
Importing function 'Get-LocString'.
Importing function 'Get-TaskVariable'.
Importing function 'Get-TaskVariableInfo'.
Importing function 'Get-TfsClientCredentials'.
Importing function 'Get-TfsService'.
Importing function 'Get-VssCredentials'.
Importing function 'Get-VssHttpClient'.
Importing function 'Import-LocStrings'.
Importing function 'Invoke-Tool'.
Importing function 'New-FindOptions'.
Importing function 'New-MatchOptions'.
Importing function 'Out-Default'.
Importing function 'Select-Match'.
Importing function 'Set-TaskVariable'.
Importing function 'Trace-EnteringInvocation'.
Importing function 'Trace-LeavingInvocation'.
Importing function 'Trace-Path'.
Importing function 'Write-AddAttachment'.
Importing function 'Write-AddBuildTag'.
Importing function 'Write-AssociateArtifact'.
Importing function 'Write-LogDetail'.
Importing function 'Write-SetProgress'.
Importing function 'Write-SetResult'.
Importing function 'Write-SetSecret'.
Importing function 'Write-SetVariable'.
Importing function 'Write-TaskDebug'.
Importing function 'Write-TaskError'.
Importing function 'Write-TaskVerbose'.
Importing function 'Write-TaskWarning'.
Importing function 'Write-UpdateBuildNumber'.
Importing function 'Write-UploadArtifact'.
Importing function 'Write-UploadBuildLog'.
Entering D:\TfsData\Build\_work\_tasks\WorkItemUpdater_7164116a-ed17-48be-9c53-b440b2b1dd2e\1.3.6\task.ps1.
BUILD_BUILDID: '48676'
SYSTEM_TEAMPROJECTID: 'fb077072-07fd-4ba0-bd11-2753fc89f3af'
BUILD_REQUESTEDFOR: '[redacted]'
INPUT_WORKITEMTYPE: 'Product Backlog Item'
INPUT_WORKITEMSTATE: 'Done'
INPUT_WORKITEMKANBANSTATE (empty)
INPUT_WORKITEMDONE: 'false'
Converted to bool: False
INPUT_LINKBUILD: 'true'
Converted to bool: True
INPUT_UPDATEASSIGNEDTO: 'Never'
BuildId 48676
ProjectId fb077072-07fd-4ba0-bd11-2753fc89f3af
requestedFor [redacted]
workItemType Product Backlog Item
WorkItemState Done
WorkItemKanbanState
WorkItemDone False
updateAssignedTo Never
Converting buildId '48676' as int
Converting projectId 'fb077072-07fd-4ba0-bd11-2753fc89f3af' as GUID
Entering Get-VssHttpClient.
TypeName: 'Microsoft.TeamFoundation.WorkItemTracking.WebApi.WorkItemTrackingHttpClient'
SYSTEM_TEAMFOUNDATIONCOLLECTIONURI: 'http://[redacted]:8080/tfs/DefaultCollection/'
Entering Get-VssCredentials.
OMDirectory: ''
ENDPOINT_URL_SystemVssConnection: 'http://[redacted]:8080/tfs/DefaultCollection/'
ENDPOINT_AUTH_SystemVssConnection: '********'
ENDPOINT_DATA_SystemVssConnection (empty)
Entering Get-OMType.
TypeName: 'Microsoft.VisualStudio.Services.OAuth.VssOAuthAccessTokenCredential'
OMKind: 'WebApi'
OMDirectory: ''
Defaulted OM directory to: 'D:\TfsData\Build\_work\_tasks\WorkItemUpdater_7164116a-ed17-48be-9c53-b440b2b1dd2e\1.3.6'
Testing whether type can be loaded: 'Microsoft.VisualStudio.Services.OAuth.VssOAuthAccessTokenCredential'
The type was not loaded.
Testing leaf path: 'D:\TfsData\Build\_work\_tasks\WorkItemUpdater_7164116a-ed17-48be-9c53-b440b2b1dd2e\1.3.6\Microsoft.VisualStudio.Services.OAuth.WebApi.dll'
Not found.
Testing leaf path: 'D:\TfsData\Build\_work\_tasks\WorkItemUpdater_7164116a-ed17-48be-9c53-b440b2b1dd2e\1.3.6\Microsoft.VisualStudio.Services.OAuth.dll'
Not found.
Testing leaf path: 'D:\TfsData\Build\_work\_tasks\WorkItemUpdater_7164116a-ed17-48be-9c53-b440b2b1dd2e\1.3.6\Microsoft.VisualStudio.Services.WebApi.dll'
Loading assembly: D:\TfsData\Build\_work\_tasks\WorkItemUpdater_7164116a-ed17-48be-9c53-b440b2b1dd2e\1.3.6\Microsoft.VisualStudio.Services.WebApi.dll
Resolving 'Newtonsoft.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed'
Resolving 'System.Net.Http.Formatting, Version=5.2.2.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'
Testing whether type can be loaded: 'Microsoft.VisualStudio.Services.OAuth.VssOAuthAccessTokenCredential'
The type was not loaded.
Testing leaf path: 'D:\TfsData\Build\_work\_tasks\WorkItemUpdater_7164116a-ed17-48be-9c53-b440b2b1dd2e\1.3.6\Microsoft.VisualStudio.Services.dll'
Not found.
Leaving Get-OMType.
Entering Get-OMType.
TypeName: 'Microsoft.VisualStudio.Services.Client.VssOAuthCredential'
OMKind: 'WebApi'
OMDirectory: ''
Require: 'True'
Defaulted OM directory to: 'D:\TfsData\Build\_work\_tasks\WorkItemUpdater_7164116a-ed17-48be-9c53-b440b2b1dd2e\1.3.6'
Testing whether type can be loaded: 'Microsoft.VisualStudio.Services.Client.VssOAuthCredential'
The type was not loaded.
Testing leaf path: 'D:\TfsData\Build\_work\_tasks\WorkItemUpdater_7164116a-ed17-48be-9c53-b440b2b1dd2e\1.3.6\Microsoft.VisualStudio.Services.Client.WebApi.dll'
Not found.
Testing leaf path: 'D:\TfsData\Build\_work\_tasks\WorkItemUpdater_7164116a-ed17-48be-9c53-b440b2b1dd2e\1.3.6\Microsoft.VisualStudio.Services.Client.dll'
Loading assembly: D:\TfsData\Build\_work\_tasks\WorkItemUpdater_7164116a-ed17-48be-9c53-b440b2b1dd2e\1.3.6\Microsoft.VisualStudio.Services.Client.dll
System.Reflection.ReflectionTypeLoadException: Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information.
LoaderExceptions[0]: System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.IdentityModel.Clients.ActiveDirectory, Version=2.16.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.
LoaderExceptions[1]: System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.ServiceBus, Version=2.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.
LoaderExceptions[2]: System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.IdentityModel.Clients.ActiveDirectory, Version=2.16.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.
LoaderExceptions[3]: System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.IdentityModel.Clients.ActiveDirectory, Version=2.16.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.
LoaderExceptions[4]: System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.IdentityModel.Clients.ActiveDirectory, Version=2.16.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.
LoaderExceptions[5]: System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.IdentityModel.Clients.ActiveDirectory, Version=2.16.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.
LoaderExceptions[6]: System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.IdentityModel.Clients.ActiveDirectory, Version=2.16.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.
LoaderExceptions[7]: System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.IdentityModel.Clients.ActiveDirectory, Version=2.16.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.
Testing whether type can be loaded: 'Microsoft.VisualStudio.Services.Client.VssOAuthCredential'
The type was loaded successfully.
Leaving Get-OMType.
Leaving Get-VssCredentials.
Entering Get-OMType.
TypeName: 'Microsoft.TeamFoundation.WorkItemTracking.WebApi.WorkItemTrackingHttpClient'
OMKind: 'WebApi'
OMDirectory: ''
Require: 'True'
Defaulted OM directory to: 'D:\TfsData\Build\_work\_tasks\WorkItemUpdater_7164116a-ed17-48be-9c53-b440b2b1dd2e\1.3.6'
Testing whether type can be loaded: 'Microsoft.TeamFoundation.WorkItemTracking.WebApi.WorkItemTrackingHttpClient'
The type was not loaded.
Testing leaf path: 'D:\TfsData\Build\_work\_tasks\WorkItemUpdater_7164116a-ed17-48be-9c53-b440b2b1dd2e\1.3.6\Microsoft.TeamFoundation.WorkItemTracking.WebApi.WebApi.dll'
Not found.
Testing leaf path: 'D:\TfsData\Build\_work\_tasks\WorkItemUpdater_7164116a-ed17-48be-9c53-b440b2b1dd2e\1.3.6\Microsoft.TeamFoundation.WorkItemTracking.WebApi.dll'
Loading assembly: D:\TfsData\Build\_work\_tasks\WorkItemUpdater_7164116a-ed17-48be-9c53-b440b2b1dd2e\1.3.6\Microsoft.TeamFoundation.WorkItemTracking.WebApi.dll
Testing whether type can be loaded: 'Microsoft.TeamFoundation.WorkItemTracking.WebApi.WorkItemTrackingHttpClient'
The type was loaded successfully.
Leaving Get-OMType.
Constructing HTTP client.
Leaving Get-VssHttpClient.
Entering Get-VssHttpClient.
TypeName: 'Microsoft.TeamFoundation.Build.WebApi.BuildHttpClient'
SYSTEM_TEAMFOUNDATIONCOLLECTIONURI: 'http://[redacted]:8080/tfs/DefaultCollection/'
Entering Get-VssCredentials.
OMDirectory: ''
ENDPOINT_URL_SystemVssConnection: 'http://[redacted]:8080/tfs/DefaultCollection/'
ENDPOINT_AUTH_SystemVssConnection: '********'
ENDPOINT_DATA_SystemVssConnection (empty)
Entering Get-OMType.
TypeName: 'Microsoft.VisualStudio.Services.OAuth.VssOAuthAccessTokenCredential'
OMKind: 'WebApi'
OMDirectory: ''
Defaulted OM directory to: 'D:\TfsData\Build\_work\_tasks\WorkItemUpdater_7164116a-ed17-48be-9c53-b440b2b1dd2e\1.3.6'
Testing whether type can be loaded: 'Microsoft.VisualStudio.Services.OAuth.VssOAuthAccessTokenCredential'
The type was not loaded.
Testing leaf path: 'D:\TfsData\Build\_work\_tasks\WorkItemUpdater_7164116a-ed17-48be-9c53-b440b2b1dd2e\1.3.6\Microsoft.VisualStudio.Services.OAuth.WebApi.dll'
Not found.
Testing leaf path: 'D:\TfsData\Build\_work\_tasks\WorkItemUpdater_7164116a-ed17-48be-9c53-b440b2b1dd2e\1.3.6\Microsoft.VisualStudio.Services.OAuth.dll'
Not found.
Testing leaf path: 'D:\TfsData\Build\_work\_tasks\WorkItemUpdater_7164116a-ed17-48be-9c53-b440b2b1dd2e\1.3.6\Microsoft.VisualStudio.Services.WebApi.dll'
Loading assembly: D:\TfsData\Build\_work\_tasks\WorkItemUpdater_7164116a-ed17-48be-9c53-b440b2b1dd2e\1.3.6\Microsoft.VisualStudio.Services.WebApi.dll
Testing whether type can be loaded: 'Microsoft.VisualStudio.Services.OAuth.VssOAuthAccessTokenCredential'
The type was not loaded.
Testing leaf path: 'D:\TfsData\Build\_work\_tasks\WorkItemUpdater_7164116a-ed17-48be-9c53-b440b2b1dd2e\1.3.6\Microsoft.VisualStudio.Services.dll'
Not found.
Leaving Get-OMType.
Entering Get-OMType.
TypeName: 'Microsoft.VisualStudio.Services.Client.VssOAuthCredential'
OMKind: 'WebApi'
OMDirectory: ''
Require: 'True'
Defaulted OM directory to: 'D:\TfsData\Build\_work\_tasks\WorkItemUpdater_7164116a-ed17-48be-9c53-b440b2b1dd2e\1.3.6'
Testing whether type can be loaded: 'Microsoft.VisualStudio.Services.Client.VssOAuthCredential'
The type was loaded successfully.
Leaving Get-OMType.
Leaving Get-VssCredentials.
Entering Get-OMType.
TypeName: 'Microsoft.TeamFoundation.Build.WebApi.BuildHttpClient'
OMKind: 'WebApi'
OMDirectory: ''
Require: 'True'
Defaulted OM directory to: 'D:\TfsData\Build\_work\_tasks\WorkItemUpdater_7164116a-ed17-48be-9c53-b440b2b1dd2e\1.3.6'
Testing whether type can be loaded: 'Microsoft.TeamFoundation.Build.WebApi.BuildHttpClient'
The type was not loaded.
Testing leaf path: 'D:\TfsData\Build\_work\_tasks\WorkItemUpdater_7164116a-ed17-48be-9c53-b440b2b1dd2e\1.3.6\Microsoft.TeamFoundation.Build.WebApi.WebApi.dll'
Not found.
Testing leaf path: 'D:\TfsData\Build\_work\_tasks\WorkItemUpdater_7164116a-ed17-48be-9c53-b440b2b1dd2e\1.3.6\Microsoft.TeamFoundation.Build.WebApi.dll'
Loading assembly: D:\TfsData\Build\_work\_tasks\WorkItemUpdater_7164116a-ed17-48be-9c53-b440b2b1dd2e\1.3.6\Microsoft.TeamFoundation.Build.WebApi.dll
Testing whether type can be loaded: 'Microsoft.TeamFoundation.Build.WebApi.BuildHttpClient'
The type was loaded successfully.
Leaving Get-OMType.
Constructing HTTP client.
Leaving Get-VssHttpClient.
GetBuildWorkItemsRefsAsync fb077072-07fd-4ba0-bd11-2753fc89f3af 48676
Loop workItemsRefs
Found WorkItemRef: 8052
Found WorkItem: 8052
Updating WorkItem 8052
Found KanbanColumn: WEF_04BD74D7381647D09952B444339E0E95_Kanban.Column
Patch: /fields/System.State Done
Patch: /fields/WEF_04BD74D7381647D09952B444339E0E95_Kanban.Column.Done False
Linking Build 48676 to WorkItem 8052
Patch: /relations/- vstfs:///Build/Build/48676
WorkItem 8052 updated to Done False
Found WorkItemRef: 8050
Found WorkItem: 8050
Updating WorkItem 8050
Found KanbanColumn: WEF_04BD74D7381647D09952B444339E0E95_Kanban.Column
Patch: /fields/System.State Done
Patch: /fields/WEF_04BD74D7381647D09952B444339E0E95_Kanban.Column.Done False
Linking Build 48676 to WorkItem 8050
Patch: /relations/- vstfs:///Build/Build/48676
WorkItem 8050 updated to Done False
Found WorkItemRef: 8038
Found WorkItem: 8038
Updating WorkItem 8038
Found KanbanColumn: WEF_04BD74D7381647D09952B444339E0E95_Kanban.Column
Patch: /fields/System.State Done
Patch: /fields/WEF_04BD74D7381647D09952B444339E0E95_Kanban.Column.Done False
Linking Build 48676 to WorkItem 8038
Patch: /relations/- vstfs:///Build/Build/48676
Process is terminated due to StackOverflowException.
Exit code 255 returned from process: file name 'C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe', arguments '-NoLogo -Sta -NoProfile -NonInteractive -ExecutionPolicy Unrestricted -Command ". ([scriptblock]::Create('if (!$PSHOME) { $null = Get-Item -LiteralPath ''variable:PSHOME'' } else { Import-Module -Name ([System.IO.Path]::Combine($PSHOME, ''Modules\Microsoft.PowerShell.Management\Microsoft.PowerShell.Management.psd1'')) ; Import-Module -Name ([System.IO.Path]::Combine($PSHOME, ''Modules\Microsoft.PowerShell.Utility\Microsoft.PowerShell.Utility.psd1'')) }')) 2>&1 | ForEach-Object { Write-Verbose $_.Exception.Message -Verbose } ; Import-Module -Name 'D:\TfsData\Build\_work\_tasks\WorkItemUpdater_7164116a-ed17-48be-9c53-b440b2b1dd2e\1.3.6\ps_modules\VstsTaskSdk\VstsTaskSdk.psd1' -ArgumentList @{ NonInteractive = $true } -ErrorAction Stop ; $VerbosePreference = 'Continue' ; $DebugPreference = 'Continue' ; Invoke-VstsTaskScript -ScriptBlock ([scriptblock]::Create('. ''D:\TfsData\Build\_work...
Add the ability to assign to a specific user rather than just the requester of the build
Can you update the "Assign To" box to be a user selector instead of a free form text box?
Hi Blue,
I've used the WorkItemUpdater and it works perfectly. But I have a situation and a question.
I just want to update only workitems related to Pull Request which I'm currently merging. If i use workitemsSource: 'Build'
all unrelated work items updating because of our mono repo approach. For example the workitems related to frontend shown in backend pipeline.
Is there any way to deal with this problem? For example can I use workitemsSource: 'Query'
and get the correct work items only related with active PR, or third workitemsSource
can be implemented?
I need your comments.
Thanks.
Hi,
I'm using the WorkItemUpdater as part of a TaskGroup for a Build Definition.
I am getting the following error:
2017-06-09T06:27:46.2874550Z ##[section]Starting: WorkItem Updater
2017-06-09T06:27:53.7082768Z Updating WorkItem 29040
2017-06-09T06:27:54.0871103Z
2017-06-09T06:27:54.0871103Z Process is terminated due to StackOverflowException.
2017-06-09T06:27:55.0158810Z ##[error]Exit code 255 returned from process: file name 'C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe', arguments '-NoLogo -Sta -NoProfile -NonInteractive -ExecutionPolicy Unrestricted -Command ". ([scriptblock]::Create('if (!$PSHOME) { $null = Get-Item -LiteralPath ''variable:PSHOME'' } else { Import-Module -Name ([System.IO.Path]::Combine($PSHOME, ''Modules\Microsoft.PowerShell.Management\Microsoft.PowerShell.Management.psd1'')) ; Import-Module -Name ([System.IO.Path]::Combine($PSHOME, ''Modules\Microsoft.PowerShell.Utility\Microsoft.PowerShell.Utility.psd1'')) }')) 2>&1 | ForEach-Object { Write-Verbose $_.Exception.Message -Verbose } ; Import-Module -Name 'E:\agent_work_tasks\WorkItemUpdater_7164116a-ed17-48be-9c53-b440b2b1dd2e\1.3.0\ps_modules\VstsTaskSdk\VstsTaskSdk.psd1' -ArgumentList @{ NonInteractive = $true } -ErrorAction Stop ; $VerbosePreference = 'SilentlyContinue' ; $DebugPreference = 'SilentlyContinue' ; Invoke-VstsTaskScript -ScriptBlock ([scriptblock]::Create('. ''E:\agent_work_tasks\WorkItemUpdater_7164116a-ed17-48be-9c53-b440b2b1dd2e\1.3.0\task.ps1'''))"'.
2017-06-09T06:27:55.0203460Z ##[section]Finishing: WorkItem Updater
Is there anything I can do to troubleshoot this?
Hello,
Is it possible to add the possibility to update a specific field of a Work Item?
I would like to update the fields in the "Details" group.
Attached the log taken after setting system.debug as true.
tasklog_8.log
I am using TFS 2017 On-Prem. Let me know if you need more details. Below is the screenshot for the WorkItemUpdater task;
Thanks in advance.
Probably fails on line 246
const buildRelation = workItem.relations.find(r => r.url === buildRelationUrl);
2018-12-30T08:36:28.8058680Z ##[section]Starting: Move Deployment To Testing 2018-12-30T08:36:28.8063365Z ============================================================================== 2018-12-30T08:36:28.8063424Z Task : WorkItem Updater 2018-12-30T08:36:28.8063456Z Description : This task adds functionality to update WorkItems during a Build or Release. 2018-12-30T08:36:28.8063500Z Version : 2.4.787 2018-12-30T08:36:28.8063533Z Author : Blue Basher 2018-12-30T08:36:28.8063564Z Help : 2018-12-30T08:36:28.8063593Z ============================================================================== 2018-12-30T08:36:29.3097685Z Using Query as WorkItem Source 2018-12-30T08:36:29.4245167Z Found WorkItem: 10363 2018-12-30T08:36:29.4253319Z Updating WorkItem 10363 2018-12-30T08:36:29.4258676Z Patch: /fields/System.State Committed 2018-12-30T08:36:29.4261794Z Patch: /fields/WEF_C4E1D8A3D20C415FB193FC32EA2585CF_Kanban.Column Testing 2018-12-30T08:36:29.4261861Z Patch: /fields/WEF_C4E1D8A3D20C415FB193FC32EA2585CF_Kanban.Column.Done false 2018-12-30T08:36:29.4344752Z ##[error]TypeError: Cannot read property 'find' of undefined 2018-12-30T08:36:29.4362174Z ##[section]Finishing: Move Deployment To Testing
Hello,
I'm trying to keep track of where all of our tasks are in our DTAP street. With Work Item Updater I'm able to achieve this.
One addition i want to make is I want to count how many times there has been a build on the Development street. This to track several commits or pull request that has been checked in. By placing a value in it with the "Fields to update" I'm able to do this. Only problem the fields to update replaces the value. And does not offer a count.
If I would be able to do something like:
Custom.Countfield, Custom.Countfield + 1
The default value is always set to 0. So a calculation could be a possibility.
Is it possible to add this as a feature in the near future?
I have set up a release in VSTS and at the end of the workflow I am trying to use WorkItemUpdater to move work items from one state to another. For some reason, I am getting an exception when running that task.
I have attached the log file and a screenshot of my task settings. Please let me know if I am doing something wrong in my setup or how I can get this to work.
Thank You
I have tried in both the Build and Release functionality to update a defect work item state. I am using TFS 2017 On Prem. There are no mandatory fields required in the workflow to transition to this state. I get the error below, even though the State shows up in the list to be chosen. It is also a valid state from Resolved (current state).
##[error]Error: The field 'State' contains the value 'Deployed To Test' that is not in the list of supported values
We have implemented new state for task called "waiting for deployment". It would be nice to use this extension to update all those tasks into "Waiting for testing" state, which is also custom state.
When updating a bug, we can currently specify that the user can be updated to the requester of the build. Can this be extended to update the assign user t be the person who created the bug? This would reflect the behavior of the scrum task board.
When the project workflow process is set to Scrum, the task does not appear in the tasklist to be added for both build and release. It only shows up for Agile process.
When running a CI build using the Agile Template the task throws a NullReferenceException when attempting to link the build to the task.
The CI task is only configured with item type = task and Add Build As Development Link checked. All other options are left as default.
Starting: Link Build to Tasks
Updating WorkItem 47088
You cannot call a method on a null-valued expression.
at System.Management.Automation.ExceptionHandlingOps.CheckActionPreference(FunctionContext funcContext, Exception exception)
at System.Management.Automation.Interpreter.ActionCallInstruction2.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.PSScriptCmdlet.RunClause(Action
1 clause, Object dollarUnderbar, Object inputToProcess)
at System.Management.Automation.PSScriptCmdlet.DoEndProcessing()
at System.Management.Automation.CommandProcessorBase.Complete()
Cannot validate argument on parameter 'Result'. The argument "Error updating workitems" does not belong to the set "Succeeded,SucceededWithIssues,Failed,Cancelled,Skipped" specified by the ValidateSet attribute. Supply an argument that is in the set and then try the command again.
Greetings!
I'm using WorkItem Updater in a Build to change the State of a custom Work Item type and I would also like it to create the link from the Build to the Work Item.
I'm using a Query as the source and changing the State is working as expected. But the Build Link is never created. The Work Items do not currently have any visible links (Parent, Related Work Items, Development, etc) prior to running the build.
I'm seeing this in the build output:
Using Query as WorkItem Source
##[debug]Found queryId 0def1c63-1ba0-4b8d-8c79-bd848f76ebcb from QueryName Shared Queries/AssetChanges_AssetsTransferred
##[debug]Loop workItemsRefs
##[debug]Found WorkItemRef: 14606
Found WorkItem: 14606
##[debug]Setting assignedTo to requester for build "Mark Johnston".
##[debug]Updating WorkItem: 14606
Updating WorkItem 14606
##[debug]Found KanbanLane:
##[debug]Found KanbanColumn:
##[debug]Found KanbanColumnDone:
Patch: /fields/System.State Closed
Build 5863 already linked to WorkItem 14606
I see the last line showing that the Build is already linked to the Work Item. It looks like the test for buildRelation
is returning true:
(Apologies - I haven't taken time to set up a development environment to be able to debug this and propose a solution myself.)
Any ideas? Can I provide any additional information to help track this down?
Thanks for taking the time and effort to share such a useful utility with the community!!
-Mark
It would be nice to update multiple types instead of a task for each type.
Enhance this to have a check to only allow certain work item current states to be updated.
Actually, work items number looks stuck to max 50
Could you add a setting to override this default limit please ?
Thanks !
Hi, any docs on how to configure this plugin,
i would like it so that when a PR is completed that a work item state is updated to "Testing" is this possible?
Thanks
Corbin
Hi
Change this Field "/fields/$($_)" not change the kanban board column and generate a UpdateWorkItemAsync error.
if ($workItemKanbanState -ne "" -and $kanbanColumn -ne "" -and $kanbanColumn -ne $null) {
$kanbanColumn.Split(" ") | ForEach-Object {
$columnDoneOperation = New-Object Microsoft.VisualStudio.Services.WebApi.Patch.Json.JsonPatchOperation
$columnDoneOperation.Operation = [Microsoft.VisualStudio.Services.WebApi.Patch.Operation]::Add
$columnDoneOperation.Path = "/fields/$($_)"
$columnDoneOperation.Value = $workItemKanbanState
$patch.Add($columnDoneOperation)
Write-VstsTaskDebug -Message "Patch: $($columnDoneOperation.Path) $($columnDoneOperation.Value)"
}
}
Thanks
I am using the task to update the work item state from QA to UAT and it fails. The below is my snapshot YAML .
task: BlueBasher.bluebasher-workitemupdater.bluebasher-workitemupdater.WorkItemUpdater@2
displayName: 'Update work items to UAT'
inputs:
workItemType: 'Bug,Product Backlog Item'
allWorkItemsSinceLastRelease: true
workItemState: UAT
workItemCurrentState: QA
workItemKanbanState: Doing
updateAssignedTo: Always
Please let me know what all changes do I need to make to fix this issue.
Thanks for your help in advance.
We use tags to indicate a work item is ready to be deployed. Could you add a filter by tag to the work item updater? Only work items with this tag would be updated.
Updated to the new version and still getting an error, I am trying to move the item from the "In Progress" column to the "Pull Request" column
2017-11-30T11:36:29.5461196Z
2017-11-30T11:36:29.5461196Z Process is terminated due to StackOverflowException.
2017-11-30T11:36:56.7811300Z ##[error]Exit code -1073741571 returned from process: file name 'C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe', arguments '-NoLogo -Sta -NoProfile -NonInteractive -ExecutionPolicy Unrestricted -Command ". ([scriptblock]::Create('if (!$PSHOME) { $null = Get-Item -LiteralPath ''variable:PSHOME'' } else { Import-Module -Name ([System.IO.Path]::Combine($PSHOME, ''Modules\Microsoft.PowerShell.Management\Microsoft.PowerShell.Management.psd1'')) ; Import-Module -Name ([System.IO.Path]::Combine($PSHOME, ''Modules\Microsoft.PowerShell.Utility\Microsoft.PowerShell.Utility.psd1'')) }')) 2>&1 | ForEach-Object { Write-Verbose $_.Exception.Message -Verbose } ; Import-Module -Name 'd:\a_tasks\WorkItemUpdater_7164116a-ed17-48be-9c53-b440b2b1dd2e\1.4.716\ps_modules\VstsTaskSdk\VstsTaskSdk.psd1' -ArgumentList @{ NonInteractive = $true } -ErrorAction Stop ; $VerbosePreference = 'Continue' ; $DebugPreference = 'Continue' ; Invoke-VstsTaskScript -ScriptBlock ([scriptblock]::Create('. ''d:\a_tasks\WorkItemUpdater_7164116a-ed17-48be-9c53-b440b2b1dd2e\1.4.716\task.ps1'''))"'.
Hi,
I am trying your task item on VSTS to update user story but I can't attach the build to a user story, in Work Item type window I can only choose the type of the user story but I can't choose which user story to link to, can you help set up this build task on VSTS to update the progress of the build definition to be reflected on the user story ?
During a release, work items are not being changed from Commited to Done. I'm using TFS 2017. If I go in and manually change the workitem to Done it works fine (so it doesn't seem like I'm missing a required field or something.
Here is the information for the WorkItemUpdater task log:
2018-01-03T14:10:38.4523367Z ##[section]Starting: WorkItem Updater
2018-01-03T14:10:38.4835899Z ==============================================================================
2018-01-03T14:10:38.4835899Z Task : WorkItem Updater
2018-01-03T14:10:38.4835899Z Description : This task allows to update WorkItems linked to the build.
2018-01-03T14:10:38.4835899Z Version : 1.5.721
2018-01-03T14:10:38.4835899Z Author : Blue Basher
2018-01-03T14:10:38.4835899Z Help :
2018-01-03T14:10:38.4835899Z ==============================================================================
2018-01-03T14:10:47.4367361Z Add-Type Services.WebApi
2018-01-03T14:10:47.4681413Z Resolving 'E:\Visual Studio Agent_work_tasks\WorkItemUpdater_7164116a-ed17-48be-9c53-b440b2b1dd2e\1.5.721\Newtonsoft.Json.dll'
2018-01-03T14:10:47.4681413Z Resolved 'Newtonsoft.Json, Version=8.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed'
2018-01-03T14:10:47.4681413Z Resolving 'E:\Visual Studio Agent_work_tasks\WorkItemUpdater_7164116a-ed17-48be-9c53-b440b2b1dd2e\1.5.721\System.Net.Http.Formatting.dll'
2018-01-03T14:10:47.4681413Z Resolved 'System.Net.Http.Formatting, Version=5.2.2.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'
2018-01-03T14:10:47.5148599Z Add-Type WorkItemTracking.WebApi
2018-01-03T14:10:47.6242368Z Added Types
2018-01-03T14:10:47.7492385Z Resolving 'E:\Visual Studio Agent_work_tasks\WorkItemUpdater_7164116a-ed17-48be-9c53-b440b2b1dd2e\1.5.721\Newtonsoft.Json.dll'
2018-01-03T14:10:47.7648660Z Resolved 'Newtonsoft.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed'
2018-01-03T14:10:48.9523711Z Updating WorkItem 2428
2018-01-03T14:10:48.9523711Z WorkItem 2428 updated to Done False
2018-01-03T14:10:48.9523711Z System.Threading.Tasks.Task1[Microsoft.TeamFoundation.WorkItemTracking.WebApi.Models.WorkItem] 2018-01-03T14:10:49.0148640Z Updating WorkItem 2428 2018-01-03T14:10:49.0148640Z WorkItem 2428 updated to Done False 2018-01-03T14:10:49.0148640Z System.Threading.Tasks.Task
1[Microsoft.TeamFoundation.WorkItemTracking.WebApi.Models.WorkItem]
2018-01-03T14:10:49.0461167Z ##[section]Finishing: WorkItem Updater
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.