Co-authored-by: stas <statis@microsoft.com>
This commit is contained in:
Stas 2021-03-16 10:21:08 -07:00 коммит произвёл GitHub
Родитель 6efa439c67
Коммит 15665589e6
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
38 изменённых файлов: 187 добавлений и 127 удалений

1
.gitignore поставляемый
Просмотреть файл

@ -82,6 +82,7 @@ __pycache__/
/cli/raft_sdk/.cache/token_cache.bin
/cli/raft-tools/auth/dotnet-core-3.1/*
/cli/raft-tools/auth/dotnet-5.0/*
/cli/defaults-*.json
/cli/local/

Просмотреть файл

@ -7866,7 +7866,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
---------------------------------------------------------
FSharp.Core 4.7.2 - MIT
FSharp.Core 5.0.1 - MIT
(c) 2008 VeriSign, Inc.

Просмотреть файл

@ -3,7 +3,7 @@
"shell" : "/bin/sh",
"run" : {
"shellArguments" : ["-c",
"sleep $RAFT_STARTUP_DELAY; dotnet /raft/agent/RestlerAgent.dll --agent-name ${RAFT_CONTAINER_NAME} --job-id ${RAFT_JOB_ID} --task-config-path ${RAFT_WORK_DIRECTORY}/task-config.json --work-directory ${RAFT_WORK_DIRECTORY} --restler-path /RESTler --app-insights-instrumentation-key ${RAFT_APP_INSIGHTS_KEY} --output-sas \"${RAFT_SB_OUT_SAS}\""
"date; sleep ${RAFT_STARTUP_DELAY}; date; dotnet /raft/agent/RestlerAgent.dll --agent-name ${RAFT_CONTAINER_NAME} --job-id ${RAFT_JOB_ID} --task-config-path ${RAFT_WORK_DIRECTORY}/task-config.json --work-directory ${RAFT_WORK_DIRECTORY} --restler-path /RESTler --app-insights-instrumentation-key ${RAFT_APP_INSIGHTS_KEY} --output-sas \"${RAFT_SB_OUT_SAS}\""
]
},
"idle" : {

Просмотреть файл

@ -32,16 +32,16 @@ steps:
- task: CopyFiles@2
displayName: 'Copy APIService Dockerfile'
inputs:
targetFolder: src/APIService/ApiService/bin/release/netcoreapp3.1/linux-musl-x64/publish/
targetFolder: src/APIService/ApiService/bin/release/net5.0/linux-musl-x64/publish/
sourceFolder: src/APIService/ApiService
contents: Dockerfile
# Create files with version information that will be used in the release pipeline
- script: echo $(imageTag) > src/APIService/ApiService/bin/release/netcoreapp3.1/linux-musl-x64/publish/imageTag.txt
- script: echo $(imageTagWithBuildDate) > src/APIService/ApiService/bin/release/netcoreapp3.1/linux-musl-x64/publish/imageTagWithBuildDate.txt
- script: echo $(imageTagLatest) > src/APIService/ApiService/bin/release/netcoreapp3.1/linux-musl-x64/publish/imageTagLatest.txt
- script: echo $(imageTag) > src/APIService/ApiService/bin/release/net5.0/linux-musl-x64/publish/imageTag.txt
- script: echo $(imageTagWithBuildDate) > src/APIService/ApiService/bin/release/net5.0/linux-musl-x64/publish/imageTagWithBuildDate.txt
- script: echo $(imageTagLatest) > src/APIService/ApiService/bin/release/net5.0/linux-musl-x64/publish/imageTagLatest.txt
- task: PublishPipelineArtifact@1
inputs:
targetPath: src/APIService/ApiService/bin/release/netcoreapp3.1/linux-musl-x64/publish
targetPath: src/APIService/ApiService/bin/release/net5.0/linux-musl-x64/publish
artifactName: apiservice

Просмотреть файл

@ -20,5 +20,5 @@ steps:
- task: PublishPipelineArtifact@1
inputs:
targetPath: src/Agent/AzureAuth/bin/release/netcoreapp3.1/publish/
targetPath: src/Agent/AzureAuth/bin/release/net5.0/publish/
artifactName: AzureAuth

Просмотреть файл

@ -23,12 +23,12 @@ steps:
- task: CopyFiles@2
displayName: 'Copy Orchestrator Dockerfile'
inputs:
targetFolder: src/Orchestrator/Orchestrator/bin/release/netcoreapp3.1/publish/
targetFolder: src/Orchestrator/Orchestrator/bin/release/net5.0/publish/
sourceFolder: src/Orchestrator
contents: Dockerfile
- task: PublishPipelineArtifact@1
inputs:
targetPath: src/Orchestrator/Orchestrator/bin/release/netcoreapp3.1/publish/
targetPath: src/Orchestrator/Orchestrator/bin/release/net5.0/publish/
artifactName: Orchestrator

Просмотреть файл

@ -23,11 +23,11 @@ steps:
- task: CopyFiles@2
displayName: 'Copy RESTlerAgent Dockerfile'
inputs:
targetFolder: src/Agent/RESTlerAgent/bin/release/netcoreapp3.1/publish/
targetFolder: src/Agent/RESTlerAgent/bin/release/net5.0/publish/
sourceFolder: src/Agent
contents: Dockerfile
- task: PublishPipelineArtifact@1
inputs:
targetPath: src/Agent/RESTlerAgent/bin/release/netcoreapp3.1/publish/
targetPath: src/Agent/RESTlerAgent/bin/release/net5.0/publish/
artifactName: RestlerAgent

Просмотреть файл

@ -20,5 +20,5 @@ steps:
- task: PublishPipelineArtifact@1
inputs:
targetPath: src/Agent/RaftResultAnalyzer/bin/release/netcoreapp3.1/publish/
targetPath: src/Agent/RaftResultAnalyzer/bin/release/net5.0/publish/
artifactName: RaftResultAnalyzer

Просмотреть файл

@ -21,7 +21,7 @@ steps:
- task: CopyFiles@2
displayName: 'Copy Test Infra Dockerfile'
inputs:
targetFolder: src/Test/TestInfraFunc/bin/release/netcoreapp3.1/publish/
targetFolder: src/Test/TestInfraFunc/bin/release/net5.0/publish/
sourceFolder: src/Test/
contents: Dockerfile
@ -30,12 +30,12 @@ steps:
- task: CopyFiles@2
displayName: 'Copy TestInfraFunc Dockerfile'
inputs:
targetFolder: src/Test/TestInfraFunc/bin/release/netcoreapp3.1/publish/
targetFolder: src/Test/TestInfraFunc/bin/release/net5.0/publish/
sourceFolder: src/Test
contents: Dockerfile
- task: PublishPipelineArtifact@1
inputs:
targetPath: src/Test/TestInfraFunc/bin/release/netcoreapp3.1/publish/
targetPath: src/Test/TestInfraFunc/bin/release/net5.0/publish/
artifactName: TestInfraFunc

Просмотреть файл

@ -16,7 +16,7 @@ steps:
condition: and(succeeded(), eq('${{parameters.BuildArtifactsLocation}}', 'current'))
inputs:
artifact: AzureAuth
path: $(Build.SourcesDirectory)/cli/raft-tools/auth/dotnet-core-3.1
path: $(Build.SourcesDirectory)/cli/raft-tools/auth/dotnet-5.0
- task: DownloadPipelineArtifact@2
displayName: 'Download Production pipeline artifact'
@ -29,7 +29,7 @@ steps:
# In this case it's the pipeline named 'build-production'
pipeline: 2925
artifact: AzureAuth
path: $(Build.SourcesDirectory)/cli/raft-tools/auth/dotnet-core-3.1
path: $(Build.SourcesDirectory)/cli/raft-tools/auth/dotnet-5.0
runVersion: 'latest'
- task: AzureCLI@2

Просмотреть файл

@ -18,7 +18,7 @@ steps:
project: 'raft'
pipeline: $(build-production-pipeline-id)
artifact: AzureAuth
path: $(Build.SourcesDirectory)/artifacts/cli/raft-tools/auth/dotnet-core-3.1
path: $(Build.SourcesDirectory)/artifacts/cli/raft-tools/auth/dotnet-5.0
runVersion: 'latest'
- task: ArchiveFiles@2

Просмотреть файл

@ -78,14 +78,14 @@ def run(args):
if defaults_json:
print(f"Loading defaults from command line: {defaults_json}")
defaults = json.loads(defaults_json, object_hook=json_hook)
defaults = json.loads(defaults_json)
if not validate(defaults):
print(defaults_help)
return
# check if defaults.json is set in the context and it exists
elif os.path.isfile(defaults_path):
with open(defaults_path, 'r') as d:
defaults = json.load(d, object_hook=json_hook)
defaults = json.load(d)
if not validate(defaults):
print(defaults_help)
return

Просмотреть файл

@ -667,7 +667,8 @@ class RaftServiceCLI():
f' --resource-group {rg}'
f' --plan "{self.definitions.asp}"'
' --functions-version 3'
' --os-type Linux --runtime dotnet'
' --os-type Linux --runtime dotnet-isolated'
' --runtime-version 5.0'
f' {ai}')
connection_string = az_json(
@ -757,7 +758,8 @@ class RaftServiceCLI():
f' --resource-group {rg}'
f' --plan "{self.definitions.asp}"'
' --functions-version 3'
' --os-type Linux --runtime dotnet'
' --os-type Linux --runtime dotnet-isolated'
' --runtime-version 5.0'
f' {ai}')
connection_string = az_json(
@ -947,7 +949,7 @@ class RaftServiceCLI():
json.dump(defaults, d, indent=4)
def test_az_version(self):
supported_versions = ['2.19.0', '2.19.1']
supported_versions = ['2.20.0']
# az sometimes reports the version with an asterisk.
# Perhaps when a new version of the CLI is available.
tested_az_cli_versions = (

Просмотреть файл

@ -8,7 +8,7 @@
{
"Container" : "swaggerapi/petstore",
"Ports" : [8080],
"ExpectedDurationUntilReady" : "00:00:30",
"ExpectedDurationUntilReady" : "00:01:00",
"shell" : "/bin/sh",
"PostRun" : {
"ShellArguments" : ["-c", "cp /var/log/*-requests.log $RAFT_WORK_DIRECTORY"],

Просмотреть файл

@ -14,7 +14,7 @@
{
"Container" : "swaggerapi/petstore",
"Ports" : [8080],
"ExpectedDurationUntilReady" : "00:00:30",
"ExpectedDurationUntilReady" : "00:01:00",
"Shell" : "/bin/sh",
"OutputFolder" : "petstore",
"PostRun" : {

Просмотреть файл

@ -16,7 +16,7 @@
{
"Container" : "swaggerapi/petstore3",
"Ports" : [8082],
"ExpectedDurationUntilReady" : "00:00:30",
"ExpectedDurationUntilReady" : "00:01:00",
"Shell" : "/bin/sh",
"Run" : {
"ShellArguments" : ["-c", "java -jar /swagger-petstore/jetty-runner.jar --log /var/log/yyyy_mm_dd-requests.log --port 8082 /swagger-petstore/server.war"]

Просмотреть файл

@ -30,7 +30,7 @@
{
"Container" : "swaggerapi/petstore3",
"Ports" : [8080],
"ExpectedDurationUntilReady" : "00:00:30",
"ExpectedDurationUntilReady" : "00:01:00",
"Shell" : "/bin/sh",
"PostRun" : {
"ShellArguments" : ["-c", "cp /var/log/*-requests.log $RAFT_WORK_DIRECTORY"],

Просмотреть файл

@ -5,7 +5,7 @@
{
"Container" : "swaggerapi/petstore3",
"Ports" : [8080],
"ExpectedDurationUntilReady" : "00:00:30",
"ExpectedDurationUntilReady" : "00:01:00",
"Shell" : "/bin/sh",
"PostRun" : {
"ShellArguments" : ["-c", "cp /var/log/*-requests.log $RAFT_WORK_DIRECTORY"],

Просмотреть файл

@ -5,7 +5,7 @@
{
"Container" : "swaggerapi/petstore3",
"Ports" : [8080],
"ExpectedDurationUntilReady" : "00:00:30",
"ExpectedDurationUntilReady" : "00:01:00",
"Shell" : "/bin/sh",
"PostRun" : {
"ShellArguments" : ["-c", "cp /var/log/*-requests.log $RAFT_WORK_DIRECTORY"],

Просмотреть файл

@ -2,7 +2,7 @@
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp3.1</TargetFramework>
<TargetFramework>net5.0</TargetFramework>
<AssemblyName>apiservice</AssemblyName>
</PropertyGroup>
@ -72,7 +72,7 @@
</ItemGroup>
<ItemGroup>
<PackageReference Update="FSharp.Core" Version="4.7.2" />
<PackageReference Update="FSharp.Core" Version="5.0.1" />
</ItemGroup>
</Project>

Просмотреть файл

@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
<TargetFramework>net5.0</TargetFramework>
<IsPackable>false</IsPackable>
<GenerateProgramFile>false</GenerateProgramFile>
@ -51,7 +51,7 @@
</ItemGroup>
<ItemGroup>
<PackageReference Update="FSharp.Core" Version="4.7.2" />
<PackageReference Update="FSharp.Core" Version="5.0.1" />
</ItemGroup>
</Project>

Просмотреть файл

@ -1,4 +1,4 @@
FROM mcr.microsoft.com/dotnet/core/runtime-deps:3.1-alpine
FROM mcr.microsoft.com/dotnet/runtime-deps:5.0-alpine
COPY . /raft/apiservice
RUN ls -al /raft/apiservice
RUN chmod +x /raft/apiservice/apiservice

Просмотреть файл

@ -2,7 +2,7 @@
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp3.1</TargetFramework>
<TargetFramework>net5.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
@ -15,7 +15,7 @@
</ItemGroup>
<ItemGroup>
<PackageReference Update="FSharp.Core" Version="4.7.2" />
<PackageReference Update="FSharp.Core" Version="5.0.1" />
</ItemGroup>
</Project>

Просмотреть файл

@ -1,3 +1,3 @@
FROM mcr.microsoft.com/restlerfuzzer/restler:v7.2.0
FROM mcr.microsoft.com/restlerfuzzer/restler:v7.3.0
COPY RestlerAgent /raft/agent
COPY RaftResultAnalyzer /raft/result-analyzer

Просмотреть файл

@ -254,10 +254,10 @@ let createRESTlerEngineParameters
| Raft.Job.Authentication.TokenRefresh.CommandLine cmd -> cmd
| Raft.Job.Authentication.TokenRefresh.MSAL secret ->
(sprintf "dotnet /raft-tools/auth/dotnet-core-3.1/AzureAuth.dll msal --secret \"%s\" --prepend-line \"{u'user1':{}}\"" secret)
(sprintf "dotnet /raft-tools/auth/dotnet-5.0/AzureAuth.dll msal --secret \"%s\" --prepend-line \"{u'user1':{}}\"" secret)
| Raft.Job.Authentication.TokenRefresh.TxtToken secret ->
(sprintf "dotnet /raft-tools/auth/dotnet-core-3.1/AzureAuth.dll token --secret \"%s\" --prepend-line \"{u'user1':{}}\"" secret)
(sprintf "dotnet /raft-tools/auth/dotnet-5.0/AzureAuth.dll token --secret \"%s\" --prepend-line \"{u'user1':{}}\"" secret)
}
printfn "Refreshable token configuration : %A" authConfig
Some authConfig

Просмотреть файл

@ -2,7 +2,7 @@
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp3.1</TargetFramework>
<TargetFramework>net5.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
@ -25,7 +25,7 @@
</ItemGroup>
<ItemGroup>
<PackageReference Update="FSharp.Core" Version="4.7.2" />
<PackageReference Update="FSharp.Core" Version="5.0.1" />
</ItemGroup>
</Project>

Просмотреть файл

@ -2,7 +2,7 @@
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp3.1</TargetFramework>
<TargetFramework>net5.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
@ -15,7 +15,7 @@
</ItemGroup>
<ItemGroup>
<PackageReference Update="FSharp.Core" Version="4.7.2" />
<PackageReference Update="FSharp.Core" Version="5.0.1" />
</ItemGroup>
</Project>

Просмотреть файл

@ -1,10 +1,5 @@
# IMPORTANT NOTE: List of all function-docker images can be found here
# https://hub.docker.com/_/microsoft-azure-functions-dotnet
# See FULL TAG LISTING at the bottom of the page for list of available images and versions
FROM mcr.microsoft.com/azure-functions/dotnet:3.0
FROM mcr.microsoft.com/azure-functions/dotnet-isolated:3.0-dotnet-isolated5.0
ENV AzureWebJobsScriptRoot=/home/site/wwwroot \
AzureFunctionsJobHost__Logging__Console__IsEnabled=true
AzureFunctionsJobHost__Logging__Console__IsEnabled=true
COPY . /home/site/wwwroot
COPY . /home/site/wwwroot

Просмотреть файл

@ -6,19 +6,51 @@ using System.Threading.Tasks;
using Microsoft.ApplicationInsights;
using Microsoft.Extensions.Logging;
using Microsoft.Azure.ServiceBus.Core;
using Microsoft.Azure.WebJobs;
using Microsoft.Azure.Functions.Worker;
using Microsoft.Extensions.Hosting;
using Microsoft.Azure.ServiceBus;
using Microsoft.Azure.Management.Fluent;
using Microsoft.Azure.Management.ResourceManager.Fluent;
using Microsoft.Azure.Cosmos.Table;
using System.Collections.Generic;
using Microsoft.Azure.Management.AppService.Fluent.Models;
using Microsoft.Azure.Management.Monitor.Fluent.Models;
using Microsoft.Azure.WebJobs.Extensions.EventGrid;
using Microsoft.Azure.EventGrid.Models;
namespace OrchestratorFunc
{
public class EventGridEvent
{
public string Id { get; set; }
public string Topic { get; set; }
public string Subject { get; set; }
public string EventType { get; set; }
public DateTime EventTime { get; set; }
public object Data { get; set; }
}
public class TimerInfo
{
public TimerScheduleStatus ScheduleStatus { get; set; }
public bool IsPastDue { get; set; }
}
public class TimerScheduleStatus
{
public DateTime Last { get; set; }
public DateTime Next { get; set; }
public DateTime LastUpdated { get; set; }
}
public static class Orchestrator
{
private static String GetSetting(String envVariableName)
@ -151,9 +183,10 @@ namespace OrchestratorFunc
}
}
[FunctionName("OnSecretChanged")]
public static void EventGridKeyVaultEvent([EventGridTrigger] EventGridEvent eventGridEvent, ILogger log)
[Function("OnSecretChanged")]
public static void EventGridKeyVaultEvent([EventGridTrigger] EventGridEvent eventGridEvent, FunctionContext context)
{
var log = context.GetLogger("OnSecretChanged");
log.LogInformation("OnSecretChanged: " + eventGridEvent.Data.ToString());
azure = Authenticate();
@ -166,11 +199,11 @@ namespace OrchestratorFunc
log.LogInformation("OnSecretChanged: Secrets updated from Key Vault");
}
[FunctionName(Raft.Message.ServiceBus.Queue.create)]
public static async Task CreateJob([ServiceBusTrigger(Raft.Message.ServiceBus.Queue.create, IsSessionsEnabled = true)] string createJobMessage, ILogger log)
[Function(Raft.Message.ServiceBus.Queue.create)]
public static async Task CreateJob([ServiceBusTrigger(Raft.Message.ServiceBus.Queue.create, IsSessionsEnabled = true)] string createJobMessage, FunctionContext context)
{
await OrchestratorLogic.ContainerInstances.createJob(
log,
context.GetLogger("JobCreate"),
secrets,
dockerConfigs,
toolConfigs,
@ -180,11 +213,11 @@ namespace OrchestratorFunc
createJobMessage);
}
[FunctionName(Raft.Message.ServiceBus.Queue.delete)]
public static async Task Delete([ServiceBusTrigger(Raft.Message.ServiceBus.Queue.delete, IsSessionsEnabled = true)]string deleteJobMessage, ILogger log)
[Function(Raft.Message.ServiceBus.Queue.delete)]
public static async Task Delete([ServiceBusTrigger(Raft.Message.ServiceBus.Queue.delete, IsSessionsEnabled = true)]string deleteJobMessage, FunctionContext context)
{
await OrchestratorLogic.ContainerInstances.delete(
log,
context.GetLogger("JobDelete"),
azure,
agentConfig,
communicationClients,
@ -192,36 +225,49 @@ namespace OrchestratorFunc
}
[FunctionName("jobstatus-handler")]
public static async Task Status([ServiceBusTrigger(Raft.Message.ServiceBus.Topic.events, "jobstatus-handler")]string statusMessage, ILogger log)
[Function("jobstatus-handler")]
public static async Task Status([ServiceBusTrigger(Raft.Message.ServiceBus.Topic.events, "jobstatus-handler")]string statusMessage, FunctionContext context)
{
await OrchestratorLogic.ContainerInstances.status(
log,
context.GetLogger("JobStatus"),
azure,
agentConfig,
communicationClients,
statusMessage);
}
[FunctionName("webhooks-handler")]
public static async Task WebhookMessage([ServiceBusTrigger(Raft.Message.ServiceBus.Topic.events, "webhooks-handler")] string webhookMessage, ILogger log)
[Function("webhooks-handler")]
public static async Task WebhookMessage([ServiceBusTrigger(Raft.Message.ServiceBus.Topic.events, "webhooks-handler")] string webhookMessage, FunctionContext context)
{
await OrchestratorLogic.ContainerInstances.webhookMessage(
log,
context.GetLogger("Webhooks"),
azure,
agentConfig,
communicationClients,
webhookMessage);
}
[FunctionName("raft-timer-garbage-collection")]
public static async Task TimerGarbageCollection([TimerTrigger("0 */1 * * * *")] TimerInfo t, ILogger log)
[Function("raft-timer-garbage-collection")]
public static async Task TimerGarbageCollection([TimerTrigger("0 */1 * * * *")] TimerInfo t, FunctionContext context)
{
await OrchestratorLogic.ContainerInstances.gc(
log,
context.GetLogger("GC"),
azure,
agentConfig,
communicationClients);
}
}
public class Program
{
public static void Main()
{
var host = new HostBuilder()
.ConfigureFunctionsWorkerDefaults()
.Build();
host.Run();
}
}
}

