Skip to content

Commit 25386e9

Browse files
azure-sdkbenbp
andauthored
Sync eng/common directory with azure-sdk-tools for PR 1585 (Azure#15327)
* Sparse checkout docs repository in release step * Detect default branch for custom sparse checkout repository * Use sparse checkout paths parameter in docs metadata release Co-authored-by: Ben Broderick Phillips <bebroder@microsoft.com>
1 parent 572ddfc commit 25386e9

File tree

2 files changed

+80
-27
lines changed

2 files changed

+80
-27
lines changed

eng/common/pipelines/templates/steps/docs-metadata-release.yml

Lines changed: 77 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,65 @@
11
# intended to be used as part of a release process
22
parameters:
3-
ArtifactLocation: 'not-specified'
4-
PackageRepository: 'not-specified'
5-
ReleaseSha: 'not-specified'
6-
RepoId: $(Build.Repository.Name)
7-
WorkingDirectory: ''
8-
ScriptDirectory: eng/common/scripts
9-
TargetDocRepoName: ''
10-
TargetDocRepoOwner: ''
11-
PRBranchName: 'master-rdme'
12-
PRLabels: 'auto-merge'
13-
ArtifactName: ''
14-
Language: ''
15-
DocRepoDestinationPath: '' #usually docs-ref-services/
16-
CIConfigs: '[]'
17-
GHReviewersVariable: ''
18-
GHTeamReviewersVariable: '' # externally set, as eng-common does not have the identity-resolver. Run as pre-step
19-
OnboardingBranch: ''
20-
CloseAfterOpenForTesting: false
21-
SkipPackageJson: false
3+
- name: ArtifactLocation
4+
type: string
5+
default: 'not-specified'
6+
- name: PackageRepository
7+
type: string
8+
default: 'not-specified'
9+
- name: ReleaseSha
10+
type: string
11+
default: 'not-specified'
12+
- name: RepoId
13+
type: string
14+
default: $(Build.Repository.Name)
15+
- name: WorkingDirectory
16+
type: string
17+
default: ''
18+
- name: ScriptDirectory
19+
type: string
20+
default: eng/common/scripts
21+
- name: TargetDocRepoName
22+
type: string
23+
default: ''
24+
- name: TargetDocRepoOwner
25+
type: string
26+
default: ''
27+
- name: PRBranchName
28+
type: string
29+
default: 'master-rdme'
30+
- name: PRLabels
31+
type: string
32+
default: 'auto-merge'
33+
- name: ArtifactName
34+
type: string
35+
default: ''
36+
- name: Language
37+
type: string
38+
default: ''
39+
- name: DocRepoDestinationPath
40+
type: string
41+
default: '' #usually docs-ref-services/
42+
- name: CIConfigs
43+
type: string
44+
default: '[]'
45+
- name: GHReviewersVariable
46+
type: string
47+
default: ''
48+
- name: GHTeamReviewersVariable
49+
type: string
50+
default: '' # externally set, as eng-common does not have the identity-resolver. Run as pre-step
51+
- name: OnboardingBranch
52+
type: string
53+
default: ''
54+
- name: CloseAfterOpenForTesting
55+
type: boolean
56+
default: false
57+
- name: SkipPackageJson
58+
type: object
59+
default: false
60+
- name: SparseCheckoutPaths
61+
type: object
62+
default: null
2263

2364
steps:
2465
- pwsh: |
@@ -30,14 +71,25 @@ steps:
3071
Write-Host "This script is not executing on Windows, skipping registry modification."
3172
}
3273
displayName: Enable Long Paths if Necessary
33-
34-
- pwsh: |
35-
git clone https://github.com/${{ parameters.TargetDocRepoOwner }}/${{ parameters.TargetDocRepoName }} ${{ parameters.WorkingDirectory }}/repo
36-
displayName: Clone Documentation Repository
37-
ignoreLASTEXITCODE: false
74+
75+
- ${{ if not(parameters.SparseCheckoutPaths) }}:
76+
- pwsh: |
77+
git clone https://github.com/${{ parameters.TargetDocRepoOwner }}/${{ parameters.TargetDocRepoName }} ${{ parameters.WorkingDirectory }}/repo
78+
displayName: Clone Documentation Repository
79+
ignoreLASTEXITCODE: false
80+
81+
- ${{ if parameters.SparseCheckoutPaths }}:
82+
- template: /eng/common/pipelines/templates/steps/sparse-checkout.yml
83+
parameters:
84+
SkipDefaultCheckout: true
85+
Repositories:
86+
- Name: ${{ parameters.TargetDocRepoOwner }}/${{ parameters.TargetDocRepoName }}
87+
WorkingDirectory: ${{ parameters.WorkingDirectory }}/repo
88+
Paths: ${{ parameters.SparseCheckoutPaths }}
89+
3890
- template: /eng/common/pipelines/templates/steps/set-default-branch.yml
3991
parameters:
40-
WorkingDirectory: ${{ parameters.WorkingDirectory }}/repo
92+
WorkingDirectory: ${{ parameters.WorkingDirectory }}/repo
4193
- task: PowerShell@2
4294
displayName: 'Apply Documentation Updates From Artifact'
4395
inputs:

eng/common/pipelines/templates/steps/sparse-checkout.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ steps:
3232
displayName: Init sparse checkout ${{ repo.Name }}
3333
workingDirectory: ${{ coalesce(repo.WorkingDirectory, format('{0}/{1}', '$(System.DefaultWorkingDirectory)', repo.Name)) }}
3434
35-
- pwsh: git checkout ${{ repo.Commitish }}
36-
displayName: Sparse checkout at ${{ repo.Commitish }}
35+
- pwsh: |
36+
git checkout ${{ repo.Commitish }} # this will use the default branch if repo.Commitish is empty
37+
displayName: Sparse checkout at ${{ coalesce(repo.Commitish, 'default branch') }}
3738
workingDirectory: ${{ coalesce(repo.WorkingDirectory, format('{0}/{1}', '$(System.DefaultWorkingDirectory)', repo.Name)) }}

0 commit comments

Comments
 (0)