Creating Work Items using Azure DevOps pipeline

Creating Work Items using Azure DevOps pipeline

There can be situations where you want to create issues in Azure DevOps whenever a task/job/step is failed. For creating a work item, we need to install the plugin from Azure Marketplace.

Click on Marketplace and click on Browse Marketplace.

marketplace -> Browse the marketplace

Once the plugin is installed, we can use Create Work Item item.

To create work Item, in case the previous task is failed, we can use the below configuration.

Note: To avoid duplicate ticket creation, we can use preventDuplicates: true along with keyFields.

  - task: Docker@2
      containerRegistry: '${Dockerregistry_service_Connection}'
      repository: '${Docker_repository}'
      command: 'buildAndPush'
      Dockerfile: '**/Dockerfile'
      continueOnError: true

  - task: CreateWorkItem@1
    displayName: 'Create work item'
      workItemType: Task 
      title: docker task failed
      preventDuplicates: true
      keyFields: 'System.Title'      
    condition: failed()
    continueOnError: true