Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
74 commits
Select commit Hold shift + click to select a range
300fbe7
Add dev version to Save-Package-Properties.ps1 and includd in build p…
danieljurek May 27, 2021
0ce3ba4
Now with fewer pipelines
danieljurek May 27, 2021
27c1584
Add daily docs.ms work to docindex.yml
danieljurek May 28, 2021
085dee2
Update-DocsMsMetadata and required functions
danieljurek Jun 4, 2021
b4f8b20
Common
danieljurek Jun 4, 2021
e4e7758
Docs meatadata release and daily docs build
danieljurek Jun 4, 2021
91ebcaa
eq
danieljurek Jun 4, 2021
7003acd
Loop over artifacts in paramaters.Artifacts
danieljurek Jun 4, 2021
922cc5e
Add PackageInfo to path
danieljurek Jun 4, 2021
98c861f
download: current
danieljurek Jun 7, 2021
ef16a12
Output artifacts
danieljurek Jun 7, 2021
0095868
Pool
danieljurek Jun 7, 2021
8ff7607
Use relative paths in package properties json file and use dev versio…
danieljurek Jun 8, 2021
9da3bb3
Skip checking out docs repo if it's already checked out
danieljurek Jun 8, 2021
e2621cc
Don't overcomplicate docs-metadata-release.yml
danieljurek Jun 8, 2021
b00629f
With parameters properly defined and redundant logic removed
danieljurek Jun 8, 2021
58f8600
Use TargetBranchName
danieljurek Jun 8, 2021
8c33ab7
Retain original version to differentiate where metadata and readme do…
danieljurek Jun 8, 2021
dd23cf7
Add docs repo support for GetDocsMetadata: first cut
danieljurek Jun 8, 2021
470c513
Sparse checkout needs to include metadata
danieljurek Jun 8, 2021
883168e
Add metadata from packages that aren't tracked in the CSV file yet
danieljurek Jun 9, 2021
de4d311
Use "dev" if the package has a "dev" version in JS. This will not wor…
danieljurek Jun 9, 2021
87e8e91
Refactor and use sparse checkout everywhere
danieljurek Jun 10, 2021
c7c8775
Refactor long path support
danieljurek Jun 10, 2021
01b6242
Correct path
danieljurek Jun 10, 2021
1d75a0a
Parameter names
danieljurek Jun 10, 2021
7a9d3a8
Remove unnecessary parameter
danieljurek Jun 10, 2021
e0a2a9b
Close quote
danieljurek Jun 10, 2021
d67ae0a
Add pipeline starting
danieljurek Jun 15, 2021
f7ac5f7
Keep the single quotes
danieljurek Jun 15, 2021
f691c23
Output link to CI build
danieljurek Jun 15, 2021
93f617e
Refactor:
danieljurek Jun 15, 2021
733eaf8
Apply suggestions from code review
danieljurek Jun 16, 2021
f9314e9
Review feedback: Save-Package-Properties.ps1
danieljurek Jun 21, 2021
3e5a09b
Add ability to specify variable name for default branch
danieljurek Jun 21, 2021
9b98ef7
Try convertToJson
danieljurek Jun 21, 2021
f831a49
Tab scope
danieljurek Jun 21, 2021
ac1fb20
Do doc artifact info loop in Update-DocsMsMetadata.ps1 instead of yam…
danieljurek Jun 21, 2021
6b174e5
Single quotes
danieljurek Jun 21, 2021
75f6e81
Remove template loop
danieljurek Jun 21, 2021
4db6e89
Remove extra template references
danieljurek Jun 21, 2021
8124235
Move convertToJson
danieljurek Jun 21, 2021
50349d8
Try different formatting given convertToJson
danieljurek Jun 21, 2021
7f0f8b9
Reverse Update-DocsMsMetadata.ps1 to operate on a single object. Loop…
danieljurek Jun 21, 2021
969c0dd
Loop in yaml, Rename Update-DocsMsMetadata parameter
danieljurek Jun 21, 2021
f85ebce
Try re-formatting yaml
danieljurek Jun 21, 2021
01a1c34
Spell parameters properly
danieljurek Jun 21, 2021
64c69a8
Missing backtick
danieljurek Jun 21, 2021
edd9215
Remove extra logging
danieljurek Jun 21, 2021
c12283a
First cut at default implementation
danieljurek Jun 21, 2021
05dfffb
Move business logic inside Update-DocsMsMetadata.ps1, PowerShell can …
danieljurek Jun 22, 2021
d8bcc2a
Use proper function name
danieljurek Jun 23, 2021
8ea8dab
PackageProps has a DevVersion
danieljurek Jun 23, 2021
8ea7c19
No DefaultImplementation in this change. This should be part of a wid…
danieljurek Jun 28, 2021
e14e5a5
Straggling master -> main rename
danieljurek Jun 28, 2021
0cada0d
Merge branch 'main' into djurek/daily-ref-docs-2
danieljurek Jun 28, 2021
4b940d4
Use existing devops starting logic
danieljurek Jun 28, 2021
0d9a9df
Remove extra condition
danieljurek Jun 28, 2021
b2103a2
Fix backslashes
danieljurek Jun 28, 2021
44b6ebc
Correct number of backslashes
danieljurek Jun 28, 2021
428f8d5
Use variable for branch name
danieljurek Jun 28, 2021
44754a2
Update eng/scripts/Language-Settings.ps1
danieljurek Jun 29, 2021
cd44528
Review feedback
danieljurek Jun 29, 2021
abcea10
Do not replace the default branch with the tag in links when doing a …
danieljurek Jun 29, 2021
b054eb3
Conditions on docs version for template project
danieljurek Jun 29, 2021
2871f74
Do not run PublishDocsToNightlyBranch if TestPipeline is true
danieljurek Jun 29, 2021
581e30d
Merge branch 'main' into djurek/daily-ref-docs-2
danieljurek Jun 30, 2021
0067a24
Merge branch 'main' into djurek/daily-ref-docs-2
danieljurek Jun 30, 2021
3f909d6
Performance improvements, switch to Linux to take advantage of paths …
danieljurek Jun 30, 2021
c770216
Add markdown files to sparse checkout
danieljurek Jun 30, 2021
8f707a9
Reproduce failure for template publishing
danieljurek Jun 30, 2021
a16c00e
Remove eng, it's already there by default
danieljurek Jul 1, 2021
2e03f12
Fix instances where metadata might not be available because of filter…
danieljurek Jul 1, 2021
57dd780
Merge branch 'main' into djurek/daily-ref-docs-2
danieljurek Jul 1, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 15 additions & 6 deletions eng/common/scripts/Update-DocsMsMetadata.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,16 @@ $releaseReplaceRegex = "(https://github.com/$RepoId/(?:blob|tree)/)(?:master|mai
$TITLE_REGEX = "(\#\s+(?<filetitle>Azure .+? (?:client|plugin|shared) library for (?:JavaScript|Java|Python|\.NET|C)))"

