mirror of
https://github.com/microsoft/onefuzz.git
synced 2025-06-22 22:28:50 +00:00
Validate scriban from cli (#2800)
* Add validate scriban endpoint to cli * missed a file * Lint -- I miss C# * docs
This commit is contained in:
@ -7,7 +7,7 @@ from datetime import datetime
|
||||
from typing import Any, Dict, Generic, List, Optional, TypeVar, Union
|
||||
from uuid import UUID, uuid4
|
||||
|
||||
from pydantic import BaseModel, Field, root_validator, validator
|
||||
from pydantic import AnyHttpUrl, BaseModel, Field, root_validator, validator
|
||||
from pydantic.dataclasses import dataclass
|
||||
|
||||
from ._monkeypatch import _check_hotfix
|
||||
@ -193,8 +193,8 @@ class TaskConfig(BaseModel):
|
||||
task: TaskDetails
|
||||
vm: Optional[TaskVm]
|
||||
pool: Optional[TaskPool]
|
||||
containers: List[TaskContainers]
|
||||
tags: Dict[str, str]
|
||||
containers: Optional[List[TaskContainers]]
|
||||
tags: Optional[Dict[str, str]]
|
||||
debug: Optional[List[TaskDebugFlag]]
|
||||
colocate: Optional[bool]
|
||||
|
||||
@ -870,6 +870,18 @@ class ApiAccessRule(BaseModel):
|
||||
allowed_groups: List[UUID]
|
||||
|
||||
|
||||
class TemplateRenderContext(BaseModel):
|
||||
report: Report
|
||||
task: TaskConfig
|
||||
job: JobConfig
|
||||
report_url: AnyHttpUrl
|
||||
input_url: AnyHttpUrl
|
||||
target_url: AnyHttpUrl
|
||||
report_container: Container
|
||||
report_filename: str
|
||||
repro_cmd: str
|
||||
|
||||
|
||||
Endpoint = str
|
||||
# json dumps doesn't support UUID as dictionary key
|
||||
PrincipalID = str
|
||||
|
@ -20,7 +20,12 @@ from .enums import (
|
||||
TaskState,
|
||||
)
|
||||
from .events import EventType
|
||||
from .models import AutoScaleConfig, InstanceConfig, NotificationConfig
|
||||
from .models import (
|
||||
AutoScaleConfig,
|
||||
InstanceConfig,
|
||||
NotificationConfig,
|
||||
TemplateRenderContext,
|
||||
)
|
||||
from .primitives import Container, PoolName, Region
|
||||
from .webhooks import WebhookMessageFormat
|
||||
|
||||
@ -252,4 +257,9 @@ class InstanceConfigUpdate(BaseModel):
|
||||
config: InstanceConfig
|
||||
|
||||
|
||||
class TemplateValidationPost(BaseModel):
|
||||
template: str
|
||||
context: Optional[TemplateRenderContext]
|
||||
|
||||
|
||||
_check_hotfix()
|
||||
|
@ -9,7 +9,7 @@ from uuid import UUID
|
||||
from pydantic import BaseModel
|
||||
|
||||
from .enums import VmState
|
||||
from .models import Forward, NodeCommandEnvelope
|
||||
from .models import Forward, NodeCommandEnvelope, TemplateRenderContext
|
||||
from .primitives import Region
|
||||
|
||||
|
||||
@ -84,3 +84,8 @@ class PendingNodeCommand(BaseResponse):
|
||||
class CanSchedule(BaseResponse):
|
||||
allowed: bool
|
||||
work_stopped: bool
|
||||
|
||||
|
||||
class TemplateValidationResponse(BaseResponse):
|
||||
rendered_template: str
|
||||
available_context: TemplateRenderContext
|
||||
|
Reference in New Issue
Block a user