Просмотреть файл

@ -1,16 +1,21 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
<TargetFramework>net5.0</TargetFramework>
<OutputType>Exe</OutputType>
<AzureFunctionsVersion>v3</AzureFunctionsVersion>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Azure.Cosmos.Table" Version="1.0.8" />
<PackageReference Include="Microsoft.Azure.Functions.Worker" Version="1.0.0" />
<PackageReference Include="Microsoft.Azure.Functions.Worker.Core" Version="1.0.0" />
<PackageReference Include="Microsoft.Azure.Functions.Worker.Extensions.EventGrid" Version="2.1.0" />
<PackageReference Include="Microsoft.Azure.Functions.Worker.Extensions.Http" Version="3.0.12" />
<PackageReference Include="Microsoft.Azure.Functions.Worker.Extensions.ServiceBus" Version="4.2.1" />
<PackageReference Include="Microsoft.Azure.Functions.Worker.Extensions.Timer" Version="4.0.1" />
<PackageReference Include="Microsoft.Azure.Functions.Worker.Sdk" Version="1.0.1" />
<PackageReference Include="Microsoft.Azure.Management.ContainerInstance.Fluent" Version="1.34.0" />
<PackageReference Include="Microsoft.Azure.ServiceBus" Version="5.0.0" />
<PackageReference Include="Microsoft.Azure.Storage.Common" Version="11.2.2" />
<PackageReference Include="Microsoft.Azure.WebJobs.Extensions.EventGrid" Version="2.1.0" />
<PackageReference Include="Microsoft.Azure.WebJobs.Extensions.ServiceBus" Version="4.2.0" />
<PackageReference Include="Microsoft.NET.Sdk.Functions" Version="3.0.9" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\OrchestratorLogic\OrchestratorLogic.fsproj" />
@ -24,4 +29,4 @@
<CopyToPublishDirectory>Never</CopyToPublishDirectory>
</None>
</ItemGroup>
</Project>
</Project>

