зеркало из https://github.com/Azure/benchpress.git
basic engine layout (#1)
* basic engine layout * addressing PR comments * add engine and proto files to the github workflows * fix linter erros hopefully * trying line endings again * we don't actually need that file anyway * remove push jobs * updated the docs with issues I ran into * fix docker files * add back in accidentally removed line * added some stuff to the getting started doc * remove some stuff from the getting started doc
This commit is contained in:
Родитель
3f24833567
Коммит
29925e8d06
|
@ -1,6 +1,3 @@
|
|||
# [Choice] .NET version: 6.0, 5.0, 3.1, 6.0-bullseye, 5.0-bullseye, 3.1-bullseye, 6.0-focal, 5.0-focal, 3.1-focal
|
||||
ARG VARIANT="6.0"
|
||||
FROM mcr.microsoft.com/vscode/devcontainers/dotnet:${VARIANT}
|
||||
SHELL ["pwsh", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"]
|
||||
RUN Install-Module -Name Pester -Force -SkipPublisherCheck
|
||||
RUN Install-Module -Name Az -Force -SkipPublisherCheck
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
"VARIANT": "6.0"
|
||||
}
|
||||
},
|
||||
|
||||
// Configure tool-specific properties.
|
||||
"customizations": {
|
||||
// Configure properties specific to VS Code.
|
||||
|
@ -27,7 +28,7 @@
|
|||
"python.linting.pydocstylePath": "/usr/local/py-utils/bin/pydocstyle",
|
||||
"python.linting.pylintPath": "/usr/local/py-utils/bin/pylint"
|
||||
},
|
||||
|
||||
|
||||
// Add the IDs of extensions you want installed when the container is created.
|
||||
"extensions": [
|
||||
// ARM tools
|
||||
|
@ -38,6 +39,7 @@
|
|||
|
||||
// C#
|
||||
"ms-dotnettools.csharp",
|
||||
|
||||
// Python
|
||||
"ms-python.python",
|
||||
"ms-python.vscode-pylance",
|
||||
|
@ -52,9 +54,10 @@
|
|||
|
||||
// Use 'postCreateCommand' to run commands after the container is created.
|
||||
// Installs:
|
||||
// 1. Mega Linter`
|
||||
// 2. Configures benchpress Python module
|
||||
"postCreateCommand": "npm install -g mega-linter-runner && pip install --editable ./framework/python/",
|
||||
// 1. Mega Linter
|
||||
// 2. Pester
|
||||
// 3. Configures benchpress Python module
|
||||
"postCreateCommand": "npm install -g mega-linter-runner && pwsh -command Install-Module -Name Pester -Force -SkipPublisherCheck && pip install --editable ./framework/python/",
|
||||
|
||||
// Comment out to connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root.
|
||||
"remoteUser": "vscode",
|
||||
|
|
|
@ -1,33 +1,33 @@
|
|||
name: pr_docs
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
paths:
|
||||
- "docs/**.md"
|
||||
- "./**.md"
|
||||
- ".github/workflows/pr_docs.yaml"
|
||||
branches:
|
||||
- main
|
||||
jobs:
|
||||
lint:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
token: ${{ secrets.PAT || secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: MegaLinter documentation flavor
|
||||
uses: oxsecurity/megalinter/flavors/documentation@v6.12.0
|
||||
env:
|
||||
IGNORE_GITIGNORED_FILES: true
|
||||
VALIDATE_ALL_CODEBASE: true
|
||||
PRINT_ALL_FILES: true
|
||||
DISABLE: COPYPASTE,YAML
|
||||
SPELL_CSPELL_CONFIG_FILE: /config/megalinter/.cspell.json
|
||||
MARKDOWN_MARKDOWN_LINK_CHECK_CONFIG_FILE: /config/megalinter/.markdown-link-check.json
|
||||
DISABLE_LINTERS: REPOSITORY_CHECKOV,REPOSITORY_TRIVY
|
||||
FILTER_REGEX_EXCLUDE: '(BenchPress/|engine/|examples/|\.devcontainer|\.editorconfig|\.gitmodules|/framework/|samples/|\.sln|LICENSE)'
|
||||
FILTER_REGEX_INCLUDE: '(docs/|\**.md)'
|
||||
REPORT_OUTPUT_FOLDER: ${GITHUB_WORKSPACE}/megalinter-reports
|
||||
name: pr_docs
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
paths:
|
||||
- "docs/**.md"
|
||||
- "./**.md"
|
||||
- ".github/workflows/pr_docs.yaml"
|
||||
branches:
|
||||
- main
|
||||
jobs:
|
||||
lint:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
token: ${{ secrets.PAT || secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: MegaLinter documentation flavor
|
||||
uses: oxsecurity/megalinter/flavors/documentation@v6.12.0
|
||||
env:
|
||||
IGNORE_GITIGNORED_FILES: true
|
||||
VALIDATE_ALL_CODEBASE: true
|
||||
PRINT_ALL_FILES: true
|
||||
DISABLE: COPYPASTE,YAML
|
||||
SPELL_CSPELL_CONFIG_FILE: /config/megalinter/.cspell.json
|
||||
MARKDOWN_MARKDOWN_LINK_CHECK_CONFIG_FILE: /config/megalinter/.markdown-link-check.json
|
||||
DISABLE_LINTERS: REPOSITORY_CHECKOV,REPOSITORY_TRIVY
|
||||
FILTER_REGEX_EXCLUDE: '(BenchPress/|engine/|examples/|\.devcontainer|\.editorconfig|\.gitmodules|/framework/|samples/|\.sln|LICENSE)'
|
||||
FILTER_REGEX_INCLUDE: '(docs/|\**.md)'
|
||||
REPORT_OUTPUT_FOLDER: ${GITHUB_WORKSPACE}/megalinter-reports
|
||||
|
|
|
@ -1,50 +1,52 @@
|
|||
name: pr_dotnet
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
paths:
|
||||
- "framework/dotnet/**"
|
||||
- "samples/dotnet/**"
|
||||
- ".github/workflows/pr_dotnet.yaml"
|
||||
branches:
|
||||
- main
|
||||
|
||||
env:
|
||||
DOTNET_VERSION: '6.0.x'
|
||||
|
||||
jobs:
|
||||
lint:
|
||||
name: lint-${{matrix.os}}
|
||||
runs-on: ${{ matrix.os }}
|
||||
strategy:
|
||||
matrix:
|
||||
os: [ ubuntu-latest ]
|
||||
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
token: ${{ secrets.PAT || secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: MegaLinter dotnet flavor
|
||||
uses: oxsecurity/megalinter/flavors/dotnet@v6.12.0
|
||||
env:
|
||||
IGNORE_GITIGNORED_FILES: true
|
||||
VALIDATE_ALL_CODEBASE: true
|
||||
PRINT_ALL_FILES: true
|
||||
DISABLE: SPELL,COPYPASTE,YAML
|
||||
DISABLE_LINTERS: REPOSITORY_CHECKOV,REPOSITORY_TRIVY
|
||||
FILTER_REGEX_EXCLUDE: '(BenchPress/|engine/|examples/|/docs|\.devcontainer|\.editorconfig|\.gitmodules|\.sln|\.md|LICENSE|/framework/python|samples/python)'
|
||||
FILTER_REGEX_INCLUDE: '(framework/dotnet|samples/dotnet)'
|
||||
REPORT_OUTPUT_FOLDER: ${GITHUB_WORKSPACE}/megalinter-reports
|
||||
|
||||
- name: Setup dotnet
|
||||
uses: actions/setup-dotnet@v1
|
||||
with:
|
||||
dotnet-version: ${{ env.DOTNET_VERSION }}
|
||||
|
||||
- name: Install dependencies
|
||||
run: dotnet restore
|
||||
|
||||
- name: Build
|
||||
run: dotnet build --configuration Release --no-restore
|
||||
name: pr_dotnet
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
paths:
|
||||
- "framework/dotnet/**"
|
||||
- "samples/dotnet/**"
|
||||
- "engine/**"
|
||||
- "protos/**"
|
||||
- ".github/workflows/pr_dotnet.yaml"
|
||||
branches:
|
||||
- main
|
||||
|
||||
env:
|
||||
DOTNET_VERSION: '6.0.x'
|
||||
|
||||
jobs:
|
||||
lint:
|
||||
name: lint-${{matrix.os}}
|
||||
runs-on: ${{ matrix.os }}
|
||||
strategy:
|
||||
matrix:
|
||||
os: [ ubuntu-latest ]
|
||||
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
token: ${{ secrets.PAT || secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: MegaLinter dotnet flavor
|
||||
uses: oxsecurity/megalinter/flavors/dotnet@v6.12.0
|
||||
env:
|
||||
IGNORE_GITIGNORED_FILES: true
|
||||
VALIDATE_ALL_CODEBASE: true
|
||||
PRINT_ALL_FILES: true
|
||||
DISABLE: SPELL,COPYPASTE,YAML
|
||||
DISABLE_LINTERS: REPOSITORY_CHECKOV,REPOSITORY_TRIVY
|
||||
FILTER_REGEX_EXCLUDE: '(BenchPress/|examples/|/docs|\.devcontainer|\.editorconfig|\.gitmodules|\.sln|\.md|LICENSE|/framework/python|samples/python)'
|
||||
FILTER_REGEX_INCLUDE: '(framework/dotnet|samples/dotnet|engine/)'
|
||||
REPORT_OUTPUT_FOLDER: ${GITHUB_WORKSPACE}/megalinter-reports
|
||||
|
||||
- name: Setup dotnet
|
||||
uses: actions/setup-dotnet@v1
|
||||
with:
|
||||
dotnet-version: ${{ env.DOTNET_VERSION }}
|
||||
|
||||
- name: Install dependencies
|
||||
run: dotnet restore
|
||||
|
||||
- name: Build
|
||||
run: dotnet build --configuration Release --no-restore
|
||||
|
|
|
@ -1,31 +1,32 @@
|
|||
name: pr_python
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
paths:
|
||||
- "framework/python/**"
|
||||
- "samples/python/**"
|
||||
- ".github/workflows/pr_python.yaml"
|
||||
branches:
|
||||
- main
|
||||
jobs:
|
||||
lint:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
token: ${{ secrets.PAT || secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: MegaLinter Python flavor
|
||||
uses: oxsecurity/megalinter/flavors/python@v6.12.0
|
||||
env:
|
||||
IGNORE_GITIGNORED_FILES: true
|
||||
VALIDATE_ALL_CODEBASE: true
|
||||
PRINT_ALL_FILES: true
|
||||
DISABLE: SPELL,COPYPASTE,YAML
|
||||
DISABLE_LINTERS: PYTHON_MYPY,REPOSITORY_CHECKOV,REPOSITORY_TRIVY
|
||||
FILTER_REGEX_EXCLUDE: '(BenchPress/|engine/|examples/|\.devcontainer|\.editorconfig|\.gitmodules|/docs|/framework/dotnet|samples/dotnet|\.sln|\.md|LICENSE)'
|
||||
FILTER_REGEX_INCLUDE: '(framework/python|samples/python)'
|
||||
REPORT_OUTPUT_FOLDER: ${GITHUB_WORKSPACE}/megalinter-reports
|
||||
name: pr_python
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
paths:
|
||||
- "framework/python/**"
|
||||
- "samples/python/**"
|
||||
- "protos/**"
|
||||
- ".github/workflows/pr_python.yaml"
|
||||
branches:
|
||||
- main
|
||||
jobs:
|
||||
lint:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
token: ${{ secrets.PAT || secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: MegaLinter Python flavor
|
||||
uses: oxsecurity/megalinter/flavors/python@v6.12.0
|
||||
env:
|
||||
IGNORE_GITIGNORED_FILES: true
|
||||
VALIDATE_ALL_CODEBASE: true
|
||||
PRINT_ALL_FILES: true
|
||||
DISABLE: SPELL,COPYPASTE,YAML
|
||||
DISABLE_LINTERS: PYTHON_MYPY,REPOSITORY_CHECKOV,REPOSITORY_TRIVY
|
||||
FILTER_REGEX_EXCLUDE: '(BenchPress/|engine/|examples/|\.devcontainer|\.editorconfig|\.gitmodules|/docs|/framework/dotnet|samples/dotnet|\.sln|\.md|LICENSE)'
|
||||
FILTER_REGEX_INCLUDE: '(framework/python|samples/python)'
|
||||
REPORT_OUTPUT_FOLDER: ${GITHUB_WORKSPACE}/megalinter-reports
|
||||
|
|
|
@ -1,21 +1,27 @@
|
|||
# Getting started
|
||||
This guide walks you through the process of starting development on *Benchpress*.
|
||||
|
||||
## Setting up the development environment
|
||||
## Development environment setup within VS Code
|
||||
If you’re using [Visual Studio Code](https://code.visualstudio.com/) as your IDE of choice, then this project contains all of the necessary configurations to bootstrap your development environment using a container known as a [Dev Container](https://code.visualstudio.com/docs/remote/containers).
|
||||
|
||||
If you’re using [Visual Studio Code](https://code.visualstudio.com/) as your IDE of choice, then this project contains all of the necessary configurations to bootstrap your development environment. See the section on [Development environment setup within VS Code
|
||||
](#development-environment-setup-within-vs-code)
|
||||
|
||||
### Development environment setup within VS Code
|
||||
Visual Studio Code supports compilation and development on a container known as [Dev Containers](https://code.visualstudio.com/docs/remote/containers).
|
||||
|
||||
If you’re using VS Code, please install see the installation guide to install Docker and VS Code extension: https://code.visualstudio.com/docs/remote/containers#_installation
|
||||
To use the Dev Container, please follow the installation guide to install Docker and the VS Code extension: https://code.visualstudio.com/docs/remote/containers#_installation
|
||||
|
||||
Then launch the environment by opening the command palette <kbd>Shift</kbd>+<kbd>Command</kbd>+<kbd>P</kbd> (Mac) / <kbd>Ctrl</kbd>+<kbd>Shift</kbd>+<kbd>P</kbd> (Windows/Linux) and running `Dev Containers: Open Folder in Container`
|
||||
|
||||
The Dev Container configuration also contains VS Code extensions for linting/formatting/testing/compilation.
|
||||
The Dev Container configuration also contains VS Code extensions for linting, formatting, testing, and compilation.
|
||||
|
||||
### Development dependencies
|
||||
### Authenticating git within the dev container
|
||||
|
||||
For MacOs, make sure your ssh key is properly added to your key-chain
|
||||
|
||||
1. Call `ssh-add -l` in your **host** terminal. If your key is not in your key-chain, it will say `The agent has no identities` or the identities listed will not include the key you use to authenticate with git.
|
||||
2. To add your key to the key-chain, call `shh-add <the path to your private key>` (most likely, `ssh-add ~/.ssh/id_rsa`).
|
||||
3. Call `ssh-add -l` on your **host** terminal again to verify the identity has been added.
|
||||
4. Call `ssh-add -l` in your **dev container** terminal to verify that it is accessible in the container. Now you should be able to authenticate with git from within the dev container.
|
||||
|
||||
For Windows, try following [this stack overflow post](https://stackoverflow.com/questions/56490194/vs-code-bitbucket-ssh-permission-denied-publickey/72029153#72029153)
|
||||
|
||||
## Development dependencies if not using VS Code
|
||||
Depending on the feature/language you are working on, you may need to download and install language-specific packages, e.g., Python 3.
|
||||
|
||||
List of requirements on development machine:
|
||||
|
@ -24,11 +30,10 @@ List of requirements on development machine:
|
|||
- DotNet Core (version 6.0)
|
||||
- Node (>= version 14)
|
||||
- PowerShell 8
|
||||
- Python 3
|
||||
- Python 3.5
|
||||
- pip 9.0.1
|
||||
|
||||
#### Python setup
|
||||
### Python setup
|
||||
From the root directory, execute to install benchpress as a module that can be referenced:
|
||||
|
||||
> pip install --editable ./framework/python/
|
||||
|
||||
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.1.0" />
|
||||
<PackageReference Include="Moq" Version="4.18.2" />
|
||||
<PackageReference Include="xunit" Version="2.4.1" />
|
||||
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.3">
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
|
@ -25,4 +26,8 @@
|
|||
<GlobalAnalyzerConfigFiles Include="../../.globalconfig" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\BenchPress.TestEngine\BenchPress.TestEngine.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
|
|
@ -0,0 +1,41 @@
|
|||
namespace BenchPress.TestEngine.Tests;
|
||||
|
||||
|
||||
public class BicepServiceTests
|
||||
{
|
||||
private readonly BicepService bicepService;
|
||||
private readonly ServerCallContext context;
|
||||
|
||||
public BicepServiceTests()
|
||||
{
|
||||
var logger = new Mock<ILogger<BicepService>>().Object;
|
||||
bicepService = new BicepService(logger);
|
||||
context = new MockServerCallContext();
|
||||
}
|
||||
|
||||
[Fact(Skip = "Not Implemented")]
|
||||
public async Task DeploymentGroupCreate_DeploysResourceGroup()
|
||||
{
|
||||
var request = new DeploymentGroupRequest
|
||||
{
|
||||
BicepFilePath = "main.bicep",
|
||||
ParameterFilePath = "parameters.json",
|
||||
ResourceGroupName = "test-rg",
|
||||
SubscriptionNameOrId = new Guid().ToString()
|
||||
};
|
||||
var result = await bicepService.DeploymentGroupCreate(request, context);
|
||||
Assert.True(result.Success);
|
||||
}
|
||||
|
||||
[Fact(Skip = "Not Implemented")]
|
||||
public async Task DeleteGroup_DeletesAllResources()
|
||||
{
|
||||
var request = new DeleteGroupRequest
|
||||
{
|
||||
ResourceGroupName = "test-rg",
|
||||
SubscriptionNameOrId = new Guid().ToString()
|
||||
};
|
||||
var result = await bicepService.DeleteGroup(request, context);
|
||||
Assert.True(result.Success);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,33 @@
|
|||
namespace BenchPress.TestEngine.Tests;
|
||||
|
||||
public class MockServerCallContext : ServerCallContext
|
||||
{
|
||||
protected override string MethodCore => throw new NotImplementedException();
|
||||
|
||||
protected override string HostCore => throw new NotImplementedException();
|
||||
|
||||
protected override string PeerCore => throw new NotImplementedException();
|
||||
|
||||
protected override DateTime DeadlineCore => throw new NotImplementedException();
|
||||
|
||||
protected override Metadata RequestHeadersCore => throw new NotImplementedException();
|
||||
|
||||
protected override CancellationToken CancellationTokenCore => throw new NotImplementedException();
|
||||
|
||||
protected override Metadata ResponseTrailersCore => throw new NotImplementedException();
|
||||
|
||||
protected override Status StatusCore { get => throw new NotImplementedException(); set => throw new NotImplementedException(); }
|
||||
protected override WriteOptions WriteOptionsCore { get => throw new NotImplementedException(); set => throw new NotImplementedException(); }
|
||||
|
||||
protected override AuthContext AuthContextCore => throw new NotImplementedException();
|
||||
|
||||
protected override ContextPropagationToken CreatePropagationTokenCore(ContextPropagationOptions options)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
protected override Task WriteResponseHeadersAsyncCore(Metadata responseHeaders)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,26 @@
|
|||
namespace BenchPress.TestEngine.Tests;
|
||||
|
||||
public class ResourceGroupServiceTests
|
||||
{
|
||||
private readonly ResourceGroupService resourceGroupService;
|
||||
private readonly ServerCallContext context;
|
||||
|
||||
public ResourceGroupServiceTests()
|
||||
{
|
||||
var logger = new Mock<ILogger<ResourceGroupService>>().Object;
|
||||
resourceGroupService = new ResourceGroupService(logger);
|
||||
context = new MockServerCallContext();
|
||||
}
|
||||
|
||||
[Fact(Skip = "Not Implemented")]
|
||||
public async Task GetResourceGroup_ResturnsResoureGroup()
|
||||
{
|
||||
var request = new ResourceGroupRequest
|
||||
{
|
||||
ResourceGroupName = "test-rg",
|
||||
SubscriptionNameOrId = new Guid().ToString()
|
||||
};
|
||||
var result = await resourceGroupService.GetResourceGroup(request, context);
|
||||
Assert.True(result.Existed);
|
||||
}
|
||||
}
|
|
@ -1,10 +0,0 @@
|
|||
namespace BenchPress.TestEngine.Tests;
|
||||
|
||||
public class UnitTest1
|
||||
{
|
||||
[Fact]
|
||||
public void Test1()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
|
@ -1 +1,5 @@
|
|||
global using Xunit;
|
||||
global using Xunit;
|
||||
global using Moq;
|
||||
global using Grpc.Core;
|
||||
global using BenchPress.TestEngine.Services;
|
||||
global using Microsoft.Extensions.Logging;
|
|
@ -1,12 +1,20 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Protobuf Include="..\..\protos\bicep.proto" GrpcServices="Server" />
|
||||
<Protobuf Include="..\..\protos\resource_group.proto" GrpcServices="Server" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Grpc.AspNetCore" Version="2.40.0" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<GlobalAnalyzerConfigFiles Include="../../.globalconfig" />
|
||||
</ItemGroup>
|
||||
|
|
|
@ -1,2 +1,25 @@
|
|||
// See https://aka.ms/new-console-template for more information
|
||||
Console.WriteLine("Hello, World!");
|
||||
using BenchPress.TestEngine.Services;
|
||||
using Microsoft.AspNetCore.Server.Kestrel.Core;
|
||||
|
||||
var builder = WebApplication.CreateBuilder(args);
|
||||
|
||||
// Additional configuration is required to successfully run gRPC on macOS.
|
||||
// For instructions on how to configure Kestrel and gRPC clients on macOS, visit https://go.microsoft.com/fwlink/?linkid=2099682
|
||||
builder.WebHost.ConfigureKestrel(options =>
|
||||
{
|
||||
// Setup a HTTP/2 endpoint without TLS.
|
||||
options.ListenLocalhost(5152, o => o.Protocols =
|
||||
HttpProtocols.Http2);
|
||||
});
|
||||
|
||||
// Add services to the container.
|
||||
builder.Services.AddGrpc();
|
||||
|
||||
var app = builder.Build();
|
||||
|
||||
// Configure the HTTP request pipeline.
|
||||
app.MapGrpcService<BicepService>();
|
||||
app.MapGrpcService<ResourceGroupService>();
|
||||
app.MapGet("/", () => "Communication with gRPC endpoints must be made through a gRPC client. To learn how to create a client, visit: https://go.microsoft.com/fwlink/?linkid=2086909");
|
||||
|
||||
app.Run();
|
||||
|
|
|
@ -0,0 +1,21 @@
|
|||
namespace BenchPress.TestEngine.Services;
|
||||
|
||||
public class BicepService : Bicep.BicepBase
|
||||
{
|
||||
private readonly ILogger<BicepService> logger;
|
||||
|
||||
public BicepService(ILogger<BicepService> logger)
|
||||
{
|
||||
this.logger = logger;
|
||||
}
|
||||
|
||||
public override async Task<DeploymentResult> DeploymentGroupCreate(DeploymentGroupRequest request, ServerCallContext context)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public override async Task<DeploymentResult> DeleteGroup(DeleteGroupRequest request, ServerCallContext context)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,16 @@
|
|||
namespace BenchPress.TestEngine.Services;
|
||||
|
||||
public class ResourceGroupService : ResourceGroup.ResourceGroupBase
|
||||
{
|
||||
private readonly ILogger<ResourceGroupService> logger;
|
||||
|
||||
public ResourceGroupService(ILogger<ResourceGroupService> logger)
|
||||
{
|
||||
this.logger = logger;
|
||||
}
|
||||
|
||||
public override async Task<ResourceGroupResponse> GetResourceGroup(ResourceGroupRequest rg, ServerCallContext context)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,2 @@
|
|||
global using Grpc.Core;
|
||||
global using BenchPress.TestEngine;
|
|
@ -0,0 +1,8 @@
|
|||
{
|
||||
"Logging": {
|
||||
"LogLevel": {
|
||||
"Default": "Information",
|
||||
"Microsoft.AspNetCore": "Warning"
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,14 @@
|
|||
{
|
||||
"Logging": {
|
||||
"LogLevel": {
|
||||
"Default": "Information",
|
||||
"Microsoft.AspNetCore": "Warning"
|
||||
}
|
||||
},
|
||||
"AllowedHosts": "*",
|
||||
"Kestrel": {
|
||||
"EndpointDefaults": {
|
||||
"Protocols": "Http2"
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,29 @@
|
|||
syntax = "proto3";
|
||||
|
||||
package benchpress;
|
||||
|
||||
option csharp_namespace = "BenchPress.TestEngine";
|
||||
|
||||
// Currently only supports deployments with the target scope of resource group.
|
||||
// Other scopes: subscription, management group, and tenant.
|
||||
service Bicep {
|
||||
rpc DeploymentGroupCreate (DeploymentGroupRequest) returns (DeploymentResult);
|
||||
rpc DeleteGroup (DeleteGroupRequest) returns (DeploymentResult);
|
||||
}
|
||||
|
||||
message DeploymentGroupRequest {
|
||||
string bicep_file_path = 1;
|
||||
string parameter_file_path = 2;
|
||||
string resource_group_name = 3;
|
||||
string subscription_name_or_id = 4;
|
||||
}
|
||||
|
||||
message DeleteGroupRequest {
|
||||
string resource_group_name = 1;
|
||||
string subscription_name_or_id = 2;
|
||||
}
|
||||
|
||||
message DeploymentResult {
|
||||
bool success = 1;
|
||||
string error_message = 2;
|
||||
}
|
|
@ -0,0 +1,19 @@
|
|||
syntax = "proto3";
|
||||
|
||||
package benchpress;
|
||||
|
||||
option csharp_namespace = "BenchPress.TestEngine";
|
||||
|
||||
service ResourceGroup {
|
||||
rpc GetResourceGroup (ResourceGroupRequest) returns (ResourceGroupResponse);
|
||||
}
|
||||
|
||||
message ResourceGroupRequest {
|
||||
string resource_group_name = 1;
|
||||
string subscription_name_or_id = 2;
|
||||
}
|
||||
|
||||
message ResourceGroupResponse {
|
||||
bool existed = 1;
|
||||
string resource_json = 2;
|
||||
}
|
Загрузка…
Ссылка в новой задаче