function GetAdjustedReadmeContent($ReadmeContent, $PackageInfo, $PackageMetadata) {
# Normalize service name "Key Vault" -> "keyvault"
# TODO: Use taxonomy for service name -- https://github.com/Azure/azure-sdk-tools/issues/1442
# probably from metadata
$service = $PackageMetadata.ServiceName.ToLower().Replace(" ", "")
# The $PackageMetadata could be $null if there is no associated metadata entry
# based on how the metadata CSV is filtered
$service = $PackageInfo.ServiceDirectory.ToLower()
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
# probably from metadata
$service = $PackageMetadata.ServiceName.ToLower().Replace(" ", "")
}

# Generate the release tag for use in link substitution
$tag = "$($PackageInfo.Name)_$($PackageInfo.Version)"
$date = Get-Date -Format "MM/dd/yyyy"
Expand Down Expand Up @@ -110,11 +116,14 @@ function UpdateDocsMsMetadataForPackage($packageInfoJsonLocation) {

$packageMetadataArray = (Get-CSVMetadata).Where({ $_.Package -eq $packageInfo.Name -and $_.GroupId -eq $packageInfo.Group -and $_.Hide -ne 'true' -and $_.New -eq 'true' })
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure if this is going to come into play here yet but if we ever enable strict mode .GroupId will fail because it only exists on some language objects.

if ($packageMetadataArray.Count -eq 0) {
LogError "Could not retrieve metadata for $($packageInfo.Name) from metadata CSV"
LogWarning "Could not retrieve metadata for $($packageInfo.Name) from metadata CSV. Using best effort defaults."
$packageMetadata = $null
} elseif ($packageMetadataArray.Count -gt 1) {
LogWarning "Multiple metadata entries for $($packageInfo.Name) in metadata CSV. Using first entry."
$packageMetadata = $packageMetadataArray[0]
} else {
$packageMetadata = $packageMetadataArray[0]
}
$packageMetadata = $packageMetadataArray[0]

$readmeContent = Get-Content $packageInfo.ReadMePath -Raw
$outputReadmeContent = ""
Expand Down
43 changes: 43 additions & 0 deletions eng/pipelines/docindex.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ jobs:
Paths:
- ci-configs/packages-latest.json
- ci-configs/packages-preview.json
- metadata/
Repositories:
- Name: $(DocRepoOwner)/$(DocRepoName)
WorkingDirectory: $(DocRepoLocation)
Expand All @@ -43,3 +44,45 @@ jobs:
TargetRepoName: $(DocRepoName)
TargetRepoOwner: $(DocRepoOwner)
WorkingDirectory: $(DocRepoLocation)

# Prepare daily docs CI
- template: /eng/common/pipelines/templates/steps/set-daily-docs-branch-name.yml
parameters:
DailyBranchVariableName: DailyDocsBranchName
- pwsh: |
$ErrorActionPreference = "Continue"
git checkout "origin/$(DailyDocsBranchName)" 2>&1 | Out-Null
$LASTEXITCODE = 0 # This ignores any error from git checkout
git status
displayName: Checkout daily branch if it exists
workingDirectory: $(DocRepoLocation)
- task: Powershell@2
inputs:
pwsh: true
filePath: eng/common/scripts/Update-DocsMsPackages.ps1
arguments: -DocRepoLocation $(DocRepoLocation)
displayName: Update Docs Onboarding for Daily branch
- template: /eng/common/pipelines/templates/steps/git-push-changes.yml
parameters:
BaseRepoBranch: $(DailyDocsBranchName)
BaseRepoOwner: $(DocRepoOwner)
CommitMsg: "Update targeting packages based on release metadata. (Daily docs)"
TargetRepoName: $(DocRepoName)
TargetRepoOwner: $(DocRepoOwner)
WorkingDirectory: $(DocRepoLocation)
ScriptDirectory: $(Build.SourcesDirectory)/eng/common/scripts

- task: PowerShell@2
displayName: Queue Docs CI build
inputs:
pwsh: true
filePath: eng/common/scripts/Queue-Pipeline.ps1
# SourceBranch must be "master" as this repo is managed by the docs
# team and will be updated according to their timeline.
arguments: >
-Organization "apidrop"
-Project "Content%20CI"
-SourceBranch "master"
-DefinitionId 3452
-Base64EncodedAuthToken "$(azuresdk-apidrop-devops-queue-build-pat)"
-BuildParametersJson '{"params":"{ \"target_repo\": { \"url\": \"https://github.com/MicrosoftDocs/azure-docs-sdk-node\", \"branch\": \"$(DailyDocsBranchName)\", \"folder\": \"./\" }, \"source_repos\": [] }"}'
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: potential future follow-up, it would be get it storing this as yml and using convertToJson worked on it to make this more readable and maintainable.

66 changes: 44 additions & 22 deletions eng/pipelines/templates/stages/archetype-js-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -108,40 +108,31 @@ stages:
dependsOn: PublishPackage

pool:
name: azsdk-pool-mms-win-2019-general
vmImage: MMS2019
variables:
CIConfigs: "{'targets':[{'path_to_config':'ci-configs/packages-preview.json','Mode':'Preview','content_folder':'docs-ref-services/preview'},{'path_to_config':'ci-configs/packages-latest.json','mode':'Latest','content_folder':'docs-ref-services/latest'}]}"
name: azsdk-pool-mms-ubuntu-2004-general
vmImage: MMSUbuntu20.04

strategy:
runOnce:
deploy:
steps:
- checkout: self
- pwsh: |
Get-ChildItem -Recurse ${{parameters.ArtifactName}}/${{artifact.name}}
workingDirectory: $(Pipeline.Workspace)
displayName: Output Visible Artifacts
- template: /eng/common/pipelines/templates/steps/get-pr-owners.yml
- template: /eng/common/pipelines/templates/steps/sparse-checkout.yml
parameters:
TargetVariable: "OwningGHUser"
ServiceDirectory: ${{parameters.ServiceDirectory}}
- template: /eng/common/pipelines/templates/steps/docs-metadata-release.yml
SkipDefaultCheckout: true
Paths:
- sdk/**/*.md
- download: current
- template: /eng/common/pipelines/templates/steps/update-docsms-metadata.yml
parameters:
ArtifactLocation: $(Pipeline.Workspace)/${{parameters.ArtifactName}}/${{artifact.name}}
PackageRepository: NPM
ReleaseSha: $(Build.SourceVersion)
PackageInfoLocations:
- $(Pipeline.Workspace)/${{parameters.ArtifactName}}/PackageInfo/${{artifact.name}}.json
RepoId: Azure/azure-sdk-for-js
WorkingDirectory: $(System.DefaultWorkingDirectory)
TargetDocRepoOwner: ${{parameters.TargetDocRepoOwner}}
TargetDocRepoName: ${{parameters.TargetDocRepoName}}
PRBranchName: onboarding-${{artifact.name}}-$(Build.BuildId)
ArtifactName: ${{artifact.name}}
Language: 'javascript'
DocRepoDestinationPath: 'docs-ref-services/'
GHReviewersVariable: 'OwningGHUser'
CIConfigs: $(CIConfigs)
CloseAfterOpenForTesting: '${{ parameters.TestPipeline }}'
SparseCheckoutPaths:
- docs-ref-services/
- metadata/

- ${{if ne(artifact.skipPublishDocGithubIo, 'true')}}:
- deployment: PublishDocsGitHubIO
Expand Down Expand Up @@ -255,3 +246,34 @@ stages:
targetType: filePath
filePath: "eng/tools/publish-to-npm.ps1"
arguments: '-pathToArtifacts $(Package.Archive) -accessLevel "public" -tag "dev" -registry "$(Registry)" -npmToken "$(NpmToken)"'

- job: PublishDocsToNightlyBranch
condition: or(eq(variables['SetDevVersion'], 'true'), and(eq(variables['SetDevVersion'], ''), eq(variables['Build.Reason'],'Schedule'), eq(variables['System.TeamProject'], 'internal')))
pool:
name: azsdk-pool-mms-ubuntu-2004-general
vmImage: MMSUbuntu20.04
steps:
- template: /eng/common/pipelines/templates/steps/sparse-checkout.yml
parameters:
SkipDefaultCheckout: true
Paths:
- sdk/**/*.md
- download: current
- pwsh: |
Get-ChildItem -Recurse $(Pipeline.Workspace)/${{parameters.ArtifactName}}/
displayName: Show visible artifacts

- template: /eng/common/pipelines/templates/steps/update-docsms-metadata.yml
parameters:
PackageInfoLocations:
- ${{ each artifact in parameters.Artifacts }}:
- $(Pipeline.Workspace)/${{parameters.ArtifactName}}/PackageInfo/${{artifact.name}}.json
RepoId: Azure/azure-sdk-for-js
WorkingDirectory: $(System.DefaultWorkingDirectory)
TargetDocRepoOwner: ${{parameters.TargetDocRepoOwner}}
TargetDocRepoName: ${{parameters.TargetDocRepoName}}
Language: 'javascript'
DailyDocsBuild: true
SparseCheckoutPaths:
- docs-ref-services/
- metadata/
12 changes: 12 additions & 0 deletions eng/pipelines/templates/steps/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,18 @@ steps:
condition: and(succeeded(),eq(variables['SetDevVersion'],'true'))
displayName: "Update package versions for dev build"

- task: Powershell@2
inputs:
filePath: $(Build.SourcesDirectory)/eng/common/scripts/Save-Package-Properties.ps1
arguments: >
-ServiceDirectory ${{parameters.ServiceDirectory}}
-OutDirectory $(Build.ArtifactStagingDirectory)/PackageInfo
-AddDevVersion
pwsh: true
workingDirectory: $(Pipeline.Workspace)
displayName: Update package properties with dev version
condition: and(succeeded(),eq(variables['SetDevVersion'],'true'))

- script: |
node common/scripts/install-run-rush.js install
condition: and(succeeded(),ne(variables['SetDevVersion'],'true'))
Expand Down
18 changes: 18 additions & 0 deletions eng/scripts/Language-Settings.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,24 @@ function Get-javascript-PackageInfoFromPackageFile ($pkg, $workingDirectory)
return $resultObj
}

function Get-javascript-DocsMsMetadataForPackage($PackageInfo) {
New-Object PSObject -Property @{
DocsMsReadMeName = $PackageInfo.Name -replace "^@azure/" , ""
LatestReadMeLocation = 'docs-ref-services/latest'
PreviewReadMeLocation = 'docs-ref-services/preview'
Suffix = ''
}
}

# In the case of NPM packages, the "dev version" produced for the given build
# may not have been published if the code is identical to the code already
# published at the "dev" tag. To prevent using a version which does not exist in
# NPM, use the "dev" tag instead.
function Get-javascript-DocsMsDevLanguageSpecificPackageInfo($packageInfo) {
$packageInfo.Version = 'dev'
return $packageInfo
}

# Stage and Upload Docs to blob Storage
function Publish-javascript-GithubIODocs ($DocLocation, $PublicArtifactLocation)
{
Expand Down