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

Update Tools repo Sync to make use of patch files #995

Closed

Conversation

chidozieononiwu
Copy link
Member

For pull request triggered runs of the sync pipeline. Rather that copying over all the files in the Sync directory make use of a patch file to apply only the changes associated with the latest commits.

@chidozieononiwu chidozieononiwu requested a review from a team as a code owner September 15, 2020 01:34
@chidozieononiwu
Copy link
Member Author

/azp run azure-sdk-tools - sync - eng-common

@azure-pipelines
Copy link

Azure Pipelines could not run because the pipeline triggers exclude this branch/path.

@chidozieononiwu chidozieononiwu force-pushed the feature/eng-common-patch branch 2 times, most recently from 175e264 to 4d3c6a9 Compare September 18, 2020 23:12
@chidozieononiwu chidozieononiwu force-pushed the feature/eng-common-patch branch 4 times, most recently from e0fed5e to f2a383e Compare September 19, 2020 01:09
@chidozieononiwu chidozieononiwu force-pushed the feature/eng-common-patch branch 3 times, most recently from 4b159e0 to 8d4ccba Compare September 23, 2020 04:26
echo "##vso[task.setvariable variable=HasChanges]$false"
foreach ($file in (Get-ChildItem $(PatchFilesLocation)))
{
$results += git -c user.name="azure-sdk" -c user.email="azuresdk@microsoft.com" am $file.FullName
Copy link
Member

Choose a reason for hiding this comment

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

Shouldn't you still check the lastExitCode after each invoke of git am?

{
$results += git -c user.name="azure-sdk" -c user.email="azuresdk@microsoft.com" am $file.FullName
}
if (($results.Count -eq (Get-ChildItem $(PatchFilesLocation))) -and ($LASTEXITCODE -eq 0))
Copy link
Member

Choose a reason for hiding this comment

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

(Get-ChildItem $(PatchFilesLocation)) that doesn't return a count does it?

Comment on lines 27 to 30
foreach ($file in (Get-ChildItem $(PatchFilesLocation)))
{
$results += git -c user.name="azure-sdk" -c user.email="azuresdk@microsoft.com" am $file.FullName
}
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
foreach ($file in (Get-ChildItem $(PatchFilesLocation)))
{
$results += git -c user.name="azure-sdk" -c user.email="azuresdk@microsoft.com" am $file.FullName
}
$shaBeforePatches = git ref-parse --short HEAD
foreach ($file in (Get-ChildItem $(PatchFilesLocation)*.patch))
{
git -c user.name="azure-sdk" -c user.email="azuresdk@microsoft.com" am -3 $file.FullName
if ($lastExitCode -ne 0) {
git am --show-current-patch=diff
# Once we hit one conflict that causes the patch to fail we should fail the pipeline until that
# gets addressed.
Write-Error "##vso[task.LogIssue type=warning;]Failed to properly apply patch files to [https://github.com/azure/${{ repo }}]"
exit 1
}
}
$shaAfterPatches = git ref-parse --short HEAD
$hasChanges = $shaBeforePatches -ne $shaAfterPatches
echo "##vso[task.setvariable variable=HasChanges]$hasChanges"

@chidozieononiwu chidozieononiwu force-pushed the feature/eng-common-patch branch 4 times, most recently from 9d4ef32 to a020f66 Compare September 24, 2020 02:26
@chidozieononiwu chidozieononiwu force-pushed the feature/eng-common-patch branch 5 times, most recently from beea611 to b470244 Compare September 26, 2020 03:35
@chidozieononiwu chidozieononiwu force-pushed the feature/eng-common-patch branch 2 times, most recently from d138471 to 0f4036e Compare September 26, 2020 04:36
@chidozieononiwu
Copy link
Member Author

Am closing this since the changes have been incorporated in #1052

@weshaggard
Copy link
Member

@chidozieononiwu please also go and close the sync PRs.

sima-zhu pushed a commit to sima-zhu/azure-sdk-tools that referenced this pull request Dec 3, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants