mirror of
https://github.com/microsoft/onefuzz.git
synced 2025-06-13 02:28:10 +00:00
Enable .NET functions in check-pr
for Agent-specific functions (#2119)
Enable the .NET functions for the agent by sending the agent the URI for the `-net` service. Also fix some things causing failures when using the .NET functions (`CouldShrinkScaleset` was not implemented). Improve error handling around table serialization/deserialization, fix an issue with int64/long mismatch between Python & C# code. ---- For `check-pr` testing: 1. There's a new parameter `enable_dotnet` which maps directly to the `--enable_dotnet` switch on `deploy.py`. 2. If you put `agent` there, all the `agent_*` functions will be enabled for .NET and disabled for Python. 3. If `agent_can_schedule` is disabled on the Python side, it will automatically tell the agent to use the .NET functions. So to test the .NET agent functions, do a `check-pr` run with `enable_dotnet` set to `agent` and it should all work.
This commit is contained in:
@ -4,6 +4,7 @@
|
||||
# Licensed under the MIT License.
|
||||
|
||||
import argparse
|
||||
import itertools
|
||||
import json
|
||||
import logging
|
||||
import os
|
||||
@ -1094,9 +1095,26 @@ class Client:
|
||||
|
||||
def enable_dotnet_func(self) -> None:
|
||||
if self.enable_dotnet:
|
||||
|
||||
def expand_agent(f: str) -> List[str]:
|
||||
# 'agent' is permitted as a shortcut for the agent functions
|
||||
if f == "agent":
|
||||
return [
|
||||
"agent_can_schedule",
|
||||
"agent_commands",
|
||||
"agent_events",
|
||||
"agent_registration",
|
||||
]
|
||||
else:
|
||||
return [f]
|
||||
|
||||
enable_dotnet = itertools.chain.from_iterable(
|
||||
map(expand_agent, self.enable_dotnet)
|
||||
)
|
||||
|
||||
func = shutil.which("az")
|
||||
assert func is not None
|
||||
for function_name in self.enable_dotnet:
|
||||
for function_name in enable_dotnet:
|
||||
format_name = function_name.split("_")
|
||||
dotnet_name = "".join(x.title() for x in format_name)
|
||||
error: Optional[subprocess.CalledProcessError] = None
|
||||
|
Reference in New Issue
Block a user