From 2ec5508669bb58d9f8c3cbc3fe069a0dc268683c Mon Sep 17 00:00:00 2001 From: Nathan Freeman Date: Fri, 29 Sep 2023 16:40:30 -0500 Subject: [PATCH] add uses to Task model and schema --- src/api/src/backend/models.py | 3 ++- src/api/src/backend/views/http/requests.py | 14 +++++++++++--- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/src/api/src/backend/models.py b/src/api/src/backend/models.py index 4cb401cc..5e8529cc 100644 --- a/src/api/src/backend/models.py +++ b/src/api/src/backend/models.py @@ -430,7 +430,7 @@ class Meta: # Props id = models.CharField(validators=[validate_id], max_length=128) - _if = models.TextField(null=True) + condition = models.TextField(null=True) cache = models.BooleanField(null=True) depends_on = models.JSONField(null=True, default=list) description = models.TextField(null=True) @@ -447,6 +447,7 @@ class Meta: poll = models.BooleanField(null=True) retry_policy = models.CharField(max_length=32, default=EnumRetryPolicy.ExponentialBackoff) type = models.CharField(max_length=32, choices=TASK_TYPES) + uses = models.JSONField(null=True) uuid = models.UUIDField(primary_key=True, default=uuid.uuid4) # Image build specific properties diff --git a/src/api/src/backend/views/http/requests.py b/src/api/src/backend/views/http/requests.py index da0fbb4d..466a8ac9 100644 --- a/src/api/src/backend/views/http/requests.py +++ b/src/api/src/backend/views/http/requests.py @@ -492,17 +492,25 @@ class TaskExecutionProfile(BaseExecutionProfile): class GitRepository(BaseModel): url: str - branch: str = None # If no branch specified, the default branch will be used + branch: str = None + auth: GithubAuth = None + +class ClonedGitRepository(GitRepository): directory: str +class Uses(BaseModel): + repository: GitRepository + + class BaseTask(BaseModel): id: ID type: LiteralTaskTypes + uses: Uses = None depends_on: List[TaskDependency] = [] description: str = None execution_profile: TaskExecutionProfile = TaskExecutionProfile() input: Dict[str, TaskInputValue] = {} - _if: str = None + condition: str = None output: Dict[str, BaseOutputValue] = {} class Config: @@ -605,7 +613,7 @@ class RequestTask(BaseTask): class FunctionTask(BaseTask): type: Literal["function"] - git_repositories: List[GitRepository] = [] + git_repositories: List[ClonedGitRepository] = [] runtime: EnumRuntimeEnvironment packages: List[str] = [] installer: EnumInstaller