Просмотреть файл

@ -1,12 +1,7 @@
# IMPORTANT NOTE: List of all function-docker images can be found here
# https://hub.docker.com/_/microsoft-azure-functions-base
# https://mcr.microsoft.com/v2/azure-functions/base/tags/list
# To enable ssh & remote debugging on app service change the base image to the one below
# FROM mcr.microsoft.com/azure-functions/dotnet:3.0-appservice
FROM mcr.microsoft.com/azure-functions/dotnet:3.0
# FROM mcr.microsoft.com/azure-functions/dotnet-isolated:3.0-dotnet-isolated5.0-appservice
FROM mcr.microsoft.com/azure-functions/dotnet-isolated:3.0-dotnet-isolated5.0
ENV AzureWebJobsScriptRoot=/home/site/wwwroot \
AzureFunctionsJobHost__Logging__Console__IsEnabled=true
AzureFunctionsJobHost__Logging__Console__IsEnabled=true
COPY . /home/site/wwwroot
COPY . /home/site/wwwroot

Просмотреть файл

@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
<TargetFramework>net5.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
@ -30,7 +30,7 @@
</ItemGroup>
<ItemGroup>
<PackageReference Update="FSharp.Core" Version="4.7.2" />
<PackageReference Update="FSharp.Core" Version="5.0.1" />
</ItemGroup>
</Project>

