@@ -33,79 +33,86 @@ parameters:
33
33
type : string
34
34
default : ' '
35
35
steps :
36
- - template : /eng/common/pipelines/templates/steps/enable-long-path-support.yml
36
+ - ${{ if eq(length(parameters.PackageInfoLocations), 0) }} :
37
+ - checkout : none
38
+ - pwsh : |
39
+ Write-Host "Skipping DocsMS Update because package list was empty."
40
+ displayName: Skip DocsMS Update
41
+ - ${{ else }} :
42
+ - template : /eng/common/pipelines/templates/steps/enable-long-path-support.yml
37
43
38
- - pwsh : |
39
- Write-Host "###vso[task.setvariable variable=DocRepoLocation]${{ parameters.WorkingDirectory }}/doc"
40
- displayName : Set $(DocRepoLocation)
44
+ - pwsh : |
45
+ Write-Host "###vso[task.setvariable variable=DocRepoLocation]${{ parameters.WorkingDirectory }}/doc"
46
+ displayName: Set $(DocRepoLocation)
41
47
42
- - template : /eng/common/pipelines/templates/steps/sparse-checkout.yml
43
- parameters :
44
- SkipDefaultCheckout : true
45
- Repositories :
46
- - Name : ${{ parameters.TargetDocRepoOwner }}/${{ parameters.TargetDocRepoName }}
47
- WorkingDirectory : $(DocRepoLocation)
48
- Paths : ${{ parameters.SparseCheckoutPaths }}
48
+ - template : /eng/common/pipelines/templates/steps/sparse-checkout.yml
49
+ parameters :
50
+ SkipDefaultCheckout : true
51
+ Repositories :
52
+ - Name : ${{ parameters.TargetDocRepoOwner }}/${{ parameters.TargetDocRepoName }}
53
+ WorkingDirectory : $(DocRepoLocation)
54
+ Paths : ${{ parameters.SparseCheckoutPaths }}
49
55
50
- # If performing a daily docs build set the $(TargetBranchName) to a daily branch
51
- # name and attempt to checkout the daily docs branch. If the branch doesn't
52
- # exist, create it
53
- - ${{ if eq(parameters.DailyDocsBuild, 'true') }} :
54
- - template : /eng/common/pipelines/templates/steps/set-daily-docs-branch-name.yml
56
+ # If performing a daily docs build set the $(TargetBranchName) to a daily branch
57
+ # name and attempt to checkout the daily docs branch. If the branch doesn't
58
+ # exist, create it
59
+ - ${{ if eq(parameters.DailyDocsBuild, 'true') }} :
60
+ - template : /eng/common/pipelines/templates/steps/set-daily-docs-branch-name.yml
55
61
56
- - pwsh : |
57
- $ErrorActionPreference = "Continue"
58
- $RemoteName = "origin"
59
- $BranchName = "$(TargetBranchName)"
60
- # Fetch and checkout remote branch if it already exists otherwise create a new branch.
61
- git ls-remote --exit-code --heads $RemoteName $BranchName
62
- if ($LASTEXITCODE -eq 0) {
63
- Write-Host "git fetch $RemoteName $BranchName"
64
- git fetch $RemoteName $BranchName
65
- Write-Host "git checkout $BranchName."
66
- git checkout $BranchName
67
- } else {
68
- Write-Host "git checkout -b $BranchName."
69
- git checkout -b $BranchName
70
- }
71
- displayName: Checkout daily docs branch if it exists
72
- workingDirectory: $(DocRepoLocation)
62
+ - pwsh : |
63
+ $ErrorActionPreference = "Continue"
64
+ $RemoteName = "origin"
65
+ $BranchName = "$(TargetBranchName)"
66
+ # Fetch and checkout remote branch if it already exists otherwise create a new branch.
67
+ git ls-remote --exit-code --heads $RemoteName $BranchName
68
+ if ($LASTEXITCODE -eq 0) {
69
+ Write-Host "git fetch $RemoteName $BranchName"
70
+ git fetch $RemoteName $BranchName
71
+ Write-Host "git checkout $BranchName."
72
+ git checkout $BranchName
73
+ } else {
74
+ Write-Host "git checkout -b $BranchName."
75
+ git checkout -b $BranchName
76
+ }
77
+ displayName: Checkout daily docs branch if it exists
78
+ workingDirectory: $(DocRepoLocation)
73
79
74
- # If NOT performing a daily docs build, set the $(TargetBranchName) to the
75
- # default branch of the documentation repository.
76
- - ${{ if ne(parameters.DailyDocsBuild, 'true') }} :
77
- - template : /eng/common/pipelines/templates/steps/set-default-branch.yml
78
- parameters :
79
- WorkingDirectory : $(DocRepoLocation)
80
- DefaultBranchVariableName : TargetBranchName
81
- # Pull and build the docker image.
82
- - ${{ if ne(parameters.DocValidationImageId, '') }} :
83
- - template : /eng/common/pipelines/templates/steps/docker-pull-image.yml
84
- parameters :
85
- ContainerRegistryClientId : $(azuresdkimages-cr-clientid)
86
- ContainerRegistryClientSecret : $(azuresdkimages-cr-clientsecret)
87
- ImageId : ' ${{ parameters.DocValidationImageId }}'
88
- - pwsh : |
89
- $packageInfoJson = '${{ convertToJson(parameters.PackageInfoLocations) }}'.Trim('"').Replace("\\", "/")
90
- $packageInfoLocations = ConvertFrom-Json $packageInfoJson
91
- ${{ parameters.ScriptDirectory }}/Update-DocsMsMetadata.ps1 `
92
- -PackageInfoJsonLocations $packageInfoLocations `
93
- -DocRepoLocation "$(DocRepoLocation)" `
94
- -Language '${{parameters.Language}}' `
95
- -RepoId '${{ parameters.RepoId }}' `
96
- -DocValidationImageId '${{ parameters.DocValidationImageId }}' `
97
- -PackageSourceOverride '${{ parameters.PackageSourceOverride }}' `
98
- -TenantId '$(opensource-aad-tenant-id)' `
99
- -ClientId '$(opensource-aad-app-id)' `
100
- -ClientSecret '$(opensource-aad-secret)'
101
- displayName : Apply Documentation Updates
80
+ # If NOT performing a daily docs build, set the $(TargetBranchName) to the
81
+ # default branch of the documentation repository.
82
+ - ${{ if ne(parameters.DailyDocsBuild, 'true') }} :
83
+ - template : /eng/common/pipelines/templates/steps/set-default-branch.yml
84
+ parameters :
85
+ WorkingDirectory : $(DocRepoLocation)
86
+ DefaultBranchVariableName : TargetBranchName
87
+ # Pull and build the docker image.
88
+ - ${{ if ne(parameters.DocValidationImageId, '') }} :
89
+ - template : /eng/common/pipelines/templates/steps/docker-pull-image.yml
90
+ parameters :
91
+ ContainerRegistryClientId : $(azuresdkimages-cr-clientid)
92
+ ContainerRegistryClientSecret : $(azuresdkimages-cr-clientsecret)
93
+ ImageId : ' ${{ parameters.DocValidationImageId }}'
94
+ - pwsh : |
95
+ $packageInfoJson = '${{ convertToJson(parameters.PackageInfoLocations) }}'.Trim('"').Replace("\\", "/")
96
+ # Without -NoEnumerate, a single element array[T] gets unwrapped as a single item T.
97
+ $packageInfoLocations = ConvertFrom-Json $packageInfoJson -NoEnumerate
98
+ ${{ parameters.ScriptDirectory }}/Update-DocsMsMetadata.ps1 `
99
+ -PackageInfoJsonLocations $packageInfoLocations `
100
+ -DocRepoLocation "$(DocRepoLocation)" `
101
+ -Language '${{parameters.Language}}' `
102
+ -RepoId '${{ parameters.RepoId }}' `
103
+ -DocValidationImageId '${{ parameters.DocValidationImageId }}' `
104
+ -PackageSourceOverride '${{ parameters.PackageSourceOverride }}' `
105
+ -TenantId '$(opensource-aad-tenant-id)' `
106
+ -ClientId '$(opensource-aad-app-id)' `
107
+ -ClientSecret '$(opensource-aad-secret)'
108
+ displayName: Apply Documentation Updates
102
109
103
- - template : /eng/common/pipelines/templates/steps/git-push-changes.yml
104
- parameters :
105
- BaseRepoBranch : $(TargetBranchName)
106
- BaseRepoOwner : ${{ parameters.TargetDocRepoOwner }}
107
- CommitMsg : " Update docs metadata"
108
- TargetRepoName : ${{ parameters.TargetDocRepoName }}
109
- TargetRepoOwner : ${{ parameters.TargetDocRepoOwner }}
110
- WorkingDirectory : $(DocRepoLocation)
111
- ScriptDirectory : ${{ parameters.WorkingDirectory }}/${{ parameters.ScriptDirectory }}
110
+ - template : /eng/common/pipelines/templates/steps/git-push-changes.yml
111
+ parameters :
112
+ BaseRepoBranch : $(TargetBranchName)
113
+ BaseRepoOwner : ${{ parameters.TargetDocRepoOwner }}
114
+ CommitMsg : " Update docs metadata"
115
+ TargetRepoName : ${{ parameters.TargetDocRepoName }}
116
+ TargetRepoOwner : ${{ parameters.TargetDocRepoOwner }}
117
+ WorkingDirectory : $(DocRepoLocation)
118
+ ScriptDirectory : ${{ parameters.WorkingDirectory }}/${{ parameters.ScriptDirectory }}
0 commit comments