Category: sidecar
-
SideCarCLI- console to dot net tool
To create a .NET Tool,please read first https://docs.microsoft.com/en-us/dotnet/core/tools/global-tools-how-to-create Of course,all the nuget additional formats for csproj apply: read https://docs.microsoft.com/en-us/dotnet/core/tools/csproj . Of course,the easy way to in Visual Studio to right click the project,properties,Package. This is the final xml from .csproj: <PropertyGroup> <OutputType>Exe</OutputType> <TargetFramework>netcoreapp3.1</TargetFramework> <RuntimeIdentifiers>win-x64;linux-x64</RuntimeIdentifiers> <PackAsTool>true</PackAsTool> <ToolCommandName>sidecarcli</ToolCommandName> <Title>SideCarCLI</Title> <PackageOutputPath>./nupkg</PackageOutputPath> <PackageId>sidecarcli</PackageId> <Version>2020.111.104</Version> <Authors>Andrei Ignat</Authors> <Company>AOM</Company> <Product>sidecarcli</Product> …
-
SideCarCLI–looking at past and at future
It was interesting to develop the project for command line same as for cloud design pattern,https://docs.microsoft.com/en-us/azure/architecture/patterns/sidecar . The problem were more about architecture organizing features to be easy understandable ,testing the application writing about rather than technical,about how to make the application. Other,it was a pretty simple project,that can be useful in CI /…
-
SideCarCLI- diagram for how it is working
Usually,a picture is better than words . So,I can explain how SideCarCLI works – or I can draw an image. The easiest way to draw an image is with https://mermaidjs.github.io/ – that has also a live editor at https://mermaid-js.github.io/mermaid-live-editor . The code for generating the picture is sequenceDiagram participant S as SideCar participant R as…
-
SideCARCLI–Finish process after some time
One of the feature is to let the original process execute just a limited amount of time. For this,I have defined an option var maxSeconds = app.Option(“-mS|–maxSeconds”,”max seconds for the StartApp to run”,CommandOptionType.SingleOrNoValue); and the code for waiting is Process p = new Process() { StartInfo = pi }; //code var res=p.WaitForExit(this.MaxSeconds); //code if (res)…
-
SideCarCLI – Line interceptors
For the SideCarCLI I have the concept of Line Interceptors. That means for each line from the original program another program will be start . The json looks like this “LineInterceptors”: [ { “Name”: “WindowsStandardWindowsOutputInterceptor”, “Arguments”: “/c echo \”{site} {line}\””, “FullPath”: “cmd.exe”, “FolderToExecute”: null, “InterceptOutput”: true }, { “Name”: “NextInterceptor”, “Arguments”: “/c echo {line}”, “FullPath”:…
-
SideCarCLI-send arguments to interceptors
For the SideCarCLI I want the interceptors ( line,finish,timer) to receive parts of the command line of the original application. But how to parse the command line and how to pass to the interceptors ? RegEx to the rescue! I will let the user define the command line of the starting application and parse the…
-
SideCarCLI- finish interceptors
The idea for FinishInterceptors is very simple – when the initial process,StartApp,is finished –then run some other programs . And here comes some decisions: Pass the ExitCode of the StartApp ? ( YES) Pass the output lines of text of the StartApp ? ( NO – could be enormous ) What to do if the…
-
SideCarCLI–create releases
Because all code is in Github,the easy way is GitHub Actions,https://github.com/features/actions . Some modifications are required on CSPROJ file to build for Linux or Windows : <PropertyGroup> <OutputType>Exe</OutputType> <TargetFramework>netcoreapp3.1</TargetFramework> <RuntimeIdentifiers>win-x64;linux-x64</RuntimeIdentifiers> </PropertyGroup> And after 6 commits,this is the ( almost) final version: name: .NET Core on: push: branches: [ main ] pull_request: branches: [ main…
-
SideCarCLI–refactor command line
When starting to implement the project,suddenly realize that list interceptors command does not belong to start app command . So the application should be refactored to new specifications – StartApp command – contains the whole list of commands for starting the app,including timer,adding interceptor – Interceptors command – should list the interceptors (timer,line,finish) The interceptors…
-
SideCarCLI–Architecture and specs–part 2
The SideCarCLI application should start another application and intercept in various ways . What will execute when intercept is not known in advance – so should be read at runtime . So the SideCarCLI will load the interceptors and make then available to the application. Let’s say that,for the moment,the SideCarCLI will take all the…