Просмотреть файл

@ -1,10 +1,7 @@
# IMPORTANT NOTE: List of all function-docker images can be found here
# https://hub.docker.com/_/microsoft-azure-functions-dotnet
# See FULL TAG LISTING at the bottom of the page for list of available images and versions
FROM mcr.microsoft.com/azure-functions/dotnet:3.0
# To enable ssh & remote debugging on app service change the base image to the one below
# FROM mcr.microsoft.com/azure-functions/dotnet-isolated:3.0-dotnet-isolated5.0-appservice
FROM mcr.microsoft.com/azure-functions/dotnet-isolated:3.0-dotnet-isolated5.0
ENV AzureWebJobsScriptRoot=/home/site/wwwroot \
AzureFunctionsJobHost__Logging__Console__IsEnabled=true
AzureFunctionsJobHost__Logging__Console__IsEnabled=true
COPY . /home/site/wwwroot
COPY . /home/site/wwwroot

Просмотреть файл

@ -1,11 +1,11 @@
using System;
using System.IO;
using System.Net;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Azure.WebJobs;
using Microsoft.Azure.WebJobs.Extensions.Http;
using Microsoft.AspNetCore.Http;
using Microsoft.Azure.Functions.Worker;
using Microsoft.Azure.Functions.Worker.Http;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Hosting;
using Newtonsoft.Json;
namespace TestInfraFunc
@ -19,10 +19,13 @@ namespace TestInfraFunc
static private string StorageTableConnectionString = GetSetting("RAFT_STORAGE_TABLE_CONNECTION_STRING");
[FunctionName("webhooks-trigger-test")]
public static async Task<IActionResult> WebhookTriggerTest([HttpTrigger(AuthorizationLevel.Anonymous, "get", "post", Route = "test")] HttpRequest request, ILogger log)
[Function("webhooks-trigger-test")]
public static async Task<HttpResponseData> WebhookTriggerTest([HttpTrigger(AuthorizationLevel.Anonymous, "get", "post", Route = "test")] HttpRequestData request, FunctionContext executionContext)
{
string jobId = request.Query["jobId"];
var log = executionContext.GetLogger("WebhooksTrigger");
var query = System.Web.HttpUtility.ParseQueryString(request.Url.Query);
string jobId = query["jobId"];
if (string.IsNullOrEmpty(jobId))
{
@ -37,18 +40,20 @@ namespace TestInfraFunc
if (r.Item1)
{
log.LogInformation($"Returning validation code {r.Item2}");
return new OkObjectResult(r.Item2);
var response = request.CreateResponse(HttpStatusCode.OK);
await response.WriteAsJsonAsync(r.Item2);
return response;
}
else
{
await TestInfraLogic.WebhooksTest.post(log, StorageTableConnectionString, text);
return new OkResult();
return request.CreateResponse(HttpStatusCode.OK);
}
}
else
{
log.LogWarning($"Unhandled request method {request.Method} when job id is not set");
return new BadRequestResult();
return request.CreateResponse(HttpStatusCode.BadRequest);
}
}
else
@ -57,14 +62,30 @@ namespace TestInfraFunc
{
log.LogInformation($"Getting webhook messages for job {jobId}");
var results = await TestInfraLogic.WebhooksTest.get(log, StorageTableConnectionString, jobId);
return new OkObjectResult(results);
var response = request.CreateResponse(HttpStatusCode.OK);
await response.WriteAsJsonAsync(results);
return response;
}
else
{
log.LogWarning($"Unhandled request method {request.Method} when job id is {jobId}");
return new BadRequestResult();
return request.CreateResponse(HttpStatusCode.BadRequest);
}
}
}
}
public class Program
{
public static void Main()
{
var host = new HostBuilder()
.ConfigureFunctionsWorkerDefaults()
.Build();
host.Run();
}
}
}

