Skip to content

Commit

Permalink
Merge branch 'master' into ta-nov-patch-merge
Browse files Browse the repository at this point in the history
  • Loading branch information
mssfang authored Nov 12, 2020
2 parents 4fc6a69 + c9449d7 commit 472ab55
Show file tree
Hide file tree
Showing 62 changed files with 526 additions and 280 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -349,6 +349,10 @@
<suppress checks="com.azure.tools.checkstyle.checks.ThrowFromClientLogger"
files="com.azure.security.keyvault.keys.cryptography.AesCbc.java"/>

<!-- suppress the runtime exception in the KeyVaultClient class-->
<suppress checks="com.azure.tools.checkstyle.checks.ThrowFromClientLogger"
files="com.azure.security.keyvault.jca.KeyVaultClient.java"/>

<!-- MSAL extension temporarily living in our package. Will not take dependency on azure-core once migrated to MSAL repo -->
<suppress checks="com.azure.tools.checkstyle.checks.ThrowFromClientLogger"
files="com.azure.identity.implementation.msalextensions.CacheLock"/>
Expand Down
2 changes: 1 addition & 1 deletion eng/common/TestResources/deploy-test-resources.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
parameters:
ServiceDirectory: not-set
ArmTemplateParameters: '@{}'
DeleteAfterHours: 24
DeleteAfterHours: 8
Location: ''
SubscriptionConfiguration: $(sub-config-azure-cloud-test-resources)

Expand Down
8 changes: 6 additions & 2 deletions eng/common/scripts/Get-PullRequestCreator.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,18 @@ param (
[string]$RepoName,

[Parameter(Mandatory = $true)]
$PullRequestNumber
$PullRequestNumber,

[Parameter(Mandatory = $true)]
[string]$AuthToken
)

. "${PSScriptRoot}\common.ps1"

try
{
$pullRequest = Get-GithubPullRequest -RepoOwner $RepoOwner -RepoName $RepoName -PullRequestNumber $PullRequestNumber
$pullRequest = Get-GithubPullRequest -RepoOwner $RepoOwner -RepoName $RepoName `
-PullRequestNumber $PullRequestNumber -AuthToken $AuthToken
Write-Host "##vso[task.setvariable variable=System.PullRequest.Creator;]$($pullRequest.user.login)"
}
catch
Expand Down
92 changes: 92 additions & 0 deletions eng/common/scripts/Invoke-DevOpsAPI.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
. "${PSScriptRoot}\logging.ps1"

$DevOpsAPIBaseURI = "https://dev.azure.com/{0}/{1}/_apis/{2}/{3}?{4}api-version=6.0"

function Get-DevOpsApiHeaders ($Base64EncodedToken) {
$headers = @{
Authorization = "Basic $Base64EncodedToken"
}
return $headers
}

function Start-DevOpsBuild {
param (
$Organization="azure-sdk",
$Project="internal",
[Parameter(Mandatory = $true)]
$SourceBranch,
[Parameter(Mandatory = $true)]
$DefinitionId,
[ValidateNotNullOrEmpty()]
[Parameter(Mandatory = $true)]
$Base64EncodedAuthToken
)

$uri = "$DevOpsAPIBaseURI" -F $Organization, $Project , "build" , "builds", ""

$parameters = @{
sourceBranch = $SourceBranch
definition = @{ id = $DefinitionId }
}

return Invoke-RestMethod `
-Method POST `
-Body ($parameters | ConvertTo-Json) `
-Uri $uri `
-Headers (Get-DevOpsApiHeaders -Base64EncodedToken $Base64EncodedAuthToken) `
-MaximumRetryCount 3 `
-ContentType "application/json"
}

function Update-DevOpsBuild {
param (
$Organization="azure-sdk",
$Project="internal",
[ValidateNotNullOrEmpty()]
[Parameter(Mandatory = $true)]
$BuildId,
$Status, # pass canceling to cancel build
[ValidateNotNullOrEmpty()]
[Parameter(Mandatory = $true)]
$Base64EncodedAuthToken
)

$uri = "$DevOpsAPIBaseURI" -F $Organization, $Project, "build", "builds/$BuildId", ""
$parameters = @{}

if ($Status) { $parameters["status"] = $Status}

return Invoke-RestMethod `
-Method PATCH `
-Body ($parameters | ConvertTo-Json) `
-Uri $uri `
-Headers (Get-DevOpsApiHeaders -Base64EncodedToken $Base64EncodedAuthToken) `
-MaximumRetryCount 3 `
-ContentType "application/json"
}

function Get-DevOpsBuilds {
param (
$Organization="azure-sdk",
$Project="internal",
$BranchName, #Should start with 'refs/heads/'
$Definitions, # Comma seperated string of definition IDs
$StatusFilter, # Comma seperated string 'cancelling, completed, inProgress, notStarted'
[ValidateNotNullOrEmpty()]
[Parameter(Mandatory = $true)]
$Base64EncodedAuthToken
)

$query = ""

if ($BranchName) { $query += "branchName=$BranchName&" }
if ($Definitions) { $query += "definitions=$Definitions&" }
if ($StatusFilter) { $query += "statusFilter=$StatusFilter&" }
$uri = "$DevOpsAPIBaseURI" -F $Organization, $Project , "build" , "builds", $query

return Invoke-RestMethod `
-Method GET `
-Uri $uri `
-Headers (Get-DevOpsApiHeaders -Base64EncodedToken $Base64EncodedAuthToken) `
-MaximumRetryCount 3
}
Loading

0 comments on commit 472ab55

Please sign in to comment.