Clone wiki

TFS Repository Plugin / Home

TFS Repository Plugin for Bamboo Documentation

Need Bamboo builds from TFS repositories? With this plugin you can do it!

See also:

1. Overview

This plugin allows Atlassian Bamboo to use TFS as a source repository for builds. Now it is easier to mix Microsoft and Atlassian solutions or plan migration.

The plugin is available on the Atlassian Marketplace.

Features

Compatibility

  • Version 1.1.x => Bamboo 5.x
  • Version 1.0.x => Bamboo 4.2-4.4.8

2. Admin guide

2.1. Installation

Note: Bamboo restart is required to install/update repository plugins.

2.1.1. Install using universal plugin manager

The Universal Plugin Manager (UPM) makes it easy to install plugins (add-ons). See the UMP manual:

2.1.2. Manual installation

To manually install a plugin into the Bamboo:

  • Copy the plugin (i.e. JAR file) into the <bamboo-home>/plugins/ directory.
  • Restart the Bamboo.

2.2. Configuration

2.2.1. Socket timeout

Default socket timeout is 1800 seconds. It can be changed by setting com.microsoft.tfs.core.socketTimeoutSeconds Java property (How to set Java properties).

Example: -Dcom.microsoft.tfs.core.socketTimeoutSeconds=120

3. User guide

3.1. Configuration

3.1.1. Repository parameters

Each TFS repository has the following parameters:

  • Server URL
  • Sources path
  • Username
  • Password
Server URL

