-
Notifications
You must be signed in to change notification settings - Fork 154
Expand file tree
/
Copy pathAdd-VSTeamBuildTag.ps1
More file actions
41 lines (37 loc) · 1.49 KB
/
Add-VSTeamBuildTag.ps1
File metadata and controls
41 lines (37 loc) · 1.49 KB
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
31
32
33
34
35
36
37
38
39
40
41
# Adds a tag to a build.
#
# Get-VSTeamOption 'build' 'tags'
# id : 6e6114b2-8161-44c8-8f6c-c5505782427f
# area : build
# resourceName : tags
# routeTemplate : {project}/_apis/{area}/builds/{buildId}/{resource}/{*tag}
# http://bit.ly/Add-VSTeamBuildTag
function Add-VSTeamBuildTag {
[CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = "Low",
HelpUri='https://methodsandpractices.github.io/vsteam-docs/modules/vsteam/Add-VSTeamBuildTag')]
param(
[parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, Position = 0)]
[string[]] $Tags,
[parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)]
[Alias('BuildID')]
[int[]] $Id,
[switch] $Force,
[Parameter(Mandatory = $true, Position = 0, ValueFromPipelineByPropertyName = $true)]
[vsteam_lib.ProjectValidateAttribute($false)]
[ArgumentCompleter([vsteam_lib.ProjectCompleter])]
[string] $ProjectName
)
process {
foreach ($item in $id) {
if ($Force -or $pscmdlet.ShouldProcess($item, "Add-VSTeamBuildTag")) {
foreach ($tag in $tags) {
_callAPI -Method PUT -ProjectName $projectName `
-Area "build/builds/$id" `
-Resource "tags" `
-id $tag `
-Version $(_getApiVersion Build) | Out-Null
}
}
}
}
}