Skip to content

Commit

Permalink
Extend pipelines API with Bodhi updates
Browse files Browse the repository at this point in the history
  • Loading branch information
lbarcziova committed Jan 22, 2024
1 parent 3484059 commit 89d2b29
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
3 changes: 3 additions & 0 deletions packit_service/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -1393,6 +1393,9 @@ def __query_merged_runs(cls):
func.array_agg(psql_array([PipelineModel.sync_release_run_id])).label(
"sync_release_run_id",
),
func.array_agg(psql_array([PipelineModel.bodhi_update_group_id])).label(
"bodhi_update_group_id",
),
)

@classmethod
Expand Down
12 changes: 10 additions & 2 deletions packit_service/service/api/runs.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
optional_timestamp,
BuildStatus,
TFTTestRunGroupModel,
BodhiUpdateGroupModel,
BodhiUpdateTargetModel,
)
from packit_service.service.api.parsers import indices, pagination_arguments
from packit_service.service.api.utils import (
Expand Down Expand Up @@ -72,6 +74,7 @@ def process_runs(runs):
"test_run": [],
"propose_downstream": [],
"pull_from_upstream": [],
"bodhi_update": [],
}

if srpm_build := SRPMBuildModel.get_by_id(pipeline.srpm_build_id):
Expand All @@ -88,6 +91,7 @@ def process_runs(runs):
("copr", CoprBuildGroupModel, pipeline.copr_build_group_id),
("koji", KojiBuildGroupModel, pipeline.koji_build_group_id),
("test_run", TFTTestRunGroupModel, pipeline.test_run_group_id),
("bodhi_update", BodhiUpdateGroupModel, pipeline.bodhi_update_group_id),
):
for packit_id in set(flatten_and_remove_none(packit_ids)):
group_row = Model.get_by_id(packit_id)
Expand All @@ -104,9 +108,12 @@ def process_runs(runs):
if "trigger" not in response_dict:
submitted_time = (
row.submitted_time
if isinstance(row, TFTTestRunTargetModel)
if isinstance(
row, (TFTTestRunTargetModel, BodhiUpdateTargetModel)
)
else row.build_submitted_time
)

response_dict["time_submitted"] = optional_timestamp(
submitted_time
)
Expand Down Expand Up @@ -171,11 +178,12 @@ def get(self, id):
result = {
"run_id": run.id,
"trigger": get_project_info_from_build(
run.srpm_build or run.sync_release_run
run.srpm_build or run.sync_release_run or run.bodhi_update_group
),
"srpm_build_id": run.srpm_build_id,
"copr_build_group_id": run.copr_build_group_id,
"koji_build_group_id": run.koji_build_group_id,
"test_run_group_id": run.test_run_group_id,
"bodhi_update_group_id": run.bodhi_update_group_id,
}
return response_maker(result)

0 comments on commit 89d2b29

Please sign in to comment.