Skip to content

Commit

Permalink
Sync eng/common directory with azure-sdk-tools for PR 1585 (#1758)
Browse files Browse the repository at this point in the history
* 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 <[email protected]>
  • Loading branch information
azure-sdk and benbp authored May 18, 2021
1 parent a6e490f commit 030cd9d
Show file tree
Hide file tree
Showing 2 changed files with 80 additions and 27 deletions.
102 changes: 77 additions & 25 deletions eng/common/pipelines/templates/steps/docs-metadata-release.yml
Original file line number Diff line number Diff line change
@@ -1,24 +1,65 @@
# intended to be used as part of a release process
parameters:
ArtifactLocation: 'not-specified'
PackageRepository: 'not-specified'
ReleaseSha: 'not-specified'
RepoId: $(Build.Repository.Name)
WorkingDirectory: ''
ScriptDirectory: eng/common/scripts
TargetDocRepoName: ''
TargetDocRepoOwner: ''
PRBranchName: 'master-rdme'
PRLabels: 'auto-merge'
ArtifactName: ''
Language: ''
DocRepoDestinationPath: '' #usually docs-ref-services/
CIConfigs: '[]'
GHReviewersVariable: ''
GHTeamReviewersVariable: '' # externally set, as eng-common does not have the identity-resolver. Run as pre-step
OnboardingBranch: ''
CloseAfterOpenForTesting: false
SkipPackageJson: false
- name: ArtifactLocation
type: string
default: 'not-specified'
- name: PackageRepository
type: string
default: 'not-specified'
- name: ReleaseSha
type: string
default: 'not-specified'
- name: RepoId
type: string
default: $(Build.Repository.Name)
- name: WorkingDirectory
type: string
default: ''
- name: ScriptDirectory
type: string
default: eng/common/scripts
- name: TargetDocRepoName
type: string
default: ''
- name: TargetDocRepoOwner
type: string
default: ''
- name: PRBranchName
type: string
default: 'master-rdme'
- name: PRLabels
type: string
default: 'auto-merge'
- name: ArtifactName
type: string
default: ''
- name: Language
type: string
default: ''
- name: DocRepoDestinationPath
type: string
default: '' #usually docs-ref-services/
- name: CIConfigs
type: string
default: '[]'
- name: GHReviewersVariable
type: string
default: ''
- name: GHTeamReviewersVariable
type: string
default: '' # externally set, as eng-common does not have the identity-resolver. Run as pre-step
- name: OnboardingBranch
type: string
default: ''
- name: CloseAfterOpenForTesting
type: boolean
default: false
- name: SkipPackageJson
type: object
default: false
- name: SparseCheckoutPaths
type: object
default: null

steps:
- pwsh: |
Expand All @@ -30,14 +71,25 @@ steps:
Write-Host "This script is not executing on Windows, skipping registry modification."
}
displayName: Enable Long Paths if Necessary

- pwsh: |
git clone https://github.com/${{ parameters.TargetDocRepoOwner }}/${{ parameters.TargetDocRepoName }} ${{ parameters.WorkingDirectory }}/repo
displayName: Clone Documentation Repository
ignoreLASTEXITCODE: false

- ${{ if not(parameters.SparseCheckoutPaths) }}:
- pwsh: |
git clone https://github.com/${{ parameters.TargetDocRepoOwner }}/${{ parameters.TargetDocRepoName }} ${{ parameters.WorkingDirectory }}/repo
displayName: Clone Documentation Repository
ignoreLASTEXITCODE: false
- ${{ if parameters.SparseCheckoutPaths }}:
- template: /eng/common/pipelines/templates/steps/sparse-checkout.yml
parameters:
SkipDefaultCheckout: true
Repositories:
- Name: ${{ parameters.TargetDocRepoOwner }}/${{ parameters.TargetDocRepoName }}
WorkingDirectory: ${{ parameters.WorkingDirectory }}/repo
Paths: ${{ parameters.SparseCheckoutPaths }}

- template: /eng/common/pipelines/templates/steps/set-default-branch.yml
parameters:
WorkingDirectory: ${{ parameters.WorkingDirectory }}/repo
WorkingDirectory: ${{ parameters.WorkingDirectory }}/repo
- task: PowerShell@2
displayName: 'Apply Documentation Updates From Artifact'
inputs:
Expand Down
5 changes: 3 additions & 2 deletions eng/common/pipelines/templates/steps/sparse-checkout.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ steps:
displayName: Init sparse checkout ${{ repo.Name }}
workingDirectory: ${{ coalesce(repo.WorkingDirectory, format('{0}/{1}', '$(System.DefaultWorkingDirectory)', repo.Name)) }}
- pwsh: git checkout ${{ repo.Commitish }}
displayName: Sparse checkout at ${{ repo.Commitish }}
- pwsh: |
git checkout ${{ repo.Commitish }} # this will use the default branch if repo.Commitish is empty
displayName: Sparse checkout at ${{ coalesce(repo.Commitish, 'default branch') }}
workingDirectory: ${{ coalesce(repo.WorkingDirectory, format('{0}/{1}', '$(System.DefaultWorkingDirectory)', repo.Name)) }}

0 comments on commit 030cd9d

Please sign in to comment.