mirror of
https://github.com/microsoft/onefuzz.git
synced 2025-06-15 11:28:09 +00:00
add '--endpoint' to 'repro_cmd' for integrations (#113)
This commit is contained in:
@ -12,14 +12,14 @@ from onefuzztypes.requests import AgentRegistrationGet, AgentRegistrationPost
|
|||||||
from onefuzztypes.responses import AgentRegistration
|
from onefuzztypes.responses import AgentRegistration
|
||||||
|
|
||||||
from ..onefuzzlib.agent_authorization import verify_token
|
from ..onefuzzlib.agent_authorization import verify_token
|
||||||
from ..onefuzzlib.azure.creds import get_fuzz_storage, get_instance_name
|
from ..onefuzzlib.azure.creds import get_fuzz_storage, get_instance_url
|
||||||
from ..onefuzzlib.azure.queue import get_queue_sas
|
from ..onefuzzlib.azure.queue import get_queue_sas
|
||||||
from ..onefuzzlib.pools import Node, NodeMessage, Pool
|
from ..onefuzzlib.pools import Node, NodeMessage, Pool
|
||||||
from ..onefuzzlib.request import not_ok, ok, parse_uri
|
from ..onefuzzlib.request import not_ok, ok, parse_uri
|
||||||
|
|
||||||
|
|
||||||
def create_registration_response(machine_id: UUID, pool: Pool) -> func.HttpResponse:
|
def create_registration_response(machine_id: UUID, pool: Pool) -> func.HttpResponse:
|
||||||
base_address = "https://%s.azurewebsites.net" % get_instance_name()
|
base_address = get_instance_url()
|
||||||
events_url = "%s/api/agents/events" % base_address
|
events_url = "%s/api/agents/events" % base_address
|
||||||
commands_url = "%s/api/agents/commands" % base_address
|
commands_url = "%s/api/agents/commands" % base_address
|
||||||
work_queue = get_queue_sas(
|
work_queue = get_queue_sas(
|
||||||
|
@ -96,6 +96,11 @@ def get_instance_name() -> str:
|
|||||||
return os.environ["ONEFUZZ_INSTANCE_NAME"]
|
return os.environ["ONEFUZZ_INSTANCE_NAME"]
|
||||||
|
|
||||||
|
|
||||||
|
@cached
|
||||||
|
def get_instance_url() -> str:
|
||||||
|
return "https://%s.azurewebsites.net" % get_instance_name()
|
||||||
|
|
||||||
|
|
||||||
@cached(ttl=60)
|
@cached(ttl=60)
|
||||||
def get_regions() -> List[str]:
|
def get_regions() -> List[str]:
|
||||||
client = mgmt_client_factory(SubscriptionClient)
|
client = mgmt_client_factory(SubscriptionClient)
|
||||||
|
@ -12,7 +12,7 @@ from onefuzztypes.models import AgentConfig, ReproConfig
|
|||||||
from onefuzztypes.primitives import Extension, Region
|
from onefuzztypes.primitives import Extension, Region
|
||||||
|
|
||||||
from .azure.containers import get_container_sas_url, get_file_sas_url, save_blob
|
from .azure.containers import get_container_sas_url, get_file_sas_url, save_blob
|
||||||
from .azure.creds import get_func_storage, get_instance_name
|
from .azure.creds import get_func_storage, get_instance_url
|
||||||
from .azure.monitor import get_monitor_settings
|
from .azure.monitor import get_monitor_settings
|
||||||
from .reports import get_report
|
from .reports import get_report
|
||||||
|
|
||||||
@ -91,7 +91,7 @@ def dependency_extension(region: Region, os: OS) -> Optional[Extension]:
|
|||||||
def build_pool_config(pool_name: str) -> str:
|
def build_pool_config(pool_name: str) -> str:
|
||||||
agent_config = AgentConfig(
|
agent_config = AgentConfig(
|
||||||
pool_name=pool_name,
|
pool_name=pool_name,
|
||||||
onefuzz_url="https://%s.azurewebsites.net" % get_instance_name(),
|
onefuzz_url=get_instance_url(),
|
||||||
instrumentation_key=os.environ.get("APPINSIGHTS_INSTRUMENTATIONKEY"),
|
instrumentation_key=os.environ.get("APPINSIGHTS_INSTRUMENTATIONKEY"),
|
||||||
telemetry_key=os.environ.get("ONEFUZZ_TELEMETRY"),
|
telemetry_key=os.environ.get("ONEFUZZ_TELEMETRY"),
|
||||||
)
|
)
|
||||||
|
@ -11,6 +11,7 @@ from onefuzztypes.enums import ErrorCode
|
|||||||
from onefuzztypes.models import Error, Report
|
from onefuzztypes.models import Error, Report
|
||||||
|
|
||||||
from ..azure.containers import auth_download_url
|
from ..azure.containers import auth_download_url
|
||||||
|
from ..azure.creds import get_instance_url
|
||||||
from ..jobs import Job
|
from ..jobs import Job
|
||||||
from ..tasks.config import get_setup_container
|
from ..tasks.config import get_setup_container
|
||||||
from ..tasks.main import Task
|
from ..tasks.main import Task
|
||||||
@ -72,7 +73,7 @@ class Render:
|
|||||||
"target_url": self.target_url,
|
"target_url": self.target_url,
|
||||||
"report_container": self.container,
|
"report_container": self.container,
|
||||||
"report_filename": self.filename,
|
"report_filename": self.filename,
|
||||||
"repro_cmd": "onefuzz repro create_and_connect %s %s"
|
"repro_cmd": "onefuzz --endpoint %s repro create_and_connect %s %s"
|
||||||
% (self.container, self.filename),
|
% (get_instance_url(), self.container, self.filename),
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
@ -12,7 +12,7 @@ from onefuzztypes.enums import Compare, ContainerPermission, ContainerType, Task
|
|||||||
from onefuzztypes.models import TaskConfig, TaskDefinition, TaskUnitConfig
|
from onefuzztypes.models import TaskConfig, TaskDefinition, TaskUnitConfig
|
||||||
|
|
||||||
from ..azure.containers import blob_exists, get_container_sas_url, get_containers
|
from ..azure.containers import blob_exists, get_container_sas_url, get_containers
|
||||||
from ..azure.creds import get_fuzz_storage, get_instance_name
|
from ..azure.creds import get_fuzz_storage, get_instance_url
|
||||||
from ..azure.queue import get_queue_sas
|
from ..azure.queue import get_queue_sas
|
||||||
from .defs import TASK_DEFINITIONS
|
from .defs import TASK_DEFINITIONS
|
||||||
|
|
||||||
@ -184,8 +184,7 @@ def build_task_config(
|
|||||||
account_id=os.environ["ONEFUZZ_FUNC_STORAGE"],
|
account_id=os.environ["ONEFUZZ_FUNC_STORAGE"],
|
||||||
add=True,
|
add=True,
|
||||||
),
|
),
|
||||||
back_channel_address="https://%s.azurewebsites.net/api/back_channel"
|
back_channel_address="https://%s/api/back_channel" % (get_instance_url()),
|
||||||
% (get_instance_name()),
|
|
||||||
)
|
)
|
||||||
|
|
||||||
if definition.monitor_queue:
|
if definition.monitor_queue:
|
||||||
|
@ -10,7 +10,7 @@ from onefuzztypes.enums import ErrorCode, PoolState
|
|||||||
from onefuzztypes.models import AgentConfig, Error
|
from onefuzztypes.models import AgentConfig, Error
|
||||||
from onefuzztypes.requests import PoolCreate, PoolSearch, PoolStop
|
from onefuzztypes.requests import PoolCreate, PoolSearch, PoolStop
|
||||||
|
|
||||||
from ..onefuzzlib.azure.creds import get_instance_name
|
from ..onefuzzlib.azure.creds import get_instance_url
|
||||||
from ..onefuzzlib.pools import Pool
|
from ..onefuzzlib.pools import Pool
|
||||||
from ..onefuzzlib.request import not_ok, ok, parse_request
|
from ..onefuzzlib.request import not_ok, ok, parse_request
|
||||||
|
|
||||||
@ -18,7 +18,7 @@ from ..onefuzzlib.request import not_ok, ok, parse_request
|
|||||||
def set_config(pool: Pool) -> Pool:
|
def set_config(pool: Pool) -> Pool:
|
||||||
pool.config = AgentConfig(
|
pool.config = AgentConfig(
|
||||||
pool_name=pool.name,
|
pool_name=pool.name,
|
||||||
onefuzz_url="https://%s.azurewebsites.net" % get_instance_name(),
|
onefuzz_url=get_instance_url(),
|
||||||
instrumentation_key=os.environ.get("APPINSIGHTS_INSTRUMENTATIONKEY"),
|
instrumentation_key=os.environ.get("APPINSIGHTS_INSTRUMENTATIONKEY"),
|
||||||
telemetry_key=os.environ.get("ONEFUZZ_TELEMETRY"),
|
telemetry_key=os.environ.get("ONEFUZZ_TELEMETRY"),
|
||||||
)
|
)
|
||||||
|
Reference in New Issue
Block a user