Skip to content

Commit

Permalink
add uses to Task model and schema
Browse files Browse the repository at this point in the history
  • Loading branch information
nathandf committed Sep 29, 2023
1 parent 46adad1 commit 2ec5508
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
3 changes: 2 additions & 1 deletion src/api/src/backend/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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
Expand Down
14 changes: 11 additions & 3 deletions src/api/src/backend/views/http/requests.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 2ec5508

Please sign in to comment.