-
Notifications
You must be signed in to change notification settings - Fork 186
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Change workflow to use upstream branches
- Loading branch information
1 parent
d6e7674
commit f63aeba
Showing
5 changed files
with
138 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
[CmdletBinding(SupportsShouldProcess = $true)] | ||
param( | ||
[Parameter(Mandatory = $true)] | ||
[string]$Organization, | ||
|
||
[Parameter(Mandatory = $true)] | ||
[string]$Project, | ||
|
||
[Parameter(Mandatory = $true)] | ||
[string]$SourceBranch, | ||
|
||
[Parameter(Mandatory = $true)] | ||
[int]$DefinitionId, | ||
|
||
[Parameter(Mandatory = $true)] | ||
[string]$AuthToken | ||
) | ||
|
||
. "${PSScriptRoot}\logging.ps1" | ||
|
||
$headers = @{ | ||
Authorization = "Basic $AuthToken" | ||
} | ||
|
||
$apiUrl = "https://dev.azure.com/$Organization/$Project/_apis/build/builds?api-version=6.0" | ||
|
||
$body = @{ | ||
sourceBranch = $SourceBranch | ||
definition = @{ id = $DefinitionId } | ||
} | ||
|
||
Write-Verbose ($body | ConvertTo-Json) | ||
|
||
try { | ||
$resp = Invoke-RestMethod -Method POST -Headers $headers $apiUrl -Body ($body | ConvertTo-Json) -ContentType application/json | ||
} | ||
catch { | ||
Write-Error "Invoke-RestMethod $apiUrl failed with exception:`n$_" | ||
exit 1 | ||
} | ||
|
||
LogDebug "Pipeline [ $($resp.definition.name) ] queued at [ $($resp._links.web.href) ]" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -35,6 +35,6 @@ function LogDebug | |
} | ||
else | ||
{ | ||
Write-Debug "$args" | ||
Write-Debug "$args" -Debug | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters