Skip to content

Commit

Permalink
Upgrade msal4j to 1.6.1 (#13216)
Browse files Browse the repository at this point in the history
* Upgrade msal extensions to 0.2.0

* Bump msal version everywhere

* Address readme feedback

* Bump identity version to 1.0.9

* Increment package version after release of com.azure azure-identity (#12871) (#13217)

Co-authored-by: Azure SDK Bot <53356347+azure-sdk@users.noreply.github.com>

* Fix merge error

* fix build errors and tests

* Migrate file cache tests

* Fix eventhubs test and add change log

* Ignored flaky CF tests (#12915)

* Sync with master eng/common

* Update change log date

Co-authored-by: Azure SDK Bot <53356347+azure-sdk@users.noreply.github.com>
Co-authored-by: Gauri Prasad <51212198+gapra-msft@users.noreply.github.com>
  • Loading branch information
3 people authored Jul 17, 2020
1 parent c4f92a5 commit 4875a2e
Show file tree
Hide file tree
Showing 32 changed files with 554 additions and 215 deletions.
2 changes: 1 addition & 1 deletion eng/common/TestResources/deploy-test-resources.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ parameters:
# "TestApplicationId": "<test app id>",
# "TestApplicationSecret": "<test app secret>",
# "ProvisionerApplicationId": "<provisoner app id>",
# "ProvisoinerApplicationSecret": "<provisoner app secert>",
# "ProvisionerApplicationSecret": "<provisoner app secert>",
# "Environment": "AzureCloud | AzureGov | AzureChina | <other environment>"
# }

Expand Down
36 changes: 19 additions & 17 deletions eng/common/Update-Change-Log.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@ function Get-ChangelogPath($Path)
{
# Check if CHANGELOG.md is present in path
$ChangeLogPath = Join-Path -Path $Path -ChildPath "CHANGELOG.md"
if ((Test-Path -Path $ChangeLogPath) -eq $False){
if ((Test-Path -Path $ChangeLogPath) -eq $False) {
# Check if change log exists with name HISTORY.md
$ChangeLogPath = Join-Path -Path $Path -ChildPath "HISTORY.md"
if ((Test-Path -Path $ChangeLogPath) -eq $False){
if ((Test-Path -Path $ChangeLogPath) -eq $False) {
Write-Host "Change log is not found in path[$Path]"
exit(1)
}
Expand All @@ -45,7 +45,7 @@ function Get-VersionTitle($Version, $Unreleased)
{
# Generate version title
$newVersionTitle = "## $Version $UNRELEASED_TAG"
if ($Unreleased -eq $False){
if ($Unreleased -eq $False) {
$releaseDate = Get-Date -Format "(yyyy-MM-dd)"
$newVersionTitle = "## $Version $releaseDate"
}
Expand All @@ -67,10 +67,10 @@ function Get-NewChangeLog( [System.Collections.ArrayList]$ChangelogLines, $Versi
# Version increment tool passes replaceversion as False and Unreleased as True
$is_version_increment = $ReplaceVersion -eq $False -and $Unreleased -eq $True

for(; $Index -lt $ChangelogLines.Count; $Index++){
if (Version-Matches($ChangelogLines[$Index])){
for (; $Index -lt $ChangelogLines.Count; $Index++) {
if (Version-Matches($ChangelogLines[$Index])) {
# Find current title in change log
if( -not $CurrentTitle){
if( -not $CurrentTitle) {
$CurrentTitle = $ChangelogLines[$Index]
$CurrentIndex = $Index
Write-Host "Current Version title: $CurrentTitle"
Expand All @@ -80,7 +80,7 @@ function Get-NewChangeLog( [System.Collections.ArrayList]$ChangelogLines, $Versi
# update change log script is triggered for all packages with current version for Java ( or any language where version is maintained in common file)
# and this can cause an issue if someone changes changelog manually to prepare for release without updating actual version in central version file
# Do not add new line or replace existing title when version is already present and script is triggered to add new line
if ($is_version_increment -and $ChangelogLines[$Index].Contains($Version)){
if ($is_version_increment -and $ChangelogLines[$Index].Contains($Version)) {
Write-Host "Version is already present in change log."
exit(0)
}
Expand All @@ -90,26 +90,24 @@ function Get-NewChangeLog( [System.Collections.ArrayList]$ChangelogLines, $Versi
# Generate version title
$newVersionTitle = Get-VersionTitle -Version $Version -Unreleased $Unreleased

if( $newVersionTitle -eq $CurrentTitle){
if( $newVersionTitle -eq $CurrentTitle) {
Write-Host "No change is required in change log. Version is already present."
exit(0)
}



if (($ReplaceVersion -eq $True) -and ($Unreleased -eq $False) -and (-not $CurrentTitle.Contains($UNRELEASED_TAG))){
if (($ReplaceVersion -eq $True) -and ($Unreleased -eq $False) -and $CurrentTitle.Contains($version) -and (-not $CurrentTitle.Contains($UNRELEASED_TAG))) {
Write-Host "Version is already present in change log with a release date."
exit(0)
}

# if current version title already has new version then we should replace title to update it
if ($CurrentTitle.Contains($Version) -and $ReplaceVersion -eq $False){
if ($CurrentTitle.Contains($Version) -and $ReplaceVersion -eq $False) {
Write-Host "Version is already present in title. Updating version title"
$ReplaceVersion = $True
}

# if version is already found and not replacing then nothing to do
if ($ReplaceVersion -eq $False){
if ($ReplaceVersion -eq $False) {
Write-Host "Adding version title $newVersionTitle"
$ChangelogLines.insert($CurrentIndex, "")
$ChangelogLines.insert($CurrentIndex, "")
Expand All @@ -121,24 +119,28 @@ function Get-NewChangeLog( [System.Collections.ArrayList]$ChangelogLines, $Versi
$ChangelogLines[$CurrentIndex] = $newVersionTitle
}

return $ChangelogLines
return $ChangelogLines
}


# Make sure path is valid
if ((Test-Path -Path $ChangeLogPath) -eq $False){
if ((Test-Path -Path $ChangeLogPath) -eq $False) {
Write-Host "Change log path is invalid. [$ChangeLogPath]"
exit(1)
}

# probe change log path if path is directory
if (Test-Path -Path $ChangeLogPath -PathType Container)
{
if (Test-Path -Path $ChangeLogPath -PathType Container) {
$ChangeLogPath = Get-ChangelogPath -Path $ChangeLogPath
}

# Read current change logs and add/update version
$ChangelogLines = [System.Collections.ArrayList](Get-Content -Path $ChangeLogPath)

if ($null -eq $ChangelogLines) {
$ChangelogLines = @()
}

$NewContents = Get-NewChangeLog -ChangelogLines $ChangelogLines -Version $Version -Unreleased $Unreleased -ReplaceVersion $ReplaceVersion

Write-Host "Writing change log to file [$ChangeLogPath]"
Expand Down
16 changes: 16 additions & 0 deletions eng/common/pipelines/templates/steps/create-pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ parameters:
WorkingDirectory: $(System.DefaultWorkingDirectory)
PRTitle: not-specified
ScriptDirectory: eng/common/scripts
GHReviewersVariable: ''
GHTeamReviewersVariable: ''

steps:

Expand Down Expand Up @@ -63,3 +65,17 @@ steps:
-PRBranch "${{ parameters.PRBranchName }}"
-AuthToken "$(azuresdk-github-pat)"
-PRTitle "${{ parameters.PRTitle }}"
- task: PowerShell@2
displayName: Tag a Reviewer on PR
inputs:
pwsh: true
workingDirectory: ${{ parameters.WorkingDirectory }}
filePath: ${{ parameters.ScriptDirectory }}/add-pullrequest-reviewers.ps1
arguments: >
-RepoOwner "${{ parameters.RepoOwner }}"
-RepoName "${{ parameters.RepoName }}"
-AuthToken "$(azuresdk-github-pat)"
-GitHubUsers "$(${{ parameters.GHReviewersVariable }})"
-GitHubTeams "$(${{ parameters.GHTeamReviewersVariable }})"
-PRNumber "$(Submitted.PullRequest.Number)"
12 changes: 12 additions & 0 deletions eng/common/pipelines/templates/steps/daily-dev-build-variable.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# This script fragment is used across our repos to set a variable "SetDevVersion" which
# is used when this pipeline is going to be generating and publishing daily dev builds.

steps:
- pwsh: |
$setDailyDevBuild = "false"
if (('$(Build.Reason)' -eq 'Schedule') -and ('$(System.TeamProject)' -eq 'internal')) {
$setDailyDevBuild = "true"
}
echo "##vso[task.setvariable variable=SetDevVersion]$setDailyDevBuild"
displayName: "Setup Versioning Properties"
condition: eq(variables['SetDevVersion'], '')
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ parameters:
ArtifactName: ''
Language: ''
DocRepoDestinationPath: '' #usually docs-ref-services/
GHReviewersVariable: ''
GHTeamReviewersVariable: '' # externally set, as eng-common does not have the identity-resolver. Run as pre-step

steps:
- pwsh: |
Expand Down Expand Up @@ -56,3 +58,5 @@ steps:
BaseBranchName: smoke-test
WorkingDirectory: ${{ parameters.WorkingDirectory }}/repo
ScriptDirectory: ${{ parameters.WorkingDirectory }}/${{ parameters.ScriptDirectory }}
GHReviewersVariable: ${{ parameters.GHReviewersVariable }}
GHTeamReviewersVariable: ${{ parameters.GHTeamReviewersVariable }}
46 changes: 46 additions & 0 deletions eng/common/pipelines/templates/steps/get-pr-owners.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
parameters:
TargetVariable: ''
ServiceDirectory: ''

steps:
- pwsh: |
git clone https://github.com/Azure/azure-sdk-tools.git $(Build.SourcesDirectory)/tools_repo
cd $(Build.SourcesDirectory)/tools_repo
git checkout 564ad63ae72d18422533fa1da9d396e7703c1cb5
displayName: Setup Identity Resolver
- pwsh: |
$result = dotnet run -v q -- `
--aad-app-id-var APP_ID `
--aad-app-secret-var APP_SECRET `
--aad-tenant-var AAD_TENANT `
--kusto-url-var KUSTO_URL `
--kusto-database-var KUSTO_DB `
--kusto-table-var KUSTO_TABLE `
--identity "$(Build.QueuedBy)"
$resolvedIdentity = $result[-1] | ConvertFrom-Json
Write-Host $resolvedIdentity
Write-Output "##vso[task.setvariable variable=${{ parameters.TargetVariable }}]$($resolvedIdentity.GithubUserName)"
displayName: 'Resolving Queuing User'
workingDirectory: $(Build.SourcesDirectory)/tools_repo/tools/notification-configuration/identity-resolver
env:
APP_ID: $(notification-aad-app-id)
APP_SECRET: $(notification-aad-secret)
AAD_TENANT: $(notification-aad-tenant)
KUSTO_URL: $(notification-kusto-url)
KUSTO_DB: $(notification-kusto-db)
KUSTO_TABLE: $(notification-kusto-table)
- pwsh: |
Remove-Item -Force -Recurse $(Build.SourcesDirectory)/tools_repo
displayName: Clean Up Cloned Tools Repo
- pwsh: |
$originalValue = "$(${{ parameters.TargetVariable }})"
$result = $(Build.SourcesDirectory)/eng/common/scripts/get-codeowners.ps1 -TargetDirectory /sdk/${{ parameters.ServiceDirectory }}/ -RootDirectory $(Build.SourcesDirectory)
if ($result) {
Write-Output "##vso[task.setvariable variable=${{ parameters.TargetVariable }}]$originalValue,$result"
}
displayName: Add CodeOwners if Present
4 changes: 3 additions & 1 deletion eng/common/pipelines/templates/steps/verify-links.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
parameters:
Directory: 'not-specified'
IgnoreLinksFile: "$(Build.SourcesDirectory)/eng/ignore-links.txt"


steps:
- task: PowerShell@2
Expand All @@ -9,4 +11,4 @@ steps:
workingDirectory: $(Build.SourcesDirectory)/${{ parameters.Directory }}
filePath: eng/common/scripts/Verify-Links.ps1
arguments: >
-urls $(dir -r -i *.md) -rootUrl "file://$(Build.SourcesDirectory)/${{ parameters.Directory }}"
-urls $(dir -r -i *.md) -rootUrl "file://$(Build.SourcesDirectory)/${{ parameters.Directory }}" -recursive:$false -ignoreLinksFile ${{ parameters.IgnoreLinksFile }}
6 changes: 6 additions & 0 deletions eng/common/scripts/Submit-PullRequest.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,9 @@ $resp | Write-Verbose

if ($resp.Count -gt 0) {
Write-Host -f green "Pull request already exists $($resp[0].html_url)"

# setting variable to reference the pull request by number
Write-Host "##vso[task.setvariable variable=Submitted.PullRequest.Number]$($resp[0].number)"
}
else {
$data = @{
Expand All @@ -80,4 +83,7 @@ else {

$resp | Write-Verbose
Write-Host -f green "Pull request created https://github.com/$RepoOwner/$RepoName/pull/$($resp.number)"

# setting variable to reference the pull request by number
Write-Host "##vso[task.setvariable variable=Submitted.PullRequest.Number]$($resp.number)"
}
53 changes: 35 additions & 18 deletions eng/common/scripts/Verify-ChangeLog.ps1
Original file line number Diff line number Diff line change
@@ -1,31 +1,48 @@
# Wrapper Script for ChangeLog Verification
param (
[String]$ChangeLogLocation,
[String]$VersionString,
[string]$PackageName,
[string]$ServiceName,
[string]$RepoRoot,
[ValidateSet("net","java","js","python")]
[string]$Language,
[string]$RepoName,
[boolean]$ForRelease=$False
[String]$ChangeLogLocation,
[String]$VersionString,
[string]$PackageName,
[string]$ServiceName,
[string]$RepoRoot,
[ValidateSet("net", "java", "js", "python")]
[string]$Language,
[string]$RepoName,
[boolean]$ForRelease = $False
)

$ProgressPreference = "SilentlyContinue"
. (Join-Path $PSScriptRoot SemVer.ps1)
Import-Module (Join-Path $PSScriptRoot modules ChangeLog-Operations.psm1)

if ((Test-Path $ChangeLogLocation) -and -not([System.String]::IsNullOrEmpty($VersionString)))
$validChangeLog = $false
if ($ChangeLogLocation -and $VersionString)
{
Confirm-ChangeLogEntry -ChangeLogLocation $ChangeLogLocation -VersionString $VersionString -ForRelease $ForRelease
$validChangeLog = Confirm-ChangeLogEntry -ChangeLogLocation $ChangeLogLocation -VersionString $VersionString -ForRelease $ForRelease
}
else
else
{
Import-Module (Join-Path $PSScriptRoot modules Package-Properties.psm1)
if ([System.String]::IsNullOrEmpty($Language))
Import-Module (Join-Path $PSScriptRoot modules Package-Properties.psm1)
if ([System.String]::IsNullOrEmpty($Language))
{
if ($RepoName -match "azure-sdk-for-(?<lang>[^-]+)")
{
$Language = $RepoName.Substring($RepoName.LastIndexOf('-') + 1)
$Language = $matches["lang"]
}
else
{
Write-Error "Failed to set Language automatically. Please pass the appropriate Language as a parameter."
exit 1
}
}

$PackageProp = Get-PkgProperties -PackageName $PackageName -ServiceName $ServiceName -Language $Language -RepoRoot $RepoRoot
$validChangeLog = Confirm-ChangeLogEntry -ChangeLogLocation $PackageProp.pkgChangeLogPath -VersionString $PackageProp.pkgVersion -ForRelease $ForRelease
}

if (!$validChangeLog)
{
exit 1
}

$PackageProp = Get-PkgProperties -PackageName $PackageName -ServiceName $ServiceName -Language $Language -RepoRoot $RepoRoot
Confirm-ChangeLogEntry -ChangeLogLocation $PackageProp.pkgChangeLogPath -VersionString $PackageProp.pkgVersion -ForRelease $ForRelease
}
exit 0
Loading

0 comments on commit 4875a2e

Please sign in to comment.