def get(self, id): """A specific koji build details.""" build = KojiBuildModel.get_by_id(int(id)) if not build: return response_maker( {"error": "No info about build stored in DB"}, status=HTTPStatus.NOT_FOUND.value, ) build_dict = { "build_id": build.build_id, "status": build.status, "chroot": build.target, "build_start_time": optional_timestamp(build.build_start_time), "build_finished_time": optional_timestamp(build.build_finished_time), "build_submitted_time": optional_timestamp(build.build_submitted_time), "commit_sha": build.commit_sha, "web_url": build.web_url, # from old data, sometimes build_logs_url is same and sometimes different to web_url "build_logs_url": build.build_logs_url, "srpm_build_id": build.get_srpm_build().id, "run_ids": sorted(run.id for run in build.runs), } build_dict.update(get_project_info_from_build(build)) return response_maker(build_dict)
def test_get_koji_build(clean_before_and_after, a_koji_build): assert a_koji_build.id b = KojiBuildModel.get_by_build_id(a_koji_build.build_id, TARGET) assert b.id == a_koji_build.id # let's make sure passing int works as well b = KojiBuildModel.get_by_build_id(int(a_koji_build.build_id), TARGET) assert b.id == a_koji_build.id b2 = KojiBuildModel.get_by_id(b.id) assert b2.id == a_koji_build.id
def test_get_koji_build(clean_before_and_after, a_koji_build_for_pr): assert a_koji_build_for_pr.id b = KojiBuildModel.get_by_build_id(a_koji_build_for_pr.build_id, SampleValues.target) assert b.id == a_koji_build_for_pr.id # let's make sure passing int works as well b = KojiBuildModel.get_by_build_id(int(a_koji_build_for_pr.build_id), SampleValues.target) assert b.id == a_koji_build_for_pr.id b2 = KojiBuildModel.get_by_id(b.id) assert b2.id == a_koji_build_for_pr.id
def koji_build_info(id_): log_service_versions() build = KojiBuildModel.get_by_id(id_) if build: return _get_build_info(build, build_description="Koji build") return f"We can't find any info about Koji build {id_}.\n", 404