-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(api): add support for build status
The schema v5 will replace Builds.valid for Builds.status that has the same values as Tests.status. To prepare for this change, we map the current Builds.valid to its corresponding status (true -> PASS, false -> FAIL and null -> NULL) and change every system that used the old values for the new ones Closes #1022
- Loading branch information
Showing
52 changed files
with
1,566 additions
and
1,204 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,17 @@ | ||
build_status_map = {True: "valid", False: "invalid", None: "null"} | ||
from typing import Optional | ||
import os | ||
|
||
from kernelCI_app.constants.general import SCHEMA_VERSION_ENV | ||
from kernelCI_app.typeModels.databases import PASS_STATUS, FAIL_STATUS, NULL_STATUS | ||
|
||
|
||
def build_status_map(status: Optional[bool | str]) -> str: | ||
if isinstance(status, str): | ||
return status | ||
status_map = {True: PASS_STATUS, False: FAIL_STATUS, None: NULL_STATUS} | ||
return status_map.get(status) | ||
|
||
|
||
def valid_status_field() -> str: | ||
is_new_schema = os.getenv(SCHEMA_VERSION_ENV, "4") == "5" | ||
return "status" if is_new_schema else "valid" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.