Skip to content

Commit bd16c42

Browse files
authored
Setup a pipeline job for publishing Docs to daily branch. (Azure#20809)
1 parent 1ded429 commit bd16c42

File tree

2 files changed

+89
-46
lines changed

2 files changed

+89
-46
lines changed

eng/pipelines/templates/stages/archetype-python-release.yml

Lines changed: 64 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -142,52 +142,38 @@ stages:
142142
# we override the regular script path because we have cloned the build tools repo as a separate artifact.
143143
ScriptPath: 'eng/common/scripts/copy-docs-to-blobstorage.ps1'
144144

145-
- ${{if ne(artifact.skipPublishDocGithubIo, 'true')}}:
146-
- deployment: PublishDocs
147-
displayName: "Docs.MS Release"
148-
condition: and(succeeded(), ne(variables['Skip.PublishDocs'], 'true'))
149-
environment: githubio
150-
dependsOn: PublishPackage
151-
152-
pool:
153-
name: azsdk-pool-mms-ubuntu-2004-general
154-
vmImage: MMSUbuntu20.04
155-
156-
variables:
157-
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'}]}"
158-
159-
strategy:
160-
runOnce:
161-
deploy:
162-
steps:
163-
- checkout: self
164-
165-
- pwsh: |
166-
Get-ChildItem -Recurse $(Pipeline.Workspace)/${{parameters.ArtifactName}}/${{artifact.name}}
167-
workingDirectory: $(Pipeline.Workspace)
168-
displayName: Output Visible Artifacts
169-
170-
- template: /eng/common/pipelines/templates/steps/get-pr-owners.yml
171-
parameters:
172-
TargetVariable: "OwningGHUser"
173-
ServiceDirectory: ${{parameters.ServiceDirectory}}
174-
175-
- template: /eng/common/pipelines/templates/steps/docs-metadata-release.yml
176-
parameters:
177-
ArtifactLocation: $(Pipeline.Workspace)/${{parameters.ArtifactName}}/${{artifact.name}}
178-
PackageRepository: PyPI
179-
ReleaseSha: $(Build.SourceVersion)
180-
RepoId: Azure/azure-sdk-for-python
181-
WorkingDirectory: $(System.DefaultWorkingDirectory)
182-
TargetDocRepoOwner: ${{parameters.TargetDocRepoOwner}}
183-
TargetDocRepoName: ${{parameters.TargetDocRepoName}}
184-
PRBranchName: onboarding-${{artifact.name}}-$(Build.BuildId)
185-
ArtifactName: ${{artifact.name}}
186-
Language: 'python'
187-
DocRepoDestinationPath: 'docs-ref-services/'
188-
GHReviewersVariable: 'OwningGHUser'
189-
CIConfigs: $(CIConfigs)
190-
CloseAfterOpenForTesting: '${{ parameters.TestPipeline }}'
145+
- ${{if ne(artifact.skipPublishDocMs, 'true')}}:
146+
- deployment: PublishDocs
147+
displayName: Docs.MS Release
148+
condition: and(succeeded(), ne(variables['Skip.PublishDocs'], 'true'))
149+
environment: githubio
150+
dependsOn: PublishPackage
151+
152+
pool:
153+
name: azsdk-pool-mms-ubuntu-2004-general
154+
vmImage: MMSUbuntu20.04
155+
156+
strategy:
157+
runOnce:
158+
deploy:
159+
steps:
160+
- template: /eng/common/pipelines/templates/steps/sparse-checkout.yml
161+
parameters:
162+
SkipDefaultCheckout: true
163+
Paths:
164+
- sdk/**/*.md
165+
- download: current
166+
- template: /eng/common/pipelines/templates/steps/update-docsms-metadata.yml
167+
parameters:
168+
PackageInfoLocations:
169+
- $(Pipeline.Workspace)/${{parameters.ArtifactName}}/PackageInfo/${{artifact.name}}.json
170+
WorkingDirectory: $(System.DefaultWorkingDirectory)
171+
TargetDocRepoOwner: ${{parameters.TargetDocRepoOwner}}
172+
TargetDocRepoName: ${{parameters.TargetDocRepoName}}
173+
Language: 'python'
174+
SparseCheckoutPaths:
175+
- docs-ref-services/
176+
- metadata/
191177

192178
- ${{if ne(artifact.skipPublishDocGithubIo, 'true')}}:
193179
- deployment: UpdatePackageVersion
@@ -271,3 +257,35 @@ stages:
271257
twine upload --repository $(DevFeedName) --config-file $(PYPIRC_PATH) $(Pipeline.Workspace)/${{parameters.ArtifactName}}/${{artifact.name}}/*-*a*.zip
272258
echo "Uploaded sdist to devops feed $(DevFeedName)"
273259
displayName: 'Publish ${{artifact.name}} alpha package'
260+
261+
- job: PublishDocsToNightlyBranch
262+
dependsOn: PublishPackages
263+
condition: or(eq(variables['SetDevVersion'], 'true'), and(eq(variables['Build.Reason'],'Schedule'), eq(variables['System.TeamProject'], 'internal')))
264+
pool:
265+
name: azsdk-pool-mms-ubuntu-2004-general
266+
vmImage: MMSUbuntu20.04
267+
steps:
268+
- template: /eng/common/pipelines/templates/steps/sparse-checkout.yml
269+
parameters:
270+
SkipDefaultCheckout: true
271+
Paths:
272+
- sdk/**/*.md
273+
- download: current
274+
- pwsh: |
275+
Get-ChildItem -Recurse $(Pipeline.Workspace)/${{parameters.ArtifactName}}/
276+
displayName: Show visible artifacts
277+
278+
- template: /eng/common/pipelines/templates/steps/update-docsms-metadata.yml
279+
parameters:
280+
PackageInfoLocations:
281+
- ${{ each artifact in parameters.Artifacts }}:
282+
- ${{if ne(artifact.skipPublishDocMs, 'true')}}:
283+
- $(Pipeline.Workspace)/${{parameters.ArtifactName}}/PackageInfo/${{artifact.name}}.json
284+
WorkingDirectory: $(System.DefaultWorkingDirectory)
285+
TargetDocRepoOwner: ${{parameters.TargetDocRepoOwner}}
286+
TargetDocRepoName: ${{parameters.TargetDocRepoName}}
287+
Language: 'python'
288+
DailyDocsBuild: true
289+
SparseCheckoutPaths:
290+
- docs-ref-services/
291+
- metadata/

eng/scripts/Language-Settings.ps1

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,7 @@ $PackageExclusions = @{
214214
'azure-monitor-query' = 'Unsupported doc directives https://github.com/Azure/azure-sdk-for-python/issues/19417';
215215
'azure-mgmt-network' = 'Manual process used to build';
216216
}
217+
217218
function Update-python-DocsMsPackages($DocsRepoLocation, $DocsMetadata) {
218219
Write-Host "Excluded packages:"
219220
foreach ($excludedPackage in $PackageExclusions.Keys) {
@@ -449,3 +450,27 @@ function GetExistingPackageVersions ($PackageName, $GroupId=$null)
449450
return $null
450451
}
451452
}
453+
454+
function Get-python-DocsMsMetadataForPackage($PackageInfo) {
455+
$readmeName = $PackageInfo.Name.ToLower()
456+
Write-Host "Docs.ms Readme name: $($readmeName)"
457+
458+
# Readme names (which are used in the URL) should not include redundant terms
459+
# when viewed in URL form. For example:
460+
# https://docs.microsoft.com/en-us/dotnet/api/overview/azure/storage-blobs-readme
461+
# Note how the end of the URL doesn't look like:
462+
# ".../azure/azure-storage-blobs-readme"
463+
464+
# This logic eliminates a preceeding "azure." in the readme filename.
465+
# "azure-storage-blobs" -> "storage-blobs"
466+
if ($readmeName.StartsWith('azure-')) {
467+
$readmeName = $readmeName.Substring(6)
468+
}
469+
470+
New-Object PSObject -Property @{
471+
DocsMsReadMeName = $readmeName
472+
LatestReadMeLocation = 'docs-ref-services/latest'
473+
PreviewReadMeLocation = 'docs-ref-services/preview'
474+
Suffix = ''
475+
}
476+
}

0 commit comments

Comments
 (0)