Skip to content

Commit

Permalink
Make changes to the workflow.
Browse files Browse the repository at this point in the history
  • Loading branch information
sima-zhu committed Oct 19, 2021
1 parent 539ff76 commit 0577b76
Show file tree
Hide file tree
Showing 4 changed files with 80 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ parameters:
- name: SparseCheckoutPaths
type: object
default: null

steps:
- pwsh: |
if ($IsWindows) {
Expand Down Expand Up @@ -104,6 +103,7 @@ steps:
-DocRepoLocation "${{ parameters.WorkingDirectory }}/repo"
-Language "${{parameters.Language}}"
-Configs "${{ parameters.CIConfigs }}"
-VsoVariable "${{ parameters.GHReviewersVariable }}"
pwsh: true
env:
GH_TOKEN: $(azuresdk-github-pat)
Expand Down
31 changes: 31 additions & 0 deletions eng/common/pipelines/templates/steps/update-docsms-metadata.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ parameters:
type: object
default:
- '**'
- name: TargetVariable
type: string
default: ''

steps:
- template: /eng/common/pipelines/templates/steps/enable-long-path-support.yml
Expand All @@ -41,6 +44,33 @@ steps:
- Name: ${{ parameters.TargetDocRepoOwner }}/${{ parameters.TargetDocRepoName }}
WorkingDirectory: $(DocRepoLocation)
Paths: ${{ parameters.SparseCheckoutPaths }}
- pwsh: |
git clone https://github.com/Azure/azure-sdk-tools.git $(Build.SourcesDirectory)/tools_repo
cd $(Build.SourcesDirectory)/tools_repo
git checkout azure-sdk-tools_20210114.1
displayName: Setup Identity Resolver

- pwsh: |
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-name "$(Build.QueuedBy)" `
--identity-email "$(Build.RequestedForEmail)" `
--targetvar "${{ parameters.TargetVariable }}"
displayName: 'Resolving Queuing User'
continueOnError: true
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)

# If performing a daily docs build set the $(TargetBranchName) to a daily branch
# name and attempt to checkout the daily docs branch. If the branch doesn't
Expand Down Expand Up @@ -82,6 +112,7 @@ steps:
-DocRepoLocation "$(DocRepoLocation)" `
-Language '${{parameters.Language}}' `
-RepoId '${{ parameters.RepoId }}'
-VsoVariable '${{ parameters.TargetVariable }}'
displayName: Apply Documentation Updates

- template: /eng/common/pipelines/templates/steps/git-push-changes.yml
Expand Down
32 changes: 27 additions & 5 deletions eng/common/scripts/Update-DocsMsMetadata.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,13 @@ Location of the root of the docs.microsoft.com reference doc location. Further
path information is provided by $GetDocsMsMetadataForPackageFn
.PARAMETER Language
Programming language to supply to metadata
Programming language to supply to metadata. It can default to the variable of 'Language' in Language-Setting.ps1.
.PARAMETER RepoId
GitHub repository ID of the SDK. Typically of the form: 'Azure/azure-sdk-for-js'
.PARAMETER VsoVariable
Devops github owner info output variable
#>

param(
Expand All @@ -37,11 +39,14 @@ param(
[Parameter(Mandatory = $true)]
[string]$DocRepoLocation,

[Parameter(Mandatory = $true)]
[Parameter(Mandatory = $false)]
[string]$Language,

[Parameter(Mandatory = $true)]
[string]$RepoId
[string]$RepoId,

[Parameter(Mandatory = $false)]
[string]$VsoVariable
)

. (Join-Path $PSScriptRoot common.ps1)
Expand All @@ -53,6 +58,23 @@ function GetAdjustedReadmeContent($ReadmeContent, $PackageInfo, $PackageMetadata
# The $PackageMetadata could be $null if there is no associated metadata entry
# based on how the metadata CSV is filtered
$service = $PackageInfo.ServiceDirectory.ToLower()
Write-Host "Service name is $service."
if ($VsoVariable) {
$alreadyPresent = [System.Environment]::GetEnvironmentVariable($VsoVariable)

if ($alreadyPresent) {
$authorMetadataJson = $alreadyPresent | ConvertFrom-Json
}
}
$author = 'ramya-rao-a'
$msauthor = 'ramyar'
if ($authorMetadataJson) {
$author = $authorMetadataJson.GithubUserName
$msauthor = $authorMetadataJson.Alias
}

Write-Host "Doc author is $author."
Write-Host "Doc ms author is $msauthor."
if ($PackageMetadata -and $PackageMetadata.ServiceName) {
# Normalize service name "Key Vault" -> "keyvault"
# TODO: Use taxonomy for service name -- https://github.com/Azure/azure-sdk-tools/issues/1442
Expand Down Expand Up @@ -82,8 +104,8 @@ function GetAdjustedReadmeContent($ReadmeContent, $PackageInfo, $PackageMetadata
---
title: $foundTitle
keywords: Azure, $Language, SDK, API, $($PackageInfo.Name), $service
author: maggiepint
ms.author: magpint
author: $author
ms.author: $msauthor
ms.date: $date
ms.topic: reference
ms.prod: azure
Expand Down
24 changes: 21 additions & 3 deletions eng/common/scripts/update-docs-metadata.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@ param (
[Parameter(Mandatory = $true)]
$Language, # EG: js, java, dotnet. Used in language for the embedded readme.
[Parameter(Mandatory = $true)]
$Configs # The configuration elements informing important locations within the cloned doc repo
$Configs, # The configuration elements informing important locations within the cloned doc repo
[Parameter(Mandatory = $false)]
$VsoVariable # Devops github owner info output variable
)

. (Join-Path $PSScriptRoot common.ps1)
Expand Down Expand Up @@ -70,8 +72,24 @@ function GetAdjustedReadmeContent($pkgInfo){
# Replace github main link with release tag.
$ReplacementPattern = "`${1}$($pkgInfo.Tag)"
$fileContent = $fileContent -replace $releaseReplaceRegex, $ReplacementPattern

$header = "---`ntitle: $foundTitle`nkeywords: Azure, $Language, SDK, API, $($pkgInfo.PackageId), $service`nauthor: maggiepint`nms.author: magpint`nms.date: $date`nms.topic: reference`nms.prod: azure`nms.technology: azure`nms.devlang: $Language`nms.service: $service`n---`n"
Write-Host "Service name is $service."
if ($VsoVariable) {
$alreadyPresent = [System.Environment]::GetEnvironmentVariable($VsoVariable)

if ($alreadyPresent) {
$authorMetadataJson = $alreadyPresent | ConvertFrom-Json
}
}
$author = 'ramya-rao-a'
$msauthor = 'ramyar'
if ($authorMetadataJson) {
$author = $authorMetadataJson.GithubUserName
$msauthor = $authorMetadataJson.Alias
}

Write-Host "Doc author is $author."
Write-Host "Doc ms author is $msauthor."
$header = "---`ntitle: $foundTitle`nkeywords: Azure, $Language, SDK, API, $($pkgInfo.PackageId), $service`nauthor: $author`nms.author: $msauthor`nms.date: $date`nms.topic: reference`nms.prod: azure`nms.technology: azure`nms.devlang: $Language`nms.service: $service`n---`n"

if ($fileContent) {
return "$header`n$fileContent"
Expand Down

0 comments on commit 0577b76

Please sign in to comment.