mirror of
https://github.com/microsoft/onefuzz.git
synced 2025-06-18 20:58:06 +00:00
Adding New Default Image Config Value to IC. (#2434)
* Adding New Default Image Config Value to IC. * Removing forced image setting. * Updating Webhook Events. * Removing typo. * Updating webhook_events again. * Syncing webhook events. * Fixing check for os type. * Fixing import. * PR Suggestions. * Fix C# Model Typo. * Removing other refs to images. * Removing remaining refs to images outside of models. * Removing hardcoded image values from tests. * Update Default Proxy and Repro Images. Co-authored-by: Marc Greisen <mgreisen@microsoft.com>
This commit is contained in:
committed by
GitHub
parent
dc2c4649c8
commit
3f35d81f4b
@ -43,7 +43,6 @@ from .extension import proxy_manager_extensions
|
||||
from .orm import ORMMixin, QueryFilter
|
||||
from .proxy_forward import ProxyForward
|
||||
|
||||
PROXY_IMAGE = "Canonical:UbuntuServer:18.04-LTS:latest"
|
||||
PROXY_LOG_PREFIX = "scaleset-proxy: "
|
||||
PROXY_LIFESPAN = datetime.timedelta(days=7)
|
||||
|
||||
@ -70,6 +69,7 @@ class Proxy(ORMMixin):
|
||||
return ("region", "proxy_id")
|
||||
|
||||
def get_vm(self, config: InstanceConfig) -> VM:
|
||||
config = InstanceConfig.fetch()
|
||||
sku = config.proxy_vm_sku
|
||||
tags = None
|
||||
if config.vm_tags:
|
||||
@ -78,7 +78,7 @@ class Proxy(ORMMixin):
|
||||
name="proxy-%s" % base58.b58encode(self.proxy_id.bytes).decode(),
|
||||
region=self.region,
|
||||
sku=sku,
|
||||
image=PROXY_IMAGE,
|
||||
image=config.default_linux_vm_image,
|
||||
auth=self.auth,
|
||||
tags=tags,
|
||||
)
|
||||
|
@ -27,11 +27,6 @@ from .orm import ORMMixin, QueryFilter
|
||||
from .reports import get_report
|
||||
from .tasks.main import Task
|
||||
|
||||
DEFAULT_OS = {
|
||||
OS.linux: "Canonical:UbuntuServer:18.04-LTS:latest",
|
||||
OS.windows: "MicrosoftWindowsDesktop:Windows-10:20h2-pro:latest",
|
||||
}
|
||||
|
||||
DEFAULT_SKU = "Standard_DS1_v2"
|
||||
|
||||
|
||||
@ -56,14 +51,19 @@ class Repro(BASE_REPRO, ORMMixin):
|
||||
if isinstance(task, Error):
|
||||
raise Exception("previously existing task missing: %s" % self.task_id)
|
||||
|
||||
config = InstanceConfig.fetch()
|
||||
default_os = {
|
||||
OS.linux: config.default_linux_vm_image,
|
||||
OS.windows: config.default_windows_vm_image,
|
||||
}
|
||||
vm_config = task.get_repro_vm_config()
|
||||
if vm_config is None:
|
||||
# if using a pool without any scalesets defined yet, use reasonable defaults
|
||||
if task.os not in DEFAULT_OS:
|
||||
if task.os not in default_os:
|
||||
raise NotImplementedError("unsupported OS for repro %s" % task.os)
|
||||
|
||||
vm_config = TaskVm(
|
||||
region=get_base_region(), sku=DEFAULT_SKU, image=DEFAULT_OS[task.os]
|
||||
region=get_base_region(), sku=DEFAULT_SKU, image=default_os[task.os]
|
||||
)
|
||||
|
||||
if self.auth is None:
|
||||
|
@ -4,7 +4,7 @@
|
||||
# Licensed under the MIT License.
|
||||
|
||||
import azure.functions as func
|
||||
from onefuzztypes.enums import ErrorCode, ScalesetState
|
||||
from onefuzztypes.enums import OS, ErrorCode, ScalesetState
|
||||
from onefuzztypes.models import Error
|
||||
from onefuzztypes.requests import (
|
||||
ScalesetCreate,
|
||||
@ -78,6 +78,14 @@ def post(req: func.HttpRequest) -> func.HttpResponse:
|
||||
|
||||
region = request.region
|
||||
|
||||
if request.image is None:
|
||||
if pool.os == OS.windows:
|
||||
image = instance_config.default_windows_vm_image
|
||||
else:
|
||||
image = instance_config.default_linux_vm_image
|
||||
else:
|
||||
image = request.image
|
||||
|
||||
if request.vm_sku not in list_available_skus(region):
|
||||
return not_ok(
|
||||
Error(
|
||||
@ -97,7 +105,7 @@ def post(req: func.HttpRequest) -> func.HttpResponse:
|
||||
scaleset = Scaleset.create(
|
||||
pool_name=request.pool_name,
|
||||
vm_sku=request.vm_sku,
|
||||
image=request.image,
|
||||
image=image,
|
||||
region=region,
|
||||
size=request.size,
|
||||
spot_instances=request.spot_instances,
|
||||
|
Reference in New Issue
Block a user