-
Notifications
You must be signed in to change notification settings - Fork 2k
Re-apply internal staging versions of .NET in sync-internal-release command #6699
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
Merged
Merged
Changes from 1 commit
Commits
Show all changes
27 commits
Select commit
Hold shift + click to select a range
79d03e9
Move internal versions method to helper class
lbussell 771c236
Factor out parse/serialization logic for internal staging builds
lbussell 9587f72
Add helper method for constructing mock command
lbussell 7c1ec48
Extract ICommand interface from BaseCommand
lbussell 163b241
Use InternalsVisibleTo for update dependencies tests
lbussell 4487387
Add FromStagingPipelineCommand dependency to SyncInternalReleaseCommand
lbussell bd3497d
Add git restore method
lbussell cf0d112
Add --repo-root argmuent to existing commands
lbussell 2eb7c5e
Make InternalVersionsHelper into a service
lbussell 398e89f
Split InternalVersions* into one file per type
lbussell cb32300
Implement first pass at re-applying internal builds
lbussell 996a5f7
Clean up tests and add more comments
lbussell ff5af1a
Add extra logging to GitRepoHelperFactory
lbussell 4bd8a49
Checkout ref instead of checkout branch for remote branches
lbussell 5545b06
Add extra git logging
lbussell c4b5cd7
Prevent duplicate logging when calling SpecificCommand more than once
lbussell 9c4414c
Allow multi-line log output
lbussell 9d4f4b0
Use existing CreatePullRequestOptions for SyncInternalReleaseCommand
lbussell 0966724
Make FromStagingPipelineCommand respect repo root
lbussell a4c388a
Reset using source branch sha instead of branch name
lbussell 79f1a41
Fix argument name for GetToolUpdaters
lbussell ca0901e
Add helper for shuttling around Manifest version variables and use "b…
lbussell 7167d00
Throw if sub-command had a non-zero exit code
lbussell c6c5bf9
Fix tests
lbussell 2edd452
Add branch variables to manifest.versions.json
lbussell 3c15992
Reference new Azdo URL extension in SpecificCommand
lbussell 397806b
Always trim org name
lbussell 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 hidden or 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 hidden or 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 hidden or 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 |
|---|---|---|
|
|
@@ -14,10 +14,11 @@ public sealed class SyncInternalReleaseTests | |
| { | ||
| private const string ReleaseBranch = "release/1"; | ||
| private const string InternalReleaseBranch = $"internal/{ReleaseBranch}"; | ||
| private const string AzdoOrg = "test-org"; | ||
| private const string AzdoOrgName = "test-org"; | ||
| private const string AzdoOrgUrl = $"https://dev.azure.com/{AzdoOrgName}"; | ||
| private const string AzdoProject = "test-project"; | ||
| private const string AzdoRepo = "test-repo"; | ||
| private const string RemoteAzdoUrl = $"https://dev.azure.com/{AzdoOrg}/{AzdoProject}/_git/{AzdoRepo}"; | ||
| private const string RemoteAzdoUrl = $"{AzdoOrgUrl}/{AzdoProject}/_git/{AzdoRepo}"; | ||
| private const string LocalRepoPath = "/path/to/local-repo"; | ||
|
|
||
| /// <summary> | ||
|
|
@@ -27,7 +28,9 @@ public sealed class SyncInternalReleaseTests | |
| /// </summary> | ||
| private static readonly SyncInternalReleaseOptions s_defaultOptions = new() | ||
| { | ||
| RemoteUrl = RemoteAzdoUrl, | ||
| AzdoOrganization = AzdoOrgUrl, | ||
| AzdoProject = AzdoProject, | ||
| AzdoRepo = AzdoRepo, | ||
| SourceBranch = ReleaseBranch, | ||
| TargetBranch = InternalReleaseBranch | ||
| }; | ||
|
|
@@ -40,7 +43,9 @@ public async Task WhitespaceArgumentsFails() | |
| { | ||
| var options = new SyncInternalReleaseOptions | ||
| { | ||
| RemoteUrl = " ", | ||
| AzdoOrganization = " ", | ||
| AzdoProject = " ", | ||
| AzdoRepo = " ", | ||
| SourceBranch = " ", | ||
| TargetBranch = " " | ||
| }; | ||
|
|
@@ -76,7 +81,7 @@ public async Task CreateInternalBranch() | |
|
|
||
| var repoMock = new Mock<IGitRepoHelper>(); | ||
| var repoFactoryMock = new Mock<IGitRepoHelperFactory>(); | ||
| repoFactoryMock.Setup(f => f.CreateAsync(options.RemoteUrl)).ReturnsAsync(repoMock.Object); | ||
| repoFactoryMock.Setup(f => f.CreateAsync(options.GetAzdoRepoUrl())).ReturnsAsync(repoMock.Object); | ||
|
|
||
| // Setup: | ||
| // Target branch does not exist on remote | ||
|
|
@@ -106,7 +111,7 @@ public async Task AlreadyUpToDate() | |
| // not explicitly set up in this test. | ||
| var repoMock = new Mock<IGitRepoHelper>(MockBehavior.Strict); | ||
| var repoFactoryMock = new Mock<IGitRepoHelperFactory>(); | ||
| repoFactoryMock.Setup(f => f.CreateAsync(options.RemoteUrl)).ReturnsAsync(repoMock.Object); | ||
| repoFactoryMock.Setup(f => f.CreateAsync(options.GetAzdoRepoUrl())).ReturnsAsync(repoMock.Object); | ||
|
|
||
| // Setup: Both target and source branches exist on remote. | ||
| repoMock.Setup(r => r.Remote.RemoteBranchExistsAsync(options.TargetBranch)).ReturnsAsync(true); | ||
|
|
@@ -143,7 +148,7 @@ public async Task FastForward() | |
| repoMock.Setup(r => r.Remote).Returns(remoteRepoMock.Object); | ||
|
|
||
| var repoFactoryMock = new Mock<IGitRepoHelperFactory>(); | ||
| repoFactoryMock.Setup(f => f.CreateAsync(options.RemoteUrl)).ReturnsAsync(repoMock.Object); | ||
| repoFactoryMock.Setup(f => f.CreateAsync(options.GetAzdoRepoUrl())).ReturnsAsync(repoMock.Object); | ||
|
|
||
| // Setup: Both target and source branches exist on remote. | ||
| repoMock.Setup(r => r.Remote.RemoteBranchExistsAsync(options.TargetBranch)).ReturnsAsync(true); | ||
|
|
@@ -193,8 +198,8 @@ public async Task Sync() | |
| { | ||
| var options = s_defaultOptions with | ||
| { | ||
| CommitterName = "Test User", | ||
| CommitterEmail = "[email protected]", | ||
| User = "Test User", | ||
| Email = "[email protected]", | ||
| StagingStorageAccount = "dotnetstage" | ||
| }; | ||
|
|
||
|
|
@@ -254,8 +259,8 @@ public async Task Sync() | |
| gitScenario.RepoMock.Verify( | ||
| repo => repo.Local.CommitAsync( | ||
| It.IsAny<string>(), | ||
| It.Is<(string Name, string Email)>(author => | ||
| author.Name == options.CommitterName && author.Email == options.CommitterEmail | ||
| It.Is<(string Name, string Email)>( | ||
| author => author.Name == options.User && author.Email == options.Email | ||
| ) | ||
| ), | ||
| Times.Exactly(numberOfCommits) | ||
|
|
||
Oops, something went wrong.
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.
This shares the same logic as
SyncInternalReleaseCommand.ExecuteAsync. It'd be nice if there was one method to format this URL.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.
I made sure that
SpecificCommandandSyncInternalReleaseCommandboth use the extension method. Also centralized the trimming into the options class.