Просмотреть файл

@ -1,10 +1,15 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
<TargetFramework>net5.0</TargetFramework>
<OutputType>Exe</OutputType>
<AzureFunctionsVersion>v3</AzureFunctionsVersion>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.NET.Sdk.Functions" Version="3.0.9" />
<PackageReference Include="Microsoft.Azure.Functions.Worker" Version="1.0.0" />
<PackageReference Include="Microsoft.Azure.Functions.Worker.Core" Version="1.0.0" />
<PackageReference Include="Microsoft.Azure.Functions.Worker.Extensions.Http" Version="3.0.12" />
<PackageReference Include="Microsoft.Azure.Functions.Worker.Sdk" Version="1.0.1" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\TestInfraLogic\TestInfraLogic.fsproj" />
@ -18,4 +23,4 @@
<CopyToPublishDirectory>Never</CopyToPublishDirectory>
</None>
</ItemGroup>
</Project>
</Project>

Просмотреть файл

@ -1,12 +1,5 @@
# IMPORTANT NOTE: List of all function-docker images can be found here
# https://hub.docker.com/_/microsoft-azure-functions-base
# https://mcr.microsoft.com/v2/azure-functions/base/tags/list
# To enable ssh & remote debugging on app service change the base image to the one below
# FROM mcr.microsoft.com/azure-functions/dotnet:3.0-appservice
FROM mcr.microsoft.com/azure-functions/dotnet:3.0
FROM mcr.microsoft.com/azure-functions/dotnet-isolated:3.0-dotnet-isolated5.0
ENV AzureWebJobsScriptRoot=/home/site/wwwroot \
AzureFunctionsJobHost__Logging__Console__IsEnabled=true
AzureFunctionsJobHost__Logging__Console__IsEnabled=true
COPY . /home/site/wwwroot
COPY . /home/site/wwwroot

Просмотреть файл

@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
<TargetFramework>net5.0</TargetFramework>
</PropertyGroup>
<ItemGroup>

Просмотреть файл

@ -1,4 +1,4 @@
FROM mcr.microsoft.com/dotnet/core/aspnet:3.1-alpine
FROM mcr.microsoft.com/dotnet/aspnet:5.0-alpine
COPY ./compiler /RESTler/compiler
COPY ./restler /RESTler/restler