-
Notifications
You must be signed in to change notification settings - Fork 177
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
Use sparse checkout for eng/common sync PRs #1594
Merged
Merged
Changes from 6 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
1d1a956
Use sparse checkout for eng/common sync PRs
benbp 49aa992
Use sparse checkout for directory sync stage
benbp e842508
Use Build.SourceBranch as default base branch for eng-common-sync
benbp 2d76cdf
fix clone pathing
benbp ec414e2
Update sparse checkout create directory step name
benbp 3327c77
plumb BaseBranchName to create pull request
benbp ca37020
Apply parameters everywhere in directory sync template
benbp 6e74ed2
Skip redundant checkouts
benbp File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,12 +12,16 @@ parameters: | |
|
||
steps: | ||
- ${{ if eq(variables['Build.Reason'], 'PullRequest') }}: | ||
- template: /eng/common/pipelines/templates/steps/sparse-checkout.yml | ||
benbp marked this conversation as resolved.
Show resolved
Hide resolved
|
||
parameters: | ||
Paths: | ||
- ${{ parameters.DirectoryToSync }} | ||
Repositories: | ||
- ${{ each repo in parameters.Repos }}: | ||
- Name: Azure/${{ repo }} | ||
benbp marked this conversation as resolved.
Show resolved
Hide resolved
|
||
WorkingDirectory: $(System.DefaultWorkingDirectory)/${{ repo }} | ||
|
||
- ${{ each repo in parameters.Repos }}: | ||
- pwsh: | | ||
Set-PsDebug -Trace 1 | ||
git clone --branch ${{ parameters.BaseBranchName }} https://github.com/azure/${{ repo }} | ||
displayName: Clone ${{ repo }} | ||
workingDirectory: $(System.DefaultWorkingDirectory) | ||
- template: /eng/common/pipelines/templates/steps/set-default-branch.yml | ||
- pwsh: | | ||
$repoPath = "${{ repo }}/${{ parameters.DirectoryToSync }}" | ||
|
@@ -31,7 +35,7 @@ steps: | |
{ | ||
Write-Host $file.FullName | ||
git -c user.name="azure-sdk" -c user.email="[email protected]" am -3 $file.FullName | ||
if ($lastExitCode -ne 0) { | ||
if ($lastExitCode -ne 0) { | ||
git -c user.name="azure-sdk" -c user.email="[email protected]" am --show-current-patch=diff | ||
Write-Error "##vso[task.LogIssue type=warning;]Failed to properly apply patch files to [https://github.com/azure/${{ repo }}]" | ||
exit 1 | ||
|
@@ -121,24 +125,38 @@ steps: | |
-AuthToken "$(azuresdk-github-pat)" | ||
|
||
- ${{ if ne(variables['Build.Reason'], 'PullRequest') }}: | ||
- template: /eng/common/pipelines/templates/steps/sparse-checkout.yml | ||
parameters: | ||
Paths: | ||
- ${{ parameters.DirectoryToSync }} | ||
Repositories: | ||
- Name: $(Build.Repository.Name) | ||
Commitish: $(Build.SourceVersion) | ||
WorkingDirectory: $(System.DefaultWorkingDirectory)/$(Build.Repository.Name) | ||
- ${{ each repo in parameters.Repos }}: | ||
- Name: Azure/${{ repo }} | ||
benbp marked this conversation as resolved.
Show resolved
Hide resolved
|
||
Commitish: ${{ parameters.BaseBranchName }} | ||
WorkingDirectory: $(System.DefaultWorkingDirectory)/${{ repo }} | ||
|
||
- ${{ each repo in parameters.Repos }}: | ||
- pwsh: | | ||
Set-PsDebug -Trace 1 | ||
git clone --branch ${{ parameters.BaseBranchName }} https://github.com/azure/${{ repo }} | ||
$repoPath = "${{ repo }}/${{ parameters.DirectoryToSync }}" | ||
if (!(Test-Path $repoPath)) { mkdir $repoPath } | ||
Remove-Item -v -r $repoPath | ||
Copy-Item -v -r $(Build.SourcesDirectory)/${{ parameters.DirectoryToSync }} $repoPath | ||
Remove-Item -v -r -ErrorAction Ignore $repoPath | ||
Copy-Item -v -r ` | ||
$(System.DefaultWorkingDirectory)/$(Build.Repository.Name)/${{ parameters.DirectoryToSync }} ` | ||
$repoPath | ||
Get-ChildItem -r $repoPath | ||
displayName: Copy ${{ parameters.DirectoryToSync }} from azure-sdk-tools to ${{ repo }} | ||
workingDirectory: $(System.DefaultWorkingDirectory) | ||
|
||
- template: /eng/common/pipelines/templates/steps/create-pull-request.yml | ||
parameters: | ||
RepoName: ${{ repo }} | ||
BaseBranchName: ${{ parameters.BaseBranchName }} | ||
PRBranchName: sync-${{ parameters.DirectoryToSync }} | ||
CommitMsg: ${{ parameters.CommitMessage }} | ||
PRTitle: ${{ parameters.CommitMessage }} | ||
PushArgs: -f | ||
WorkingDirectory: $(System.DefaultWorkingDirectory)/${{ repo }} | ||
ScriptDirectory: $(System.DefaultWorkingDirectory)/eng/common/scripts | ||
ScriptDirectory: $(System.DefaultWorkingDirectory)/$(Build.Repository.Name)/eng/common/scripts | ||
benbp marked this conversation as resolved.
Show resolved
Hide resolved
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure if this change is worth flushing through eng/common but I guess if you are doing the sparse-checkout then it can come along for the ride.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah it's getting lumped in with the pre-existing display name changes. Figured it was easier to just let the whitespace fix tag along (rather than me unstaging this file every time I open it and my editor auto-deletes whitespace).