Skip to content

Commit 801545f

Browse files
committed
enable external SDK
1 parent 483ab47 commit 801545f

File tree

70 files changed

+690
-430
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

70 files changed

+690
-430
lines changed

azure-pipelines-e2e-integration-tests.yml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,14 @@ trigger: none
99
strategy:
1010
matrix:
1111
linux:
12-
imageName: 'ubuntu-latest'
12+
imageName: 'MMSUbuntu20.04TLS'
1313
windows:
14-
imageName: 'windows-latest'
14+
imageName: 'MMS2019TLS'
1515

1616
pool:
17-
vmImage: $(imageName)
17+
name: '1ES-Hosted-AzFunc'
18+
demands:
19+
- ImageOverride -equals $(imageName)
1820

1921
steps:
2022
- pwsh: |

build.ps1

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -168,12 +168,6 @@ if (!$NoBuild.IsPresent) {
168168
Get-Item "$PSScriptRoot/src/Modules/PackageManagement/1.1.7.0/fullclr" -ErrorAction SilentlyContinue |
169169
Remove-Item -Recurse -Force -ErrorAction SilentlyContinue
170170

171-
# TODO: Remove this once the SDK properly bundles modules
172-
Get-WebFile -Url 'https://github.com/raw/PowerShell/PowerShell/master/src/Modules/Windows/Microsoft.PowerShell.Utility/Microsoft.PowerShell.Utility.psd1' `
173-
-OutFile "$PSScriptRoot/src/Modules/Microsoft.PowerShell.Utility/Microsoft.PowerShell.Utility.psd1"
174-
Get-WebFile -Url 'https://github.com/raw/PowerShell/PowerShell/master/src/Modules/Windows/Microsoft.PowerShell.Management/Microsoft.PowerShell.Management.psd1' `
175-
-OutFile "$PSScriptRoot/src/Modules/Microsoft.PowerShell.Management/Microsoft.PowerShell.Management.psd1"
176-
177171
dotnet publish -c $Configuration "/p:BuildNumber=$BuildNumber" $PSScriptRoot
178172

179173
if ($AddSBOM)

protobuf/CODEOWNERS

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# See https://help.github.com/articles/about-codeowners/
2+
# for more info about CODEOWNERS file
3+
#
4+
# It uses the same pattern rule for gitignore file
5+
# https://git-scm.com/docs/gitignore#_pattern_format
6+
7+
8+
9+
# AZURE FUNCTIONS TEAM
10+
# For all file changes, github would automatically
11+
# include the following people in the PRs.
12+
# Language owners should get notified of any new changes to the proto file.
13+
14+
src/proto/FunctionRpc.proto @vrdmr @gavin-aguiar @YunchuWang @surgupta-msft @satvu @ejizba @alrod @anatolib @kaibocai @shreyas-gopalakrishna @amamounelsayed @Francisco-Gamino

protobuf/README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,8 @@ From within the Azure Functions language worker repo:
4242
- Be sure to include details of the release
4343
2. Create a release version, following semantic versioning guidelines ([semver.org](https://semver.org/))
4444
3. Tag the version with the pattern: `v<M>.<m>.<p>-protofile` (example: `v1.1.0-protofile`)
45-
3. Merge `dev` to `master`
45+
4. Merge `dev` to `main`
46+
5. Run the release you'd created
4647

4748
## Consuming FunctionRPC.proto
4849
*Note: Update versionNumber before running following commands*

protobuf/src/proto/FunctionRpc.proto

Lines changed: 58 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -26,21 +26,18 @@ message StreamingMessage {
2626
oneof content {
2727

2828
// Worker initiates stream
29-
StartStream start_stream = 20;
29+
StartStream start_stream = 20;
3030

3131
// Host sends capabilities/init data to worker
3232
WorkerInitRequest worker_init_request = 17;
3333
// Worker responds after initializing with its capabilities & status
3434
WorkerInitResponse worker_init_response = 16;
3535

36-
// Worker periodically sends empty heartbeat message to host
37-
WorkerHeartbeat worker_heartbeat = 15;
38-
3936
// Host sends terminate message to worker.
4037
// Worker terminates if it can, otherwise host terminates after a grace period
4138
WorkerTerminate worker_terminate = 14;
4239

43-
// Add any worker relevant status to response
40+
// Host periodically sends status request to the worker
4441
WorkerStatusRequest worker_status_request = 12;
4542
WorkerStatusResponse worker_status_response = 13;
4643

@@ -49,25 +46,25 @@ message StreamingMessage {
4946

5047
// Worker requests a desired action (restart worker, reload function)
5148
WorkerActionResponse worker_action_response = 7;
52-
49+
5350
// Host sends required metadata to worker to load function
5451
FunctionLoadRequest function_load_request = 8;
5552
// Worker responds after loading with the load result
5653
FunctionLoadResponse function_load_response = 9;
57-
54+
5855
// Host requests a given invocation
5956
InvocationRequest invocation_request = 4;
6057

6158
// Worker responds to a given invocation
6259
InvocationResponse invocation_response = 5;
6360

64-
// Host sends cancel message to attempt to cancel an invocation.
61+
// Host sends cancel message to attempt to cancel an invocation.
6562
// If an invocation is cancelled, host will receive an invocation response with status cancelled.
6663
InvocationCancel invocation_cancel = 21;
6764

6865
// Worker logs a message back to the host
6966
RpcLog rpc_log = 2;
70-
67+
7168
FunctionEnvironmentReloadRequest function_environment_reload_request = 25;
7269

7370
FunctionEnvironmentReloadResponse function_environment_reload_response = 26;
@@ -78,22 +75,28 @@ message StreamingMessage {
7875

7976
// Worker indexing message types
8077
FunctionsMetadataRequest functions_metadata_request = 29;
81-
FunctionMetadataResponses function_metadata_responses = 30;
78+
FunctionMetadataResponse function_metadata_response = 30;
79+
80+
// Host sends required metadata to worker to load functions
81+
FunctionLoadRequestCollection function_load_request_collection = 31;
82+
83+
// Host gets the list of function load responses
84+
FunctionLoadResponseCollection function_load_response_collection = 32;
8285
}
8386
}
8487

8588
// Process.Start required info
8689
// connection details
8790
// protocol type
88-
// protocol version
91+
// protocol version
8992

9093
// Worker sends the host information identifying itself
9194
message StartStream {
9295
// id of the worker
9396
string worker_id = 2;
9497
}
9598

96-
// Host requests the worker to initialize itself
99+
// Host requests the worker to initialize itself
97100
message WorkerInitRequest {
98101
// version of the host sending init request
99102
string host_version = 1;
@@ -107,6 +110,9 @@ message WorkerInitRequest {
107110

108111
// Full path of worker.config.json location
109112
string worker_directory = 4;
113+
114+
// base directory for function app
115+
string function_app_directory = 5;
110116
}
111117

112118
// Worker responds with the result of initializing itself
@@ -141,11 +147,6 @@ message StatusResult {
141147
repeated RpcLog logs = 3;
142148
}
143149

144-
// TODO: investigate grpc heartbeat - don't limit to grpc implemention
145-
146-
// Message is empty by design - Will add more fields in future if needed
147-
message WorkerHeartbeat {}
148-
149150
// Warning before killing the process after grace_period
150151
// Worker self terminates ..no response on this
151152
message WorkerTerminate {
@@ -176,24 +177,25 @@ message FileChangeEventRequest {
176177

177178
// Indicates whether worker reloaded successfully or needs a restart
178179
message WorkerActionResponse {
179-
// indicates whether a restart is needed, or reload succesfully
180+
// indicates whether a restart is needed, or reload successfully
180181
enum Action {
181182
Restart = 0;
182183
Reload = 1;
183184
}
184-
185+
185186
// action for this response
186187
Action action = 1;
187188

188189
// text reason for the response
189190
string reason = 2;
190191
}
191192

192-
// NOT USED
193-
message WorkerStatusRequest{
193+
// Used by the host to determine worker health
194+
message WorkerStatusRequest {
194195
}
195196

196-
// NOT USED
197+
// Worker responds with status message
198+
// TODO: Add any worker relevant status to response
197199
message WorkerStatusResponse {
198200
}
199201

@@ -220,7 +222,17 @@ message CloseSharedMemoryResourcesResponse {
220222
map<string, bool> close_map_results = 1;
221223
}
222224

223-
// Host tells the worker to load a Function
225+
// Host tells the worker to load a list of Functions
226+
message FunctionLoadRequestCollection {
227+
repeated FunctionLoadRequest function_load_requests = 1;
228+
}
229+
230+
// Host gets the list of function load responses
231+
message FunctionLoadResponseCollection {
232+
repeated FunctionLoadResponse function_load_responses = 1;
233+
}
234+
235+
// Load request of a single Function
224236
message FunctionLoadRequest {
225237
// unique function identifier (avoid name collisions, facilitate reload case)
226238
string function_id = 1;
@@ -252,7 +264,7 @@ message RpcFunctionMetadata {
252264

253265
// base directory for the Function
254266
string directory = 1;
255-
267+
256268
// Script file specified
257269
string script_file = 2;
258270

@@ -273,6 +285,12 @@ message RpcFunctionMetadata {
273285

274286
// Raw binding info
275287
repeated string raw_bindings = 10;
288+
289+
// unique function identifier (avoid name collisions, facilitate reload case)
290+
string function_id = 13;
291+
292+
// A flag indicating if managed dependency is enabled or not
293+
bool managed_dependency_enabled = 14;
276294
}
277295

278296
// Host tells worker it is ready to receive metadata
@@ -282,12 +300,15 @@ message FunctionsMetadataRequest {
282300
}
283301

284302
// Worker sends function metadata back to host
285-
message FunctionMetadataResponses {
303+
message FunctionMetadataResponse {
286304
// list of function indexing responses
287-
repeated FunctionLoadRequest function_load_requests_results = 1;
305+
repeated RpcFunctionMetadata function_metadata_results = 1;
288306

289307
// status of overall metadata request
290308
StatusResult result = 2;
309+
310+
// if set to true then host will perform indexing
311+
bool use_default_metadata_indexing = 3;
291312
}
292313

293314
// Host requests worker to invoke a Function
@@ -464,7 +485,7 @@ message BindingInfo {
464485
DataType data_type = 4;
465486
}
466487

467-
// Used to send logs back to the Host
488+
// Used to send logs back to the Host
468489
message RpcLog {
469490
// Matching ILogger semantics
470491
// https://github.com/aspnet/Logging/blob/9506ccc3f3491488fe88010ef8b9eb64594abf95/src/Microsoft.Extensions.Logging/Logger.cs
@@ -515,7 +536,7 @@ message RpcLog {
515536
map<string, TypedData> propertiesMap = 9;
516537
}
517538

518-
// Encapsulates an Exception
539+
// Encapsulates an Exception
519540
message RpcException {
520541
// Source of the exception
521542
string source = 3;
@@ -525,6 +546,14 @@ message RpcException {
525546

526547
// Textual message describing the exception
527548
string message = 2;
549+
550+
// Worker specifies whether exception is a user exception,
551+
// for purpose of application insights logging. Defaults to false.
552+
optional bool is_user_exception = 4;
553+
554+
// Type of exception. If it's a user exception, the type is passed along to app insights.
555+
// Otherwise, it's ignored for now.
556+
optional string type = 5;
528557
}
529558

530559
// Http cookie type. Note that only name and value are used for Http requests
@@ -569,7 +598,7 @@ message RpcHttpCookie {
569598
// TODO - solidify this or remove it
570599
message RpcHttp {
571600
string method = 1;
572-
string url = 2;
601+
string url = 2;
573602
map<string,string> headers = 3;
574603
TypedData body = 4;
575604
map<string,string> params = 10;

release_notes.md

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +0,0 @@
1-
* Bug fix: [Context.InstanceId can now be accessed](https://github.com/Azure/azure-functions-powershell-worker/issues/727)
2-
* Bug fix: [Data in External Events is now read and returned to orchestrator](https://github.com/Azure/azure-functions-powershell-worker/issues/68)
3-
* New feature (external contribution): [Get-TaskResult can now be used to obtain the result of an already-completed Durable Functions Task](https://github.com/Azure/azure-functions-powershell-worker/pull/786)

src/DependencyManagement/DependencySnapshotInstaller.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ namespace Microsoft.Azure.Functions.PowerShellWorker.DependencyManagement
99
using System.Collections.Generic;
1010
using System.Management.Automation;
1111
using System.Threading;
12+
using System.Diagnostics;
1213

1314
using Microsoft.Azure.Functions.PowerShellWorker.Utility;
1415

@@ -129,9 +130,12 @@ private void InstallModule(DependencyInfo module, string installingPath, PowerSh
129130
{
130131
try
131132
{
133+
var stopwatch = new Stopwatch();
134+
stopwatch.Start();
135+
132136
_moduleProvider.SaveModule(pwsh, module.Name, module.ExactVersion, installingPath);
133137

134-
var message = string.Format(PowerShellWorkerStrings.ModuleHasBeenInstalled, module.Name, module.ExactVersion);
138+
var message = string.Format(PowerShellWorkerStrings.ModuleHasBeenInstalled, module.Name, module.ExactVersion, stopwatch.ElapsedMilliseconds);
135139
logger.Log(isUserOnlyLog: false, LogLevel.Trace, message);
136140

137141
break;

0 commit comments

Comments
 (0)