Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 19 additions & 22 deletions azure-pipelines-pr-validation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -165,28 +165,6 @@ extends:
displayName: Setting SourceBranchName variable
condition: succeeded()

- task: Powershell@2
name: FancyBuild
displayName: Setting FancyBuild.BuildNumber
inputs:
targetType: inline
script: |
$pull_request = Invoke-RestMethod -Uri "https://api.github.com/repos/dotnet/roslyn/pulls/${{ parameters.PRNumber }}" `
-Headers @{
"Accept" = "application/vnd.github+json";
"X-GitHub-Api-Version" = "2022-11-28"
}
$buildNumberName = "$(OriginalBuildNumber) - $($pull_request.user.login) - '$($pull_request.title)'"
$buildNumberName = $buildNumberName -replace '["/:<>\|?@*]','_'
# Maximum buildnumber length is 255 chars and we are going to append to the end to ensure we have space.
if ($buildNumberName.Length -GT 253) {
$buildNumberName = $buildNumberName.Substring(0, 253)
}
# Avoid ever ending the BuildNumber with a `.` by always appending to it.
$buildNumberName += ' #'
Write-Host "##vso[task.setvariable variable=BuildNumber;isoutput=true;isreadonly=true]$buildNumberName"
Write-Host "##vso[build.updatebuildnumber]$buildNumberName"

- task: Powershell@2
displayName: Tag PR validation build
inputs:
Expand All @@ -204,6 +182,25 @@ extends:
arguments: "-sourceBranchName $(SourceBranchName) -prNumber ${{ parameters.PRNumber }} -commitSHA ${{ parameters.CommitSHA }} -enforceLatestCommit ${{ iif(parameters.EnforceLatestCommit, '1', '0') }}"
condition: succeeded()

- task: Powershell@2
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the intent that if this fails, at least we already got the PR out for now?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(maybe add a comment to that effect)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not sure exactly what you mean - I moved it because in order to get the commit details, we need to have it checked out. I guess I could continue on failure, but I suspect it would fail in followup steps when we try to reset the build number.

This shouldn't fail anymore since its just reading the local git repo and not making a github API request.

name: FancyBuild
displayName: Setting FancyBuild.BuildNumber
inputs:
targetType: inline
script: |
$authorName = git log -1 --pretty=format:"%an" ${{ parameters.CommitSHA }}

$buildNumberName = "$(OriginalBuildNumber) - $($authorName) - '${{ parameters.PRNumber }}'"
$buildNumberName = $buildNumberName -replace '["/:<>\|?@*]','_'
# Maximum buildnumber length is 255 chars and we are going to append to the end to ensure we have space.
if ($buildNumberName.Length -GT 253) {
$buildNumberName = $buildNumberName.Substring(0, 253)
}
# Avoid ever ending the BuildNumber with a `.` by always appending to it.
$buildNumberName += ' #'
Write-Host "##vso[task.setvariable variable=BuildNumber;isoutput=true;isreadonly=true]$buildNumberName"
Write-Host "##vso[build.updatebuildnumber]$buildNumberName"

- powershell: Write-Host "##vso[task.setvariable variable=VisualStudio.DropName]Products/$(System.TeamProject)/$(Build.Repository.Name)/$(SourceBranchName)/$(OriginalBuildNumber)"
displayName: Setting VisualStudio.DropName variable

Expand Down