Skip to content

Commit 60d01c0

Browse files
authored
Update the Compliance job to checkout modified files in a PR run (Azure#35835)
Update the Compliance job to checkout modified files in a PR run
1 parent 2490e1e commit 60d01c0

File tree

1 file changed

+22
-14
lines changed
  • eng/pipelines/templates/jobs

1 file changed

+22
-14
lines changed

eng/pipelines/templates/jobs/ci.yml

Lines changed: 22 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -423,21 +423,29 @@ jobs:
423423
- '!sdk/**/test-recordings'
424424
- '!sdk/**/session-records'
425425

426-
- template: /eng/pipelines/templates/steps/generate-project-list-and-cache-maven-repository.yml
427-
parameters:
428-
Artifacts: ${{ parameters.Artifacts }}
429-
AdditionalModules: ${{ parameters.AdditionalModules }}
430-
JobType: 'Compliance'
431-
UseCache: false
426+
# For PullRequests CredScan will be run against the files changed in the PR.
427+
# For non-pull requests CredScan
428+
- ${{if eq(variables['Build.Reason'], 'PullRequest')}}:
429+
- pwsh: |
430+
$changedFiles = & "eng/common/scripts/get-changedfiles.ps1"
431+
$tmp = ConvertTo-Json @($changedFiles | Sort-Object | Get-Unique) -Compress
432+
Write-Host "##vso[task.setvariable variable=SparseCheckoutDirectories;]$tmp"
433+
- ${{else}}:
434+
- template: /eng/pipelines/templates/steps/generate-project-list-and-cache-maven-repository.yml
435+
parameters:
436+
Artifacts: ${{ parameters.Artifacts }}
437+
AdditionalModules: ${{ parameters.AdditionalModules }}
438+
JobType: 'Compliance'
439+
UseCache: false
432440

433-
- task: PowerShell@2
434-
displayName: Generate directories variable for sparse checkout
435-
inputs:
436-
pwsh: true
437-
filePath: $(Build.SourcesDirectory)/eng/scripts/Generate-ServiceDirectories-From-Project-List.ps1
438-
arguments: >
439-
-SourcesDirectory $(Build.SourcesDirectory)
440-
-ProjectList $(ProjectList)
441+
- task: PowerShell@2
442+
displayName: Generate directories variable for sparse checkout
443+
inputs:
444+
pwsh: true
445+
filePath: $(Build.SourcesDirectory)/eng/scripts/Generate-ServiceDirectories-From-Project-List.ps1
446+
arguments: >
447+
-SourcesDirectory $(Build.SourcesDirectory)
448+
-ProjectList $(ProjectList)
441449
442450
# Skip sparse checkout for the `azure-sdk-for-<lang>-pr` private mirrored repositories
443451
# as we require the GitHub service connection to be loaded.

0 commit comments

Comments
 (0)