Giter VIP home page Giter VIP logo

azure-devops-workitem-clone's Introduction

Azure-DevOps-WorkItem-Clone

Azure DevOps WorkItem Clone

The purpose of this tool is to clone work items from a template project to a target project. The tool uses a JSON configuration file which it combines with a template in Azure DevOps to specify what work items to create and how to update them.

Installation

Download the latest release from the releases page, unzip, and run WorkItemClone.exe with the appropriate parameters.

Commands

clone

Clones work items from a template project to a target project incorproating a JSON configuration file specificyng what work items to create and how to update them.

Parameters

General Parameters - These are general parameters that control the behaviour of the clone process.

  • --config - The path to the configuration file. Default is .\configuration.json. This can be used to had code paramiters... Command line params overrides the configuration file.
  • --CachePath - Folder used to cache data like the template. Default is .\cache.
  • --inputJsonFile - The path to the JSON file that instructs the creation of the work items
  • --runname - The name of the run. Default is the current DateTime. Use this to rerun a creation that failed or was interupted.

Template Parameters - The template contains the Descrition, Acceptance Criteria and relationship to other work itsm that we will clone.

  • --templateAccessToken - The access token for the template instance.
  • --templaterganization - The name of the organisation to clone work items to.
  • --templateProject - The name of the prject to clone work items from.

Target Parameters - The target environemnt is where we will clone the work items to.

  • --targetAccessToken - The access token for the target project.
  • --targetOrganization - The name of the organisation to clone work items to.
  • --targetProject - The name of the prject to clone work items to.
  • --targetParentId - All cloned work items will be come a child of this work item

Target Query - The target query is used to create a query in the target project to show the cloned work items.

  • --targetQuery - The query to create in the target project. Default is SELECT [System.Id], [System.WorkItemType], [System.Title], [System.AreaPath],[System.AssignedTo],[System.State] FROM workitems WHERE [System.Parent] = @projectID.
  • --targetQueryTitle - The title of the query to create in the target project. Default is Project-@RunName - @projectTitle.
  • --targetQueryFolder - The folder to create the query in the target project. Default is Shared Queries.

You can use the following parameters:

  • @projectID - The ID of the target parent item
  • @projectTitle - The title of the parent item
  • @projectTags - the tags of the item
  • @RunName - The name of the run

Optional Parameters - These are optional parameters that can be used to control the behaviour of the clone process.

  • --NonInteractive - Disables interactive mode. Default is false.
  • --ClearCache - Clears the cache. Default is false.

Typical usage:

clone --inputJsonFile ..\\..\\..\\..\\TestData\\ADO_TESTProjPipline_V03.json --targetParentId 540 --templateAccessToken tqvemdfaucsriu6e3uti7dya --targetAccessToken ay5xc2kn5i3xcsmw5fu65ja 

Runs

The consept of runs is to allow users to restart a failed or interupted run. The run name is used to identify the run and the cache is used to store the state of the run.

The example below will create a subfolder to the cache called Bob where it will store the state of the run. If the run fails or is interupted you can restart the run by using the same run name. Rerunning the same run will not create duplicate work items and will not rebuild the output file that is generated in steps 4 and 5. It will reuse the existing one. If you need to change the input file then you will need to create a new run.

When using the --runname parameter the --inputJsonFile will not be used if a cache exists for the run. The input file will be read from the cache.

Typical usage:

 clone --runname Bob --inputJsonFile ..\\..\\..\\..\\TestData\\ADO_TESTProjPipline_V03.json --targetParentId 540 --templateAccessToken tqvemdfaucsriu6e3uti7dya --targetAccessToken ay5xc2kn5i3xcsmw5fu65ja 

init

Leads you through the process of creating a configuration file.

Parameters

General Parameters - These are general parameters that control the behaviour of the clone process.

  • --config - The path to the configuration file. Default is .\configuration.json. This can be used to had code paramiters... Command line params overrides the configuration file.

Typical usage:

init --config configuration.json

Configuration Example

{
 "CachePath": "./cache",
 "inputJsonFile": "TESTProjPipline_V03.json",
 "targetAccessToken": "************************************",
 "targetOrganization": "nkdagility-preview",
 "targetProject": "Clone-Demo",
 "targetParentId": 540,
 "templateAccessToken": "************************************",
 "templateOrganization": "orgname",
 "templateProject": "template Project",
 "templateParentId": 212315,
 "targetQuery": "SELECT [Custom.Product], [System.Title], [System.Description], [Custom.DeadlineDate], [System.AreaPath], [System.AssignedTo], [System.State], [Custom.Notes], [System.WorkItemType], [Custom.TRA_Milestone] FROM WorkItemLinks WHERE (Source.[System.Id] = @projectID or Source.[System.Parent] = @projectID) and ([System.Links.LinkType] = 'System.LinkTypes.Hierarchy-Forward') and (Target.[System.Parent] = @projectID) ORDER BY [Custom.DeadlineDate] mode(Recursive)",
 "targetQueryTitle": "Project-@RunName - @projectTitle",
 "targetQueryFolder": "Shared Queries"
}

Control File (--inputFile)

