feat: make init_deployment api support compute_unit
This commit is contained in:
parent
6b9bdfb205
commit
ad3b2ea938
@ -25,6 +25,7 @@ class Deployment(Document):
|
|||||||
deployment_git_url: str
|
deployment_git_url: str
|
||||||
deployment_git_sha256: str
|
deployment_git_sha256: str
|
||||||
deployment_reason: str
|
deployment_reason: str
|
||||||
|
compute_unit: Optional[int] = None # None for old data
|
||||||
deployment_app_url: str = "" # URL to access the deployed application, keep it empty to be filled later
|
deployment_app_url: str = "" # URL to access the deployed application, keep it empty to be filled later
|
||||||
|
|
||||||
deployed_by: str
|
deployed_by: str
|
||||||
@ -46,6 +47,7 @@ class InitDeploymentRequest(BaseModel):
|
|||||||
user_id: str
|
user_id: str
|
||||||
reason: str = "not provided"
|
reason: str = "not provided"
|
||||||
ttl_hours: int = -1
|
ttl_hours: int = -1
|
||||||
|
compute_unit: Optional[int] = 0
|
||||||
|
|
||||||
class CheckDeploymentStatusRequest(BaseModel):
|
class CheckDeploymentStatusRequest(BaseModel):
|
||||||
product_id: str
|
product_id: str
|
||||||
@ -85,4 +87,5 @@ class DevOpsReconcileRequest(BaseModel):
|
|||||||
commit_sha256: Optional[str] = None
|
commit_sha256: Optional[str] = None
|
||||||
target_env: Literal["alpha", "prod"]
|
target_env: Literal["alpha", "prod"]
|
||||||
ttl_control: bool = False
|
ttl_control: bool = False
|
||||||
ttl: int = 10800
|
ttl: int = 10800
|
||||||
|
compute_unit: Optional[int] = 0
|
||||||
@ -58,6 +58,7 @@ class DeploymentService:
|
|||||||
deployed_by = request.user_id,
|
deployed_by = request.user_id,
|
||||||
created_at = datetime.now(),
|
created_at = datetime.now(),
|
||||||
updated_at = datetime.now(),
|
updated_at = datetime.now(),
|
||||||
|
compute_unit = request.compute_unit,
|
||||||
)
|
)
|
||||||
|
|
||||||
await self._start_deployment(deployment)
|
await self._start_deployment(deployment)
|
||||||
@ -182,6 +183,7 @@ class DeploymentService:
|
|||||||
ttl_control=deployment.deployment_ttl_hours > 0,
|
ttl_control=deployment.deployment_ttl_hours > 0,
|
||||||
ttl=10800 if deployment.deployment_ttl_hours < 0 else deployment.deployment_ttl_hours * 60 * 60,
|
ttl=10800 if deployment.deployment_ttl_hours < 0 else deployment.deployment_ttl_hours * 60 * 60,
|
||||||
commit_sha256=deployment.deployment_git_sha256,
|
commit_sha256=deployment.deployment_git_sha256,
|
||||||
|
compute_unit=deployment.compute_unit
|
||||||
)
|
)
|
||||||
# send request to reoncile service
|
# send request to reoncile service
|
||||||
async with httpx.AsyncClient() as client:
|
async with httpx.AsyncClient() as client:
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user