...

Text file src/github.com/Azure/azure-sdk-for-go/eng/common/pipelines/templates/steps/update-docsms-metadata.yml

Documentation: github.com/Azure/azure-sdk-for-go/eng/common/pipelines/templates/steps

     1parameters:
     2  - name: PackageInfoLocations
     3    type: object
     4    default: []
     5  - name: RepoId
     6    type: string
     7    default: $(Build.Repository.Name)
     8  - name: WorkingDirectory
     9    type: string
    10    default: ''
    11  - name: ScriptDirectory
    12    type: string
    13    default: eng/common/scripts
    14  - name: TargetDocRepoName
    15    type: string
    16    default: ''
    17  - name: TargetDocRepoOwner
    18    type: string
    19  - name: Language
    20    type: string
    21    default: ''
    22  - name: DailyDocsBuild
    23    type: boolean
    24    default: false
    25  - name: SparseCheckoutPaths
    26    type: object
    27    default:
    28      - '**'
    29  - name: PackageSourceOverride
    30    type: string
    31    default: ''
    32  - name: DocValidationImageId
    33    type: string
    34    default: ''
    35steps:
    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
    43
    44    - pwsh: |
    45        Write-Host "###vso[task.setvariable variable=DocRepoLocation]${{ parameters.WorkingDirectory }}/doc"
    46      displayName: Set $(DocRepoLocation)
    47
    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 }}
    55
    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
    61
    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)
    79
    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
   109
   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 }}

View as plain text