feat(devops): If ttl_hours < 0, the deployment will take effect permanently

This commit is contained in:
icecheng 2025-09-03 16:36:33 +08:00
parent 165e10c79d
commit 52f8715241
2 changed files with 3 additions and 3 deletions

View File

@ -45,7 +45,7 @@ class InitDeploymentRequest(BaseModel):
target_env: Literal["alpha", "prod"] target_env: Literal["alpha", "prod"]
user_id: str user_id: str
reason: str = "not provided" reason: str = "not provided"
ttl_hours: int = 3 ttl_hours: int = -1
class CheckDeploymentStatusRequest(BaseModel): class CheckDeploymentStatusRequest(BaseModel):
product_id: str product_id: str

View File

@ -179,8 +179,8 @@ class DeploymentService:
triggered_user_id=deployment.deployed_by, triggered_user_id=deployment.deployed_by,
causes=deployment.deployment_reason, causes=deployment.deployment_reason,
target_env=deployment.deployment_target_env, target_env=deployment.deployment_target_env,
ttl_control=True, ttl_control=deployment.deployment_ttl_hours > 0,
ttl=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,
) )
# send request to reoncile service # send request to reoncile service