mirror of
https://gitlab.com/itsulu-odoo/runboat.git
synced 2026-05-30 23:41:27 +00:00
Handle more timestamps
This commit is contained in:
parent
d2e23443e1
commit
9982c80b41
3 changed files with 8 additions and 7 deletions
|
|
@ -1,3 +1,4 @@
|
|||
import datetime
|
||||
from typing import List, Optional
|
||||
|
||||
from fastapi import APIRouter, Depends, HTTPException, status
|
||||
|
|
@ -35,7 +36,6 @@ class Repo(BaseModel):
|
|||
|
||||
|
||||
class Build(BaseModel):
|
||||
# TODO created: datetime.datetime
|
||||
name: str
|
||||
repo: str
|
||||
target_branch: str
|
||||
|
|
@ -44,6 +44,8 @@ class Build(BaseModel):
|
|||
image: str
|
||||
link: str
|
||||
status: models.BuildStatus
|
||||
created: datetime.datetime
|
||||
last_scaled: Optional[datetime.datetime]
|
||||
|
||||
class Config:
|
||||
orm_mode = True
|
||||
|
|
@ -51,7 +53,6 @@ class Build(BaseModel):
|
|||
|
||||
|
||||
class BranchOrPull(BaseModel):
|
||||
# created: datetime.datetime
|
||||
repo: str
|
||||
target_branch: str
|
||||
pr: Optional[int]
|
||||
|
|
|
|||
|
|
@ -84,7 +84,7 @@ class BuildsDb:
|
|||
build.status,
|
||||
build.todo,
|
||||
build.last_scaled,
|
||||
build.created,
|
||||
build.created.isoformat(),
|
||||
),
|
||||
)
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
import datetime
|
||||
import logging
|
||||
import uuid
|
||||
from datetime import datetime
|
||||
from enum import Enum
|
||||
from typing import Optional
|
||||
|
||||
|
|
@ -36,7 +36,7 @@ class Build(BaseModel):
|
|||
status: BuildStatus
|
||||
todo: Optional[BuildTodo]
|
||||
last_scaled: Optional[str]
|
||||
created: str
|
||||
created: datetime.datetime
|
||||
|
||||
@classmethod
|
||||
def from_deployment(cls, deployment: V1Deployment) -> "Build":
|
||||
|
|
@ -52,7 +52,7 @@ class Build(BaseModel):
|
|||
todo=deployment.metadata.annotations["runboat/todo"] or None,
|
||||
last_scaled=deployment.metadata.annotations.get("runboat/last-scaled")
|
||||
or None,
|
||||
created="TODO", # deployment.metadata.creationTimestamp,
|
||||
created=deployment.metadata.creation_timestamp,
|
||||
)
|
||||
|
||||
@classmethod
|
||||
|
|
@ -124,7 +124,7 @@ class Build(BaseModel):
|
|||
# record last scaled time for the stopper and undeployer
|
||||
"op": "replace",
|
||||
"path": "/metadata/annotations/runboat~1last-scaled",
|
||||
"value": datetime.utcnow().isoformat() + "Z",
|
||||
"value": datetime.datetime.utcnow().isoformat() + "Z",
|
||||
},
|
||||
{
|
||||
# set replicas
|
||||
|
|
|
|||
Loading…
Reference in a new issue