Skip to content

xebialabs-community/xlr-tfs-plugin

Repository files navigation

XL Release TFS plugin

Build Status Codacy Badge Code Climate License: MIT Github All Releases

Preface

This document describes the functionality provided by the XL Deploy|Release Description|Interface plugin.

See the XL Release reference manual for background information on XL Release and release automation concepts.

Overview

This plugin offers an interface from XL Release to Team Foundation Server to create, update and retrieve Work Items.

Various APIs are supported: Team Foundation Power Tools, TFS REST API, and the TFS SDK.

Requirements

  • XL Release [7.0 - 7.2]

This community-supported version was developed for versions of XL Release 7.2 and lower and for TFS versions 2013 and 2015.

Note: XebiaLabs has released an officially supported plugin, xlr-vsts-tfs-plugin-7.5.1. See the documentation at https://docs.xebialabs.com/xl-release/how-to/using-the-xl-release-vsts-tfs-plugin.html. Contact XebiaLabs for download information.

Installation

Usage

Team Foundation Power Tools

The following actions are supported:

CreateWorkItem

The CreateWorkItem.py script creates a new Work Item by executing a remote Windows batch wrapper script, CreateWorkItems.bat. Input parameters are Project, Type, Collection, Title, AssignedTo, and Description; the script returns the number of the Work Item created.

screenshot of createWorkItem

GetWorkItem

The GetWorkItem.py script retrieves a Work Item given its number and collection using the GetWorkItem.bat wrapper script. Input parameters are workItemNumber and collection.

screenshot of getWorkItem

UpdateWorkItem

The UpdateWorkItem.py script updates a Work Item given its number, collection, and set of update fields and values in the format fieldname1=value1;fieldname2=value2. See an example of setting State=Done at the end of this document.

screenshot of updateWorkItem

Notes:

The TFS machine must have Microsoft Visual Studio Team Foundation Server 2013 Update 2 Power Tools installed.

The CreateWorkItem.bat, GetWorkItem.bat, and UpdateWorkItem.bat scripts must be placed in a location on the TFS machine. The default location is C:\xlr-tfs2013-plugin.

A field is provided for the Windows CIFS port (default is 445) to allow overriding a blocked port.

The functionality will be enhanced as specific needs materialize.

TFS REST API

This plugin offers an interface from XL Release to Team Foundation Server via the REST API valid for work items in TFS 2015. It provides:

CreateWorkItem.py -- creates a Work Item given Collection, Project, Type and Title parameters

AddWorkItemComment.py -- adds a Work Item comment given Collection, Work Item Id and Comment parameters

GetTfsRepoArtifacts.py -- retrieves an item from a TFS Git repository given the collection and scopepath (assumes a single repository and a single match)

QueueBuild.py -- Queue a build using the REST api.

The functionality will be enriched with additional Work Item fields as specific needs materialize.

To test the connection on the Shared Configuration screen, you will need the SDK set up.

TFS Triggers

Using the REST API, the Plugin allows you to poll TFS repositories and trigger XL Release on changes.

GitCommitTrigger.py -- Given a Collection, Project, Repo and Branch, will trigger a release if the latest commit ID changes.

TfvcChangesetTrigger.py -- Given a Collection and Project, will trigger a release if the latest changeset ID changes.

TFS SDK

The TFS SDK depends on the following configuration changes in XL Release:

Script.policy file — confirm these lines:

permission  java.util.PropertyPermission "\*", "read, write";
permission java.lang.RuntimePermission "shutdownHooks";
permission java.io.FilePermission "conf/\*", "read";
permission java.io.FilePermission "lib/\*", "read";
permission java.io.FilePermission "plugins/\*", "read";
permission java.security.AllPermission;

Add the library com.microsoft.tfs.sdk-11.0.0.jar to /plugins.

Unzip native.zip in the /conf directory.

Example configuration, TFPT

Shared Configuration

You can specify the URL for your TFS Server, Username , password , domain. Then you can specify the authentication type as Basic or NTLM dependening on the type of account you are using. The Depending on whether you are using TFSSDK( for TFS 2010-2013) or TFSREST API (2015), you can specify the value in dropdown. This will help to test the connection to target. Doesn't do test connection for CLI.

screenshot of shared Configuration

Task Usage

Here is a basic workflow of four items to create a Work Item, then retrieve it, update it, and retrieve it again to see the modification.

screenshot of release template

The variables appearing in the above screenshots are set in this manner:

screenshot of release variables

Note that workItemNumber is set as an output variable by the createWorkItem task.

Successful execution of the release results in the following output:

Create Work Item

screenshot of createWorkItem output

Get Work Item, note State=New

screenshot of createWorkItem output

Update Work Item

screenshot of createWorkItem output

Get Work Item, note State=Done

screenshot of createWorkItem output

References