The control file consists of a list of work items that you want to create. Each work item has an id and a list of fields.

  • id - The id is the optional ID of a template item. If there is an ID, and there is a template item, then the tool will load that template and allow you to select values from it to add to the work item that you create. This template item will also be used to load relationships to other work items and if both ends of the relationship are part of the control file it will wire them up as expected. Not specifying an D wil result in a new work item based only on the control file.
  • fields - These fields are the fields that will be used to create the work item. You can use any field Refname from the target Azure DevOps work item.

example:

[
 {
   "id": 213928,
   "fields": {
     "System.AreaPath": "Engineering Group\\ECH Group\\ECH TPL 1",
     "System.Tags": "Customer Document",
     "System.Title": "Technical specification",
     "Custom.Product": "CC",
     "Microsoft.VSTS.Scheduling.Effort": 12,
     "Custom.TRA_Milestone": "E0.1"
   }
 },
 {
   "id": "",
   "fields": {
     "System.AreaPath": "Engineering Group\\ECH Group\\ECH TPL 1",
     "System.Tags": "",
     "System.Title": "E4.8 Assessment",
     "Custom.Product": "",
     "Microsoft.VSTS.Scheduling.Effort": 2,
     "Custom.TRA_Milestone": "E4.8"
   }
]

Fields Manipulation

If you wish to pull fields from the template work item you can use the following syntax:

  • $[System.Description|template] - this will pull the System.Description field from the template work item. Since template is the default you can also use $[System.Description].
  • $[System.Description|control] - this will pull the System.Description field from the control item data.

This would make the following valid:

[
 {
   "id": 213928,
   "fields": {
     "System.AreaPath": "Engineering Group\\ECH Group\\ECH TPL 1",
     "System.Tags": "Customer Document",
     "System.Title": "Technical specification [ $[Custom.Product|control] ]",
     "Custom.Product": "CC",
     "Microsoft.VSTS.Scheduling.Effort": 12,
     "Custom.TRA_Milestone": "E0.1",
     "System.Description": "$[System.Description] for $[Custom.Product|control]",
     "Microsoft.VSTS.Common.AcceptanceCriteria": "$[Microsoft.VSTS.Common.AcceptanceCriteria]"
   }
 }
]

You can also specify ${fromtemplate} or ${valuefromtemplate} to pull just the value from the template that is the same name as the control field in focus.

[
 {
   "id": 213928,
   "fields": {
     "System.AreaPath": "Engineering Group\\ECH Group\\ECH TPL 1",
     "System.Tags": "Customer Document",
     "System.Title": "Technical specification",
     "Custom.Product": "CC",
     "Microsoft.VSTS.Scheduling.Effort": 12,
     "Custom.TRA_Milestone": "E0.1",
     "System.Description": "The description: ${fromtemplate}",
     "Microsoft.VSTS.Common.AcceptanceCriteria": "${fromtemplate}"
   }
 }
]

azure-devops-workitem-clone's People

Contributors

mrhinsh avatar alessandrorecca avatar

Stargazers

 avatar

Watchers

 avatar  avatar

azure-devops-workitem-clone's Issues

Cache Not Reloading Correctly After Multiple Changes to Template Work Items

We have identified a bug in the latest release where changes made to template work items do not consistently trigger a cache reload. This issue affects the accuracy of work items generated in the production systems.

Steps to Reproduce:

  1. Make a change to a template work item.
  2. Save the changes.
  3. Observe that the cache is reloaded correctly after the first change.
  4. Make another change to the same work item or to a different work item.
  5. Save the changes.
  6. Observe that the cache is not reloaded after the second change.

Expected Result:
The cache should be reloaded every time a change is made to any template work item to ensure that work items generated in the production systems are up-to-date.

Actual Result:
The cache is reloaded only after the first change to a template work item. Subsequent changes do not trigger a cache reload, leading to outdated content in the generated work items.

Impact:
Work items generated in the production systems are not up-to-date.

Auto generate query at the end (stage 7)

After creating the work items, the following Shared Query shall be generated:

SELECT
    [Custom.Product],
    [System.Title],
    [System.Description],
    [Custom.DeadlineDate],
    [System.AreaPath],
    [System.AssignedTo],
    [System.State],
    [Custom.Notes],
    [System.WorkItemType],
    [Custom.TRA_Milestone]
FROM workitemLinks
WHERE
    (
        [Source].[System.Id] = <<ADD "targetParentId" here, e. g. 257707>>
        OR [Source].[System.Parent] = <<ADD "targetParentId" here, e. g. 257707>>
        OR [Source].[System.Tags] CONTAINS 'xxxx xxxx'
    )
    AND (
        [System.Links.LinkType] = 'System.LinkTypes.Hierarchy-Forward'
    )
    AND (
        [Target].[System.Parent] = <<ADD "targetParentId" here, e. g. 257707>>
        OR [Target].[System.Tags] CONTAINS 'xxxx xxxx'
    )
ORDER BY [Custom.DeadlineDate]
MODE (Recursive)

Further details:

  • The generated shared query shall be stored here:
    image

  • The name of the shared query shall be the same as the title of "targetParentId"

  • If some items could not be created and were skipped, the tool should ask the user whether the query shall still be created,

Automated Consecutive Project Creation

Enhance the tool to allow for the creation of multiple customer projects consecutively, without requiring any manual actions from the user between runs.

Auto-generate pat

Automatically generate a PAT when starting the work item clone tool and delete the PAT when the tool finishes or crashes.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.