This is a full URL for a repository. It consist of a protocol (http:// or https://), a server name or ip address, a port (optional), a web directory (optional) and a collection name. Here are some sampe full URLs:

  • http://localhost:8080/tfs/DefaultCollection
  • https://192.168.0.1/TestCollection

Note: you can use bamboo variables there.

Sources path

This is a path to the sources in the specified collection. It begins with a dollar sign ($). Here are some sample sources paths:

  • $/proj1/src
  • $/
  • $/app/branches/br1

Note: you can use bamboo variables there.

Username

This is a username for accessing the TFS repository. It is case insensitive and may contain a domain name. For example: SERVER\Admin, admin, Admin, ADMIN are all point to the same user.

Password

This is a password for a user which accesses the TFS repository. All passwords are stored encrypted.

3.1.2. Advanced repository parameters

Checkout filter

This option allows to include/exclude files that should be checked out. By default all files are checked out.

Checkout filter type could be set to the following values:

  • All files
  • Include only files matching the pattern
  • Exclude files matching the pattern

Checkout filter pattern is a regular expression used to filter out files in the repository. The pattern describes a path below the repository sources path (not the root $/).

Note: checkout filter pattern is case-sensitive.

Examples:

  • match all files under proj1 or proj2: (proj1|proj2)/.*
  • match all JPG files: .*\.(JPG|jpg)
  • match all files only in the root of proj1: proj1/[^/]*
  • match all *.sh files only in the root of proj1: proj1/[^/]*\.sh
Remove workspace

If this option is turned on TFS workspace will be removed after each checkout.

Note: incremental checkouts cannot work in this mode.

Version specifier

A label or a revision number to checkout from (leave empty to checkout the latest version).

Note: you can use bamboo variables there.

3.2. Cloud-based TFS services

TFS Repository Plugin for Bamboo is tested with the following cloud-based TFS services:

You can refer to the Connecting to cloud-based TFS services page for detailed instructions.

3.3. Build triggering

You can use any build trigger except "Repository triggers the build when changes are committed". That build trigger type is not supported because TFS has no analog of SVN or GIT hooks.

3.4. Build from a label or a revision

3.4.1. One-shot build

For one-shot build from a label or a revision start a customised manual build and use revision field to specify the target label or revision number.

3.4.2. Regular build

If you need regular builds from a label or a revision you can set:

  • version specifier in the repository advanced settings
  • a plan variable TFS_VERSION_SPEC (affects all repos in a plan)

Note: repository advanced settings have higher priority than a plan variable.

3.5. Exposed repository variables

In addition to generic repository variables the following repository specific variables are exposed:

Bamboo >= 4.2

  • repository.tfs.repositoryUrl
  • repository.tfs.path
  • repository.tfs.branch

Bamboo >= 5.1

  • repository.XXX.tfs.repositoryUrl
  • repository.XXX.tfs.path
  • repository.XXX.tfs.branch
  • planRepository.NNN.repositoryUrl
  • planRepository.NNN.path
  • planRepository.NNN.branchName

3.6. Web repository viewer

Web repository viewer provides links to TFS commits. It's turned on automatically and can be changed in repository advanced options.

Note: upgrading TFS repository addon doesn't turn on web repository viewer for already existing repositories, you need to turn it on manually (just open repository settings and click save).

3.7. Integrating with 3rd-party add-ons

3.7.1. Plan DSL for Bamboo

PLan DSL for Bamboo creates Bamboo plans with a Groovy-based DSL or YAML. The following sample demonstrates creation of a TFS repository:

import com.atlassian.bamboo.security.EncryptionService
import com.atlassian.spring.container.ContainerManager

def encryptionService = ContainerManager.getComponent('encryptionService') as EncryptionService

project(key: 'MYPROJECT', name: 'My project') {
    plan(key: 'MYPLAN', name: 'My plan') {
        scm {
            custom(name: 'MYREPO', pluginKey: 'com.stellarity.bamboo.tfs-repository-plugin:tfs') {
                configure(
                    'stellarity.tfs.repository.url': 'https://server/DefaultCollection',
                    'stellarity.tfs.repository.path': "\$/proj/SimpleDriver/TheSimpliest",
                    'stellarity.tfs.repository.username': 'username',
                    'stellarity.tfs.repository.password': encryptionService.encrypt('password'),
                    'stellarity.tfs.repository.removeworkspace': true,
                    'stellarity.tfs.repository.versionspec': '',
                    'selectedWebRepositoryViewer': 'com.stellarity.bamboo.tfs-repository-plugin:tfsViewer',
                    'stellarity.tfs.repository.filter.option': 'INCLUDE',
                    'stellarity.tfs.repository.filter.pattern': '.*\\.h'
                )
            }
        }
        triggers {
            polling() {
                repositories 'MYREPO'
                periodically {
                    pollingFrequencyInSecs 180
                }
            }
        }
        stage(name: 'My stage') {
            description 'This is my stage'
            manual false

            job(key: 'MYJOB', name: 'My job') {
                description 'This is my job'

                tasks {
                    checkout("Source Code Checkout") {
                        enabled true
                        forceCleanBuild true
                        repository('MYREPO') {
                        }
                    }
                }
            }
        }
    }
}

4. Release notes

4.1. Version 1.1.x (for Bamboo 5.x)

Version 1.1.19 (28 Jul 2017)

  • Fixed: Bamboo 6.1 support

Version 1.1.18 (09 Apr 2017)

  • Fixed #67: Add SNI support for SSL

Version 1.1.17 (30 Oct 2016)

  • Fixed #64: Checkout filter filed is corrupted on Bamboo 5.14
  • Fixed #59: UnsatisfiedLinkError while running several agents on the same machine simultaneously

Version 1.1.16 (07 Jul 2016)

  • Fixed #62: ComponentNotFoundException exception if using variable substitution on remote agent

Version 1.1.15 (13 Mar 2016)

  • Fixed #57: Web Repository Links not working

Version 1.1.14 (10 Feb 2016)

  • Fixed #55: NoClassDefFoundError exception in Bamboo 5.10

Version 1.1.13 (07 Feb 2016)

  • New #50: Add links to TFS commits in the commits section
  • Fixed #54: UnsupportedOperationException in deployment task

Version 1.1.12 (19 Jul 2015)

  • Fixed #48: Revision can be different across several jobs for the build #1
  • Fixed #49: Commits tab is empty for the build #2
  • Fixed #51: Commits tab is empty for the build from custom revision

Version 1.1.11 (03 Jun 2015)

  • New #46: Added an option to remove TFS workspace after checkout
  • New #45: Checkout from a label
  • Fixed #44: TF10156 (computer name too long)
  • Fixed #47: NPE under specific conditions

Version 1.1.10 (20 Jan 2015)

  • New #34: Support for TFS branch auto-discovery
  • Fixed #38: TFS Repository doesn't work after UPM update

Version 1.1.9 (07 Dec 2014)

  • Fixed #41: Working directory locked when username changes

Version 1.1.8 (23 Oct 2014)

  • Improved #39: Expose repository URL and path as Bamboo variables
  • Improved #40: Skip repository URL and path validation if they require variables substitution

Version 1.1.7 (14 Aug 2014)

  • Improved #33: Move to the API provided by UPM 2.x.
  • Improved #37: Show friendly error message when Bamboo restart is required due to UPM update
  • Fixed #35: Unable to checkout from two repositories (plan root and its subdir)
  • Fixed #36: "The working folder is already in use" when changing checkout directory from root of the plan to its subdir

Version 1.1.6 (08 May 2014)

  • Fixed #29: Add support for Bamboo 5.5

Version 1.1.5 (05 Feb 2014)

  • Fixed #26: Cannot get a non-recursive directory content using the checkout filter

Version 1.1.4 (02 Feb 2014)

  • Fixed #25: Incremental checkout doesn't update existing files (bug in 1.1.2)

Version 1.1.3 (27 Jan 2014)

  • Fixed #24: Exception on TFS 2008 while detecting branch object

Version 1.1.2 (22 Jan 2014)

  • Fixed #21: NPE if null comments returned
  • New #22: Need to be able to includes/excludes folders/files when checkout
  • New #23: Populate ${bamboo.repository.branch.name} variable

Version 1.1.1 (19 Dec 2013)

  • Fixed #17: Author linking for TFS changesets not working correctly for all changesets (commits on behalf of another user)
  • Fixed #19: Add support for bamboo variables in repository settings
  • Dropped UPM 1.x support

Version 1.1 (10 Sep 2013)

  • Fixed #16: TFS Repositories won't show up in Deployment Task

4.2. Version 1.0.x (for Bamboo 4.2-4.4.8)

Version 1.0.25 (09 Apr 2017)

  • Fixed #67: Add SNI support for SSL

Version 1.0.24 (07 Jul 2016)

  • Fixed #62: ComponentNotFoundException exception if using variable substitution on remote agent

Version 1.0.23 (13 Mar 2016)

  • Fixed #57: Web Repository Links not working

Version 1.0.22 (07 Feb 2016)

  • New #50: Add links to TFS commits in the commits section
  • Fixed #54: UnsupportedOperationException in deployment task

Version 1.0.21 (19 Jul 2015)

  • Fixed #48: Revision can be different across several jobs for the build #1
  • Fixed #49: Commits tab is empty for the build #2
  • Fixed #51: Commits tab is empty for the build from custom revision

Version 1.0.20 (03 Jun 2015)

  • New #46: Added an option to remove TFS workspace after checkout
  • New #45: Checkout from a label
  • Fixed #44: TF10156 (computer name too long)
  • Fixed #47: NPE under specific conditions

Version 1.0.19 (20 Jan 2015)

  • New #34: Support for TFS branch auto-discovery
  • Fixed #38: TFS Repository doesn't work after UPM update

Version 1.0.18 (07 Dec 2014)

  • Fixed #41: Working directory locked when username changes

Version 1.0.17 (23 Oct 2014)

  • Improved #39: Expose repository URL and path as Bamboo variables
  • Improved #40: Skip repository URL and path validation if they require variables substitution

Version 1.0.16 (14 Aug 2014)

  • Improved #33: Move to the API provided by UPM 2.x.
  • Improved #37: Show friendly error message when Bamboo restart is required due to UPM update
  • Fixed #35: Unable to checkout from two repositories (plan root and its subdir)
  • Fixed #36: "The working folder is already in use" when changing checkout directory from root of the plan to its subdir

Version 1.0.15 (08 May 2014)

  • Fixed #30: Add support for Bamboo 4.0-4.1

Version 1.0.14 (05 Feb 2014)

  • Fixed #26: Cannot get a non-recursive directory content using the checkout filter

Version 1.0.13 (02 Feb 2014)

  • Fixed #25: Incremental checkout doesn't update existing files (bug in 1.0.11)

Version 1.0.12 (27 Jan 2014)

  • Fixed #24: Exception on TFS 2008 while detecting branch object

Version 1.0.11 (22 Jan 2014)

  • Fixed #21: NPE if null comments returned
  • New #22: Need to be able to includes/excludes folders/files when checkout
  • New #23: Populate ${bamboo.repository.branch.name} variable

Version 1.0.10 (19 Dec 2013)

  • Fixed #17: Author linking for TFS changesets not working correctly for all changesets (commits on behalf of another user)
  • Fixed #19: Add support for bamboo variables in repository settings
  • Dropped UPM 1.x support

Version 1.0.9 (05 Sep 2013)

  • Fixed #14: Bamboo 5.1 support
  • Fixed #15: Add automatic retry if network problem occurs while downloading sources

Version 1.0.8 (26 Jun 2013)

  • Fixed #11: Memory leak in TFS SDK
  • Improved #12: Update TFS SDK to 11.0.0.1306 (freebsd support)

Version 1.0.7 (20 May 2013)

  • Improved #9: Implement incremental checkouts and workspace management
  • Improved #10: Update TFS SDK to 11.0.0.1303

Version 1.0.6 (10 May 2013)

  • Fixed #4: New build is triggered constantly with the same changes on TFS2008
  • Fixed #7: Memory leak in TFS SDK
  • Improved #5: Add more logging
  • Improved #6: Support externally created workspaces

Version 1.0.1 (28 Feb 2013)

  • Fixed #1: First checkout fails with error "There is no history for the path ... Probably it doesn't exist"

Version 1.0 (16 Dec 2012)

  • Initial public release

5. Support

If you find a bug, have a feature request or have an idea how to improve this plugin please post it at the public bug tracker.

6. Contact

Feel free to contact us via email mailto:support@stellaritysoftware.com and visit our website.

Updated