-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAzureDevopsSVNCiTrigger.ps1
More file actions
22 lines (16 loc) · 1.15 KB
/
AzureDevopsSVNCiTrigger.ps1
File metadata and controls
22 lines (16 loc) · 1.15 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
param($url, $project, $pat, $svnuser, $svnpassword)
echo $pat | az devops login --org $url
$buildDefinitions = (az pipelines build definition list --org $url --project $project) | convertfrom-json
foreach ($buildDefinition in $buildDefinitions){
$variables = az pipelines variable list --detect true --pipeline-id $buildDefinition.id --project $project | convertfrom-json
if ($variables.buildCI.Value -eq $True){
$pipeline = az pipelines build definition show --detect true --id $buildDefinition.id --project $project| convertfrom-json
$svnPath = $pipeline.repository.url + '/' + $pipeline.repository.defaultBranch
$lastBuildRevision = [int](az pipelines build list --project $project --definition-ids $buildDefinition.id --status all --top 1| convertfrom-json)[0].sourceVersion
$svnInfo = svn info $svnPath --username $svnuser --password $svnpassword
$svnRevision = [int](-split $svnInfo.where{$_ -match 'Last Changed Rev*'})[3]
if ($svnRevision -gt $lastBuildRevision){
az pipelines build queue --detect true --definition-id $buildDefinition.id --project $project
}
}
}