Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move PR validation logic from the official build to a separate yml #54053

Merged
merged 5 commits into from
Jun 17, 2021

Conversation

JoeRobich
Copy link
Member

@JoeRobich JoeRobich commented Jun 12, 2021

  • Removes the ability to run the Official build on DevDiv
  • Removes the Set Build Number step since we can use the given build number
  • Removes the PR validation into its own yml to run in its own pipeline
  • Requires the PR's head SHA to be provided and match when running PR Validation.

cc: @genlu, @RikkiGibson

Test PR validation with too short SHA: https://devdiv.visualstudio.com/DevDiv/_build/results?buildId=4865094&view=results
Test PR validation with invalid SHA: https://devdiv.visualstudio.com/DevDiv/_build/results?buildId=4865097&view=results
Test PR validation with correct SHA: https://devdiv.visualstudio.com/DevDiv/_build/results?buildId=4865173&view=results
Test official build: https://dev.azure.com/dnceng/internal/_build/results?buildId=1184266&view=results

@JoeRobich JoeRobich changed the base branch from main to release/dev16.11 June 12, 2021 00:45
@JoeRobich JoeRobich marked this pull request as ready for review June 15, 2021 17:38
@JoeRobich JoeRobich requested a review from a team as a code owner June 15, 2021 17:38
azure-pipelines-official.yml Outdated Show resolved Hide resolved
@genlu
Copy link
Member

genlu commented Jun 15, 2021

  displayName: Merge main-vs-deps into source branch

not required for this PR, but we might want to move main validation to the new validation pipeline as well


Refers to: azure-pipelines-official.yml:77 in 58e91fc. [](commit_id = 58e91fc, deletion_comment = False)

@RikkiGibson RikkiGibson self-assigned this Jun 15, 2021
@JoeRobich
Copy link
Member Author

not required for this PR, but we might want to move main validation to the new validation pipeline as well

@genlu I like the suggestion of moving main validation out of the official build. I wouldn't want to add it to the pr validation yml, so maybe there are multiple which can share a common build template.

azure-pipelines-pr-validation.yml Show resolved Hide resolved
azure-pipelines-pr-validation.yml Show resolved Hide resolved
Write-Host ($remoteRef | Out-String)

$prHeadSHA = $remoteRef.Split()[0]
if (!$prHeadSHA.StartsWith($commitSHA)) {
Copy link
Contributor

Choose a reason for hiding this comment

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

I think it might be reasonable to simply check if the $commitSHA is an ancestor of the $prHeadSHA because there may be a scenario where the user wants to validate one of the earlier commits in their PR.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah, I thought over this, but wasn't sure what the scenario would be. We obviously couldn't take half a PR. Also, It isn't the same as pulling pull/##/merge, since it wouldn't contain changes from the target branch.

Happy to defer this as a future enhancement though, once we work out how it should work.

Copy link
Contributor

Choose a reason for hiding this comment

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

The scenario is that my PR has an RPS regression and I suspect a specific commit in the PR introduced the regression. So I may want to validate the specific commit as well as the one before it. That said, there is no need to introduce this capability, since it would be new.

Write-Host "##vso[task.LogIssue type=error;]The PR's Head SHA ($prHeadSHA) does not begin with the specified commit SHA ($commitSHA). Unreviewed changes may have been pushed to the PR."
exit 1
}

Write-Host "Setting up the build for PR validation by merging refs/pull/$prNumber/merge into $sourceBranchName..."
git pull origin refs/pull/$prNumber/merge
Copy link
Contributor

Choose a reason for hiding this comment

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

This seems like a race condition. The remote SHA may have changed in between ls-remote and pull. Consider pulling the $commitSHA instead.

Copy link
Member Author

Choose a reason for hiding this comment

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

I mean technically true, but would be very tight.

Happy to defer this as a future enhancement where we also include merging the target branch in with a specific commit sha from the PR branch.

Copy link
Contributor

@RikkiGibson RikkiGibson Jun 15, 2021

Choose a reason for hiding this comment

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

It feels like the risk of this may be less if we fetch all the refs we want in one invocation. However, don't feel a need to address this in this PR.

@RikkiGibson
Copy link
Contributor

Test official build: https://dev.azure.com/dnceng/internal/_build/results?buildId=1184266&view=results

It looks like this build failed. It's not clear to me if it could be related to the official yml changes.

@JoeRobich
Copy link
Member Author

JoeRobich commented Jun 15, 2021

It looks like this build failed. It's not clear to me if it could be related to the official yml changes.

Failed due to missing optprof.

D:\workspace\_work\1\s\.packages\microsoft.dotnet.arcade.sdk\6.0.0-beta.21230.2\tools\OptimizationData.targets(110,5): error : No optimization data found for assemblies: D:\workspace\_work\1\s\artifacts\obj\Microsoft.VisualStudio.LanguageServices.CodeLens\Release\net472\Microsoft.VisualStudio.LanguageServices.CodeLens.dll [D:\workspace\_work\1\s\src\VisualStudio\CodeLens\Microsoft.VisualStudio.LanguageServices.CodeLens.csproj]

Will rerun specifying a "potentially" good optprof drop https://dev.azure.com/dnceng/internal/_build/results?buildId=1188427&view=results

Edit: The build with good optprof completed.

}

Write-Host "Getting the hash of refs/pull/$prNumber/head..."
$remoteRef = git ls-remote origin refs/pull/$prNumber/head
Copy link
Member

Choose a reason for hiding this comment

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

refs/pull/$prNumber/head [](start = 38, length = 24)

Would it be an issue that we check for the SHA of refs/pull/$prNumber/head but later do a separate pull from another branch refs/pull/$prNumber/merge

Copy link
Contributor

Choose a reason for hiding this comment

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

Is this the same concern as #54053 (comment)?

Copy link
Member Author

Choose a reason for hiding this comment

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

We've been using the merge branch since it will bring along changes from the PR's target branch and give us the most accurate representation of the PR merging and flowing into the release branch. The commit sha is intended to ensure that the PR branch is still in the same state as it was when reviewed by the user starting the validation.

Copy link
Member

@genlu genlu left a comment

Choose a reason for hiding this comment

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

:shipit:

@JoeRobich JoeRobich merged commit c3c343c into release/dev16.11 Jun 17, 2021
@JoeRobich JoeRobich deleted the separate-prvalidation-yml branch August 16, 2021 20:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants