def get(self, id): """A specific koji build details. From koji_build hash, filled by worker.""" builds_list = KojiBuildModel.get_all_by_build_id(str(id)) if bool(builds_list.first()): build = builds_list[0] build_dict = build.api_structure.copy() build_dict["srpm_logs"] = (build.srpm_build.logs if build.srpm_build else None) build = make_response(dumps(build_dict)) build.headers["Content-Type"] = "application/json" return build if build else ("", HTTPStatus.NO_CONTENT) else: return "", HTTPStatus.NO_CONTENT
def get(self, id): """A specific koji build details. From koji_build hash, filled by worker.""" builds_list = KojiBuildModel.get_all_by_build_id(str(id)) if not builds_list.first(): return response_maker( {"error": "No info about build stored in DB"}, status=HTTPStatus.NOT_FOUND.value, ) build = builds_list[0] build_dict = { "build_id": build.build_id, "status": build.status, "build_start_time": optional_time(build.build_start_time), "build_finished_time": optional_time(build.build_finished_time), "build_submitted_time": optional_time(build.build_submitted_time), "chroot": build.target, "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, "pr_id": build.get_pr_id(), "branch_name": build.get_branch_name(), "ref": build.commit_sha, "release": build.get_release_tag(), } project = build.get_project() if project: build_dict["project_url"] = project.project_url build_dict["repo_namespace"] = project.namespace build_dict["repo_name"] = project.repo_name build_dict[ "srpm_logs"] = build.srpm_build.logs if build.srpm_build else None return response_maker(build_dict)