Remove-TFSBuildTag.ps1

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# Author: Miodrag Milic <miodrag.milic@gmail.com>
# Last Change: 26-Apr-2016.

<#
.SYNOPSIS
    Remove tag from TFS build
.EXAMPLE
    Remove-TFSBuildTag 220 production
 
    Remove tag 'production' from the build with ID 220.
#>

function Remove-TFSBuildTag{
    [CmdletBinding()]
    param(
        #Build ID
        [int]$Id,

        #Tag to remove from the build
        [string]$Tag
    )
    check_credential

    $uri = "$proj_uri/_apis/build/builds/$Id/tags/$($Tag)?api-version=" + $global:tfs.api_version
    Write-Verbose "URI: $uri"

    $params = @{ Uri = $uri; Method = 'Delete'}
    $r = invoke_rest $params
    $r.Value
}