dotanuki-labs / bitrise-reports

A tool to extract reports from projects you build on Bitrise 🤖
https://dotanuki-labs.github.io/bitrise-reports
MIT License
20 stars 1 forks source link

Could not parse/convert information from builds #164

Open pudge opened 2 years ago

pudge commented 2 years ago

On much of what I try to pull, across multiple apps, I get this error, using the docker image (pulled today).

$ docker run --rm ghcr.io/dotanuki-labs/bitrise-reports --token='...' --app=... --starting=2020-10-01 --ending=2021-10-31 --emulate-velocity

Analysing → ...

Found slug → ...
Starting → Thursday, 01 October (2020)
Ending   → Sunday, 31 October (2021)

*******************************************************************************
95 __safely_convert ...l/lib/python3.9/site-packages/bitrise_reports/bitrise.py"/usr/local/lib/python3.9/site-packages/bitrise_reports/bitrise.py", line 95
>  return callable(json, project)

89 conversion ...r/local/lib/python3.9/site-packages/bitrise_reports/bitrise.py"/usr/local/lib/python3.9/site-packages/bitrise_reports/bitrise.py", line 89
>  return [self.build_from(item, project) for item in finished_builds]

89 <listcomp> ...r/local/lib/python3.9/site-packages/bitrise_reports/bitrise.py"/usr/local/lib/python3.9/site-packages/bitrise_reports/bitrise.py", line 89
>  return [self.build_from(item, project) for item in finished_builds]

109 build_from .../local/lib/python3.9/site-packages/bitrise_reports/bitrise.py"/usr/local/lib/python3.9/site-packages/bitrise_reports/bitrise.py", line 109
>  branch = self.branch_from(json["original_build_params"])

133 branch_from ...local/lib/python3.9/site-packages/bitrise_reports/bitrise.py"/usr/local/lib/python3.9/site-packages/bitrise_reports/bitrise.py", line 133

 def status_from(self, status):
     return ExecutionStatus(status) if status in range(1, 3) else ExecutionStatus....

 def branch_from(self, build_parameters):
>      return None if build_parameters is None else build_parameters["branch"]

 def __dt(self, timestamp):

self: <bitrise_reports.bitrise.RawDataConverter object at 0x7fda1f75b2b0>
build_parameters: {'commit_hash': '...... [280]
KeyError:
branch

*******************************************************************************
8 <module> /usr/local/bin/bitrise-reports
"/usr/local/bin/bitrise-reports", line 8
>  sys.exit(main())

21 main /usr/local/lib/python3.9/site-packages/bitrise_reports/__init__.py
"/usr/local/lib/python3.9/site-packages/bitrise_reports/__init__.py", line 21
>  entrypoint.launch()

1137 __call__ /usr/local/lib/python3.9/site-packages/click/core.py
"/usr/local/lib/python3.9/site-packages/click/core.py", line 1137
>  return self.main(*args, **kwargs)

1062 main /usr/local/lib/python3.9/site-packages/click/core.py
"/usr/local/lib/python3.9/site-packages/click/core.py", line 1062
>  rv = self.invoke(ctx)

1404 invoke /usr/local/lib/python3.9/site-packages/click/core.py
"/usr/local/lib/python3.9/site-packages/click/core.py", line 1404
>  return ctx.invoke(self.callback, **ctx.params)

763 invoke /usr/local/lib/python3.9/site-packages/click/core.py
"/usr/local/lib/python3.9/site-packages/click/core.py", line 763
>  return __callback(*args, **kwargs)

55 launch ...sr/local/lib/python3.9/site-packages/bitrise_reports/entrypoint.py"/usr/local/lib/python3.9/site-packages/bitrise_reports/entrypoint.py", line 55>  app.execute()

21 execute /usr/local/lib/python3.9/site-packages/bitrise_reports/app.py
"/usr/local/lib/python3.9/site-packages/bitrise_reports/app.py", line 21
>  breakdowns, _ = self.project_analyser.analyse(project, starting, ending)

34 analyse ...r/local/lib/python3.9/site-packages/bitrise_reports/middleware.py"/usr/local/lib/python3.9/site-packages/bitrise_reports/middleware.py", line 34>  all_builds = self.bitrise.builds_for_project(project, starting, ending)

29 builds_for_project ...lib/python3.9/site-packages/bitrise_reports/bitrise.py"/usr/local/lib/python3.9/site-packages/bitrise_reports/bitrise.py", line 29
>  return self.converter.builds_from(raw_data, project)

91 builds_from .../local/lib/python3.9/site-packages/bitrise_reports/bitrise.py"/usr/local/lib/python3.9/site-packages/bitrise_reports/bitrise.py", line 91
>  return self.__safely_convert(conversion, json, project)

99 __safely_convert ...l/lib/python3.9/site-packages/bitrise_reports/bitrise.py"/usr/local/lib/python3.9/site-packages/bitrise_reports/bitrise.py", line 99
     try:
         return callable(json, project)
     except:
         cause = ErrorCause.DataConversion
         message = "Could not parse/convert information from builds"
>          raise BitriseReportsError(cause, message)

 def build_from(self, json, project):

callable: <function RawDataConverter.builds_from.<locals>.conversion at... [77]json: [{'triggered_at': '2021-10-28T00:16:02Z', 'started_on_worker_... [115660]project: BitriseProject(id='...', slug='...')
cause: ErrorCause.DataConversion
message: Could not parse/convert information from builds
self: <bitrise_reports.bitrise.RawDataConverter object at 0x7fda1f75b2b0>

bitrise_reports.errors.BitriseReportsError:
ErrorCause.DataConversion
Could not parse/convert information from builds
ubiratansoares commented 2 years ago

Hey @pudge, thanks for reporting !!

I'll have a look on this as soon as possible, maybe this is something weird with Bitrise's API.

ubiratansoares commented 2 years ago

@pudge Do you run scheduled builds? 👀

pudge commented 2 years ago

@pudge Do you run scheduled builds? 👀

I don’t think so. Generally our builds are run manually, or — more often — triggered from git activity (like pushing a certain tag format).