diff --git a/azure-pipelines-integration-dartlab.yml b/azure-pipelines-integration-dartlab.yml index fd6ca52aee9a0..1405348ee9940 100644 --- a/azure-pipelines-integration-dartlab.yml +++ b/azure-pipelines-integration-dartlab.yml @@ -31,6 +31,9 @@ parameters: - name: sha type: string default: 'None' + - name: EnforceLatestCommit + type: boolean + default: true # Set to 'stop' if you want to keep the test machines around for investigation after test completion. - name: testMachineCleanUpStrategy displayName: Test Machine Clean Up Strategy @@ -93,6 +96,13 @@ stages: - checkout: RoslynMirror fetchDepth: 1 fetchTags: false + - ${{ if ne(parameters.prNumber, 'None') }}: + - task: PowerShell@2 + displayName: Setup branch for validation + inputs: + filePath: 'eng\setup-pr-validation.ps1' + arguments: "-sourceBranchName $(Build.SourceBranch) -prNumber ${{ parameters.prNumber }} -commitSHA ${{ parameters.sha }} -enforceLatestCommit ${{ iif(parameters.EnforceLatestCommit, '1', '0') }}" + condition: succeeded() - template: eng/pipelines/test-integration-job.yml parameters: configuration: $(_configuration) diff --git a/eng/setup-pr-validation.ps1 b/eng/setup-pr-validation.ps1 index d5d594deb41cd..37042156eb99c 100644 --- a/eng/setup-pr-validation.ps1 +++ b/eng/setup-pr-validation.ps1 @@ -19,10 +19,12 @@ try { exit 1 } + git remote add gh https://github.com/dotnet/roslyn.git + if ($enforceLatestCommit) { Write-Host "Validating the PR head matches the specified commit SHA ($commitSHA)..." Write-Host "Getting the hash of refs/pull/$prNumber/head..." - $remoteRef = git ls-remote origin refs/pull/$prNumber/head + $remoteRef = git ls-remote gh refs/pull/$prNumber/head Write-Host ($remoteRef | Out-String) $prHeadSHA = $remoteRef.Split()[0]