Skip to content
This repository has been archived by the owner on Nov 1, 2023. It is now read-only.

Commit

Permalink
Reverting Enable/Disable App Function Changes - Force -net App Func…
Browse files Browse the repository at this point in the history
…tion To Only Run `Agent` Functions (#2660)

* Testing app function.

* Addding functions back.

* Fixing name.

* updating to string.

* Fixing bicep.

* Fixing function names.

* Update src/ApiService/ApiService/Functions/ReproVmss.cs

Co-authored-by: George Pollard <gpollard@microsoft.com>

* Adding route specifier.

* Update src/ApiService/ApiService/Functions/NodeAddSshKey.cs

Co-authored-by: George Pollard <gpollard@microsoft.com>

* Update src/ApiService/ApiService/Functions/WebhookLogs.cs

Co-authored-by: George Pollard <gpollard@microsoft.com>

* Update src/ApiService/ApiService/Functions/WebhookPing.cs

Co-authored-by: George Pollard <gpollard@microsoft.com>

* Fixing function names.

* Increasing pool_size

* Adding logging statements.

* Adding check for transient failure.

* Adding check to else.

* Fix var

* Adding retry logic to dbg_lnx

* FIxing retry.

* Maybe fixed integration test.

* Formatting.

* Adding try and fail logic.

* Changing error.

* Refactoring logic.

* Fixing logic.

* Logic.

* Removing bad comparison.

* Fixing.

* All ready.

* Switching back to call.

* Add.

* Fixing

* Adding quit back.

* Reversing cli changes.

* Removing bad file.

* Formatting.

Co-authored-by: George Pollard <gpollard@microsoft.com>
  • Loading branch information
nharper285 and Porges authored Dec 2, 2022
1 parent d17d50d commit 7fc6fc3
Show file tree
Hide file tree
Showing 9 changed files with 105 additions and 12 deletions.
2 changes: 1 addition & 1 deletion src/ApiService/ApiService/Functions/NodeAddSshKey.cs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ private async Async.Task<HttpResponseData> Post(HttpRequestData req) {

}

[Function("node_add_ssh_key")]
[Function("NodeAddSshKey")]
public Async.Task<HttpResponseData> Run([HttpTrigger(AuthorizationLevel.Anonymous, "POST", Route = "node/add_ssh_key")] HttpRequestData req) {
return _auth.CallIfUser(req, r => r.Method switch {
"POST" => Post(r),
Expand Down
2 changes: 1 addition & 1 deletion src/ApiService/ApiService/Functions/Proxy.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public Proxy(ILogTracer log, IEndpointAuthorization auth, IOnefuzzContext contex
_context = context;
}

[Function("proxy")]
[Function("Proxy")]
public Async.Task<HttpResponseData> Run([HttpTrigger(AuthorizationLevel.Anonymous, "GET", "PATCH", "POST", "DELETE")] HttpRequestData req) {
return _auth.CallIfUser(req, r => r.Method switch {
"GET" => Get(r),
Expand Down
4 changes: 2 additions & 2 deletions src/ApiService/ApiService/Functions/ReproVmss.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ public ReproVmss(ILogTracer log, IEndpointAuthorization auth, IOnefuzzContext co
_context = context;
}

[Function("repro_vms")]
public Async.Task<HttpResponseData> Run([HttpTrigger(AuthorizationLevel.Anonymous, "GET", "POST", "DELETE")] HttpRequestData req) {
[Function("ReproVms")]
public Async.Task<HttpResponseData> Run([HttpTrigger(AuthorizationLevel.Anonymous, "GET", "POST", "DELETE", Route = "repro_vms")] HttpRequestData req) {
return _auth.CallIfUser(req, r => r.Method switch {
"GET" => Get(r),
"POST" => Post(r),
Expand Down
2 changes: 1 addition & 1 deletion src/ApiService/ApiService/Functions/WebhookLogs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public WebhookLogs(ILogTracer log, IEndpointAuthorization auth, IOnefuzzContext
_context = context;
}

[Function("Webhook_logs")]
[Function("WebhookLogs")]
public Async.Task<HttpResponseData> Run(
[HttpTrigger(AuthorizationLevel.Anonymous, "POST", Route = "webhooks/logs")] HttpRequestData req) {
return _auth.CallIfUser(req, r => r.Method switch {
Expand Down
2 changes: 1 addition & 1 deletion src/ApiService/ApiService/Functions/WebhookPing.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public WebhookPing(ILogTracer log, IEndpointAuthorization auth, IOnefuzzContext
_context = context;
}

[Function("Webhook_ping")]
[Function("WebhookPing")]
public Async.Task<HttpResponseData> Run(
[HttpTrigger(AuthorizationLevel.Anonymous, "POST", Route = "webhooks/ping")] HttpRequestData req) {
return _auth.CallIfUser(req, r => r.Method switch {
Expand Down
80 changes: 80 additions & 0 deletions src/deployment/azuredeploy.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,46 @@ module functionSettings 'bicep-templates/function-settings.bicep' = {
monitor_account_name: operationalInsights.outputs.monitorAccountName
multi_tenant_domain: multi_tenant_domain
enable_profiler: enable_profiler
functions_disabled: '0'
agent_function_names: [
'AgentCanSchedule' //0
'AgentCommands' //1
'AgentEvents' //2
'AgentRegistration' //3
'Containers' //4
'Download' //5
'Info' //6
'InstanceConfig' //7
'Jobs' //8
'JobTemplates' //9
'JobTemplatesManage' //10
'Negotiate' //11
'Node' //12
'NodeAddSshKey' //13
'Notifications' //14
'Pool' //15
'Proxy' //16
'QueueFileChanges' //17
'QueueNodeHeartbeat' //18
'QueueProxyUpdate' //19
'QueueSignalrEvents' //20
'QueueTaskHeartbeat' //21
'QueueUpdates' //22
'QueueWebhooks' //23
'ReproVms' //24
'Scaleset' //25
'Tasks' //26
'TimerDaily' //27
'TimerProxy' //28
'TimerRepro' //29
'TimerRetention' //30
'TimerTasks' //31
'TimerWorkers' //32
'Tools' //33
'Webhooks' //34
'WebhooksLogs' //35
'WebhooksPing' //36
]
}
dependsOn: [
function
Expand All @@ -304,6 +344,46 @@ module netFunctionSettings 'bicep-templates/function-settings.bicep' = {
monitor_account_name: operationalInsights.outputs.monitorAccountName
multi_tenant_domain: multi_tenant_domain
enable_profiler: enable_profiler
functions_disabled: '1'
agent_function_names: [
'AgentCanSchedule' //0
'AgentCommands' //1
'AgentEvents' //2
'AgentRegistration' //3
'Containers' //4
'Download' //5
'Info' //6
'InstanceConfig' //7
'Jobs' //8
'JobTemplates' //9
'JobTemplatesManage' //10
'Negotiate' //11
'Node' //12
'NodeAddSshKey' //13
'Notifications' //14
'Pool' //15
'Proxy' //16
'QueueFileChanges' //17
'QueueNodeHeartbeat' //18
'QueueProxyUpdate' //19
'QueueSignalrEvents' //20
'QueueTaskHeartbeat' //21
'QueueUpdates' //22
'QueueWebhooks' //23
'ReproVms' //24
'Scaleset' //25
'Tasks' //26
'TimerDaily' //27
'TimerProxy' //28
'TimerRepro' //29
'TimerRetention' //30
'TimerTasks' //31
'TimerWorkers' //32
'Tools' //33
'Webhooks' //34
'WebhookLogs' //35
'WebhookPing' //36
]
}
dependsOn: [
netFunction
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ param allFunctions array
var disabledFunctions = [for f in allFunctions: 'AzureWebJobs.${f}.Disabled' ]

var disabledFunctionsAppSettings = {
'${disabledFunctions[0]}' : functions_disabled_setting
'${disabledFunctions[1]}' : functions_disabled_setting
'${disabledFunctions[2]}' : functions_disabled_setting
'${disabledFunctions[3]}' : functions_disabled_setting
'${disabledFunctions[0]}' : 0
'${disabledFunctions[1]}' : 0
'${disabledFunctions[2]}' : 0
'${disabledFunctions[3]}' : 0
'${disabledFunctions[4]}' : functions_disabled_setting

'${disabledFunctions[5]}' : functions_disabled_setting
Expand Down
15 changes: 14 additions & 1 deletion src/deployment/bicep-templates/function-settings.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,27 @@ param monitor_account_name string
param functions_worker_runtime string
param functions_extension_version string

param agent_function_names array
param functions_disabled string

param enable_profiler bool

var disabledFunctionName = 'disabledFunctions-${name}'

var telemetry = 'd7a73cf4-5a1a-4030-85e1-e5b25867e45a'

resource function 'Microsoft.Web/sites@2021-02-01' existing = {
name: name
}

module disabledFunctions 'function-settings-disabled-apps.bicep' = {
name: disabledFunctionName
params:{
functions_disabled_setting: functions_disabled
allFunctions: agent_function_names
}
}

var enable_profilers = enable_profiler ? {
APPINSIGHTS_PROFILERFEATURE_VERSION : '1.0.0'
DiagnosticServices_EXTENSION_VERSION: '~3'
Expand Down Expand Up @@ -63,5 +76,5 @@ resource functionSettings 'Microsoft.Web/sites/config@2021-03-01' = {
ONEFUZZ_KEYVAULT: keyvault_name
ONEFUZZ_OWNER: owner
ONEFUZZ_CLIENT_SECRET: client_secret
}, enable_profilers)
}, disabledFunctions.outputs.appSettings, enable_profilers)
}
2 changes: 1 addition & 1 deletion src/integration-tests/integration-test.py
Original file line number Diff line number Diff line change
Expand Up @@ -1247,4 +1247,4 @@ def main() -> int:


if __name__ == "__main__":
sys.exit(main())
sys.exit(main())

0 comments on commit 7fc6fc3

Please sign in to comment.