Merge pull request 'feat(devops): If ttl_hours < 0, the deployment will take effect permanently' (#41) from feature/icecheng/ttl into dev

Reviewed-on: freeleaps/freeleaps-service-hub#41
Reviewed-by: jingyao1991 <jingyao1991@noreply.gitea.freeleaps.mathmast.com>
This commit is contained in:
icecheng 2025-09-04 01:03:06 +00:00
commit 45b4ebd83e
2 changed files with 3 additions and 3 deletions

View File

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

View File

@ -179,8 +179,8 @@ class DeploymentService:
triggered_user_id=deployment.deployed_by,
causes=deployment.deployment_reason,
target_env=deployment.deployment_target_env,
ttl_control=True,
ttl=deployment.deployment_ttl_hours * 60 * 60,
ttl_control=deployment.deployment_ttl_hours > 0,
ttl=10800 if deployment.deployment_ttl_hours < 0 else deployment.deployment_ttl_hours * 60 * 60,
commit_sha256=deployment.deployment_git_sha256,
)
# send request to reoncile service