graywolf
graywolf

Reputation: 7500

Running shelveset as remote run without unshelve

Using teamcity with TFS, is it possible to run shelveset without unshelving it first to my workspace? I found way to only run it from pending changes (therefore unshelved), but it seems weird this is not possible.

Using Visual Studio 2008 and teamcity adding 8.1.

Upvotes: 1

Views: 530

Answers (1)

Rami A.
Rami A.

Reputation: 10582

That feature is not currently built into TeamCity's TFS VCS plug-in.

As a work-around, you can do this using a custom build configuration parameter and a custom build step that automatically unshelves the shelveset before the build.

I created a feature request here: https://youtrack.jetbrains.com/issue/TW-43793

Manual work-around:

  1. Create a new build parameter:

    Name: ShelvesetName
    Kind: Configuration parameter
    Spec: text description='The shelveset to unshelve in the format |[shelvesetname|[;username|]|]' label='Shelveset Name' validationMode='any' display='normal'

  2. Create a new build step:

    Runner Type: Command Line
    Step name: Unshelve shelveset
    Execute step: If all previous steps finished successfully
    Run: Custom script
    Custom script:
    if "%ShelvesetName%"=="" exit /b 0

    "%VS2013_Path%\tf.exe" unshelve "%ShelvesetName%" "%vcsroot.vcsroot-name.tfs-root%" /recursive /noprompt /login:domain\username,password

You may have to change VS2013_Path with the appropriate variable/parameter from the agent and the version of Visual Studio you're using.

You'll have to change vcsroot-name with the name of your vcs root, and remove the /login parameter or specify your own credentials.

The VCS root checkout mode must be set to Automatically on agent (if supported by VCS roots) for TeamCity to create a TFS workspace so this can work correctly.

Then finally, when you run a custom build, set the Shelveset Name field on the Parameters tab to the name of the shelveset, including the owner, like shelveset1;domain\username.

Upvotes: 2

Related Questions