EXPOSERS: Fluent GitHub Pipeline Builder#145
Conversation
|
This PR is Code-Completed. Pending #144 |
| OnEvents = new Events(), | ||
| Jobs = new Dictionary<string, Job>() | ||
| }; | ||
| this.aDotNetClient = aDotNetClient; |
There was a problem hiding this comment.
new line above as it is following a multi liner.
| public static GitHubPipelineBuilder CreateNewPipeline() | ||
| { | ||
| var aDotNetClient = new ADotNetClient(); | ||
| return new GitHubPipelineBuilder(aDotNetClient); |
There was a problem hiding this comment.
new line before return, fix others as well
| public void SaveToFile(string path) | ||
| { | ||
| this.aDotNetClient.SerializeAndWriteToFile( | ||
| this.githubPipeline, | ||
| path); | ||
| } |
There was a problem hiding this comment.
| public void SaveToFile(string path) | |
| { | |
| this.aDotNetClient.SerializeAndWriteToFile( | |
| this.githubPipeline, | |
| path); | |
| } | |
| public void SaveToFile(string path) => | |
| this.aDotNetClient.SerializeAndWriteToFile(this.githubPipeline, path); |
| public JobBuilder WithName(string name) | ||
| { | ||
| this.job.Name = name; | ||
| return this; |
There was a problem hiding this comment.
new line before a return, fix others on file as well
| this.job.EnvironmentVariables ??= | ||
| new Dictionary<string, string>(); | ||
|
|
||
| this.job.EnvironmentVariables[key] = value; | ||
| return this; |
There was a problem hiding this comment.
| this.job.EnvironmentVariables ??= | |
| new Dictionary<string, string>(); | |
| this.job.EnvironmentVariables[key] = value; | |
| return this; | |
| this.job.EnvironmentVariables ??= new Dictionary<string, string>(); | |
| this.job.EnvironmentVariables[key] = value; | |
| return this; |
AdoNet.Tests.Console/Program.cs
Outdated
| .AddEnvironmentVariable("AzureClientSecret", "${{ secrets.AZURECLIENTSECRET }}") | ||
| .AddEnvironmentVariable("AzureAdminName", "${{ secrets.AZUREADMINNAME }}") | ||
| .AddEnvironmentVariable("AzureAdminAccess", "${{ secrets.AZUREADMINACCESS }}") | ||
| //.AddEnvironmentVariables(new Dictionary<string, string> |
There was a problem hiding this comment.
Remove commented section. You can demo this in the readme.md documentation file.
Maybe also add a separate markup file to explain the flient config or extend the existing one with the existing demo in fluent syntax?
There was a problem hiding this comment.
Yeah I am saving to an other file: .SaveToFile("github-pipelines-2.yaml");
| actualPipeline.OnEvents.Push.Should().NotBeNull(); | ||
| actualPipeline.OnEvents.Push.Branches.Should().BeEquivalentTo(inputBranches); | ||
| } | ||
|
|
There was a problem hiding this comment.
what to remove exactly ?
|
|
||
| this.aDotNetClientMock.VerifyNoOtherCalls(); | ||
| } | ||
|
|
There was a problem hiding this comment.
what to remove exactly ?
|
Please check the PR #147 |
Summary
This pull request introduces a comprehensive refactor and feature set for the
GitHubPipelineBuilderclass, making it more extensible, testable, and user-friendly. The key features include:ADotNetClientwith an interfaceIADotNetClient, enabling easier testing and extensibility.ADotNetClientclass to implement theIADotNetClientinterface.IADotNetClientinterface and validate behavior.Features
Fluent API Enhancements
Environment Variables Support:
Generic Task Builder:
AddGenericStep:Improved Pipeline Definition:
Interface Implementation
IADotNetClientinterface to abstract theADotNetClientclass.ADotNetClientto implement this interface without changing existing functionality.Dependency Injection
GitHubPipelineBuilderto acceptIADotNetClientvia dependency injection, enabling mocking in unit tests and better modularity.