Skip to content
github-actions edited this page Jul 2, 2024 · 3 revisions

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

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": "ADO_TESTProjPipline_V03.json",
 "targetAccessToken": null,
 "targetOrganization": "nkdagility-preview",
 "targetProject": "Clone-Demo",
 "targetParentId": 540,
 "templateAccessToken": null,
 "templateOrganization": "Clone-MO-ATE",
 "templateProject": "Clone Template"
}

inputJsonFile Example

[
 {
   "id": 213928,
   "area": "TPL",
   "tags": "Customer Document",
   "fields": {
     "title": "Technical specification",
     "product": "CC000_000A01"
   }
 },
 {
   "id": 213928,
   "area": "TPL",
   "tags": "Customer Document",
   "fields": {
     "title": "Technical specification",
     "product": "CC000_000A02"
   }
 }
]

proposed new format not yet adopted:

[
 {
   "templateId": 213928,
   "fields": [
     {"System.Title": "Technical specification"},
     {"Custom.Project": "CC000_000A01"},
     {"System.Tags": "Customer Document"},
     {"System.AreaPath": "#{targetProject}#\\TPL"}
   ]
 },
 {
   "templateId": 213928,
   "fields": [
     {"System.Title": "Technical specification"},
     {"Custom.Project": "CC000_000A02"},
     {"System.Tags": "Technical specification"},
     {"System.AreaPath": "#{targetProject}#\\TPL"}
   ]
 },
 }
]