thoth-station / kebechet

I'm Kebechet bot, goddess of freshness - I will keep your source code fresh and up-to-date
24 stars 20 forks source link

Update manager did not respond to an update request #1122

Closed codificat closed 1 year ago

codificat commented 2 years ago

Bug description

I requested Kebechet to update deps on https://github.com/thoth-station/s2i-minimal-notebook/issues/574 but nothing happened

Steps to Reproduce

Steps to reproduce the behavior:

  1. Have Kebechet enabled on the repo
  2. Have the update manager configured in [.thoth.yaml]()
  3. Open an issue called Kebechet update

Actual behavior

Nothing seems to happen. After 3 hours, no new PR comes in to the repo and no updates are received in the issue

Expected behavior

Environment information

Kebechet v1.10.3

codificat commented 2 years ago

/sig user-experience

codificat commented 2 years ago

I was able to dig a bit more here: I opened https://github.com/thoth-station/s2i-minimal-notebook/issues/575, which shows the same problem, and managed to capture the logs of the pod that ran the workflow.

The logs show 2 problems:

  1. The cause of the failure to update the dependencies in that repo:

    There are incompatible versions in the resolved dependencies:
      traitlets>=4.2.0 (from jupyter-kernel-gateway==2.4.0->-r /tmp/pipenvj88ovu89requirements/pipenv-h51mgb6q-constraints.txt (line 10))
      traitlets>=4.2.1 (from notebook==6.4.10->-r /tmp/pipenvj88ovu89requirements/pipenv-h51mgb6q-constraints.txt (line 4))
      traitlets>=4.3.2 (from jupyterhub==1.5.0->-r /tmp/pipenvj88ovu89requirements/pipenv-h51mgb6q-constraints.txt (line 9))
      traitlets~=5.0 (from jupyterlab-git==0.39.1->-r /tmp/pipenvj88ovu89requirements/pipenv-h51mgb6q-constraints.txt (line 2))
  2. A failure when creating an issue:

    github.GithubException.GithubException: 422 
    {"message": "Validation Failed", "errors": [{"resource": "Issue", "code": "custom", "field": "body", "message": "body is too long (maximum is 65536 characters)"}], ...
full log ``` text 2022-08-31 11:21:57,072 1 INFO kebechet:201: Running manager 'update' for 'thoth-station/s2i-minimal-notebook' 2022-08-31 11:21:58,404 1 INFO kebechet.utils:59: Cloning repository https://u:t@github.com/thoth-station/s2i-minimal-notebook to . 2022-08-31 11:22:06,138 1 INFO kebechet.managers.update.update:883: Using Pipfile for dependency management 2022-08-31 11:22:07,718 1 DEBUG kebechet.managers.manager:155: Issue No dependency management found for the python36 environment not found, not closing. 2022-08-31 11:22:09,467 1 DEBUG kebechet.managers.manager:155: Issue Failed to perform initial lock of software stack for python36 environment not found, not closing. 2022-08-31 11:22:11,046 1 INFO kebechet.managers.update.update:586: Updating all dependencies to their latest version 2022-08-31 11:22:11,047 1 DEBUG kebechet.managers.manager:109: Running pipenv command 'pipenv update --dev' 2022-08-31 11:22:23,291 1 WARNING kebechet.managers.manager:112: Creating a virtualenv for this project... Pipfile: /tmp/clone-dir/overlays/python36/Pipfile Using /usr/bin/python3.6m (3.6.8) to create virtualenv... created virtual environment CPython3.6.8.final.0-64 in 471ms creator CPython3Posix(dest=/tmp/clone-dir/overlays/python36/.venv, clear=False, no_vcs_ignore=False, global=False) seeder FromAppData(download=False, pip=bundle, setuptools=bundle, wheel=bundle, via=copy, app_data_dir=/tmp/tmpfo3lhise) added seed packages: pip==21.3.1, setuptools==59.6.0, wheel==0.37.1 activators BashActivator,CShellActivator,FishActivator,NushellActivator,PowerShellActivator,PythonActivator Successfully created virtual environment! Virtualenv location: /tmp/clone-dir/overlays/python36/.venv Locking [dev-packages] dependencies... Locking [packages] dependencies... Building requirements... Resolving dependencies... FAIL [ResolutionFailure]: File "/home/user/.local/share/virtualenvs/user-5PivF_Od/lib/python3.8/site-packages/pipenv/resolver.py", line 741, in _main [ResolutionFailure]: resolve_packages(pre, clear, verbose, system, write, requirements_dir, packages, dev) [ResolutionFailure]: File "/home/user/.local/share/virtualenvs/user-5PivF_Od/lib/python3.8/site-packages/pipenv/resolver.py", line 709, in resolve_packages [ResolutionFailure]: requirements_dir=requirements_dir, [ResolutionFailure]: File "/home/user/.local/share/virtualenvs/user-5PivF_Od/lib/python3.8/site-packages/pipenv/resolver.py", line 692, in resolve [ResolutionFailure]: req_dir=requirements_dir [ResolutionFailure]: File "/home/user/.local/share/virtualenvs/user-5PivF_Od/lib/python3.8/site-packages/pipenv/utils.py", line 1403, in resolve_deps [ResolutionFailure]: req_dir=req_dir, [ResolutionFailure]: File "/home/user/.local/share/virtualenvs/user-5PivF_Od/lib/python3.8/site-packages/pipenv/utils.py", line 1108, in actually_resolve_deps [ResolutionFailure]: resolver.resolve() [ResolutionFailure]: File "/home/user/.local/share/virtualenvs/user-5PivF_Od/lib/python3.8/site-packages/pipenv/utils.py", line 833, in resolve [ResolutionFailure]: raise ResolutionFailure(message=str(e)) [pipenv.exceptions.ResolutionFailure]: Warning: Your dependencies could not be resolved. You likely have a mismatch in your sub-dependencies. First try clearing your dependency cache with $ pipenv lock --clear, then try the original command again. Alternatively, you can use $ pipenv install --skip-lock to bypass this mechanism, then run $ pipenv graph to inspect the situation. Hint: try $ pipenv lock --pre if it is a pre-release dependency. ERROR: Could not find a version that matches traitlets>=4.2.0,>=4.2.1,>=4.3.2,~=5.0 (from notebook==6.4.10->-r /tmp/pipenvj88ovu89requirements/pipenv-h51mgb6q-constraints.txt (line 4)) Tried: 0.0.1, 0.0.2, 4.0.0, 4.0.0, 4.1.0, 4.1.0, 4.1.0, 4.2.0, 4.2.0, 4.2.0, 4.2.1, 4.2.1, 4.2.1, 4.2.2, 4.2.2, 4.2.2, 4.3.0, 4.3.0, 4.3.1, 4.3.1, 4.3.2, 4.3.2, 4.3.3, 4.3.3 Skipped pre-versions: 4.0.0.dev0, 4.0.0.dev0, 4.0.0.dev0, 4.1.0b1, 4.1.0b1, 4.1.0b1, 4.1.0b1, 4.1.0b1, 4.3.0b1, 4.3.0b1, 4.3.3.dev0, 4.3.3.dev0 There are incompatible versions in the resolved dependencies: traitlets>=4.2.0 (from jupyter-kernel-gateway==2.4.0->-r /tmp/pipenvj88ovu89requirements/pipenv-h51mgb6q-constraints.txt (line 10)) traitlets>=4.2.1 (from notebook==6.4.10->-r /tmp/pipenvj88ovu89requirements/pipenv-h51mgb6q-constraints.txt (line 4)) traitlets>=4.3.2 (from jupyterhub==1.5.0->-r /tmp/pipenvj88ovu89requirements/pipenv-h51mgb6q-constraints.txt (line 9)) traitlets~=5.0 (from jupyterlab-git==0.39.1->-r /tmp/pipenvj88ovu89requirements/pipenv-h51mgb6q-constraints.txt (line 2)) Traceback (most recent call last): File "/home/user/.local/share/virtualenvs/user-5PivF_Od/lib/python3.8/site-packages/pipenv/utils.py", line 1131, in create_spinner yield sp File "/home/user/.local/share/virtualenvs/user-5PivF_Od/lib/python3.8/site-packages/pipenv/utils.py", line 1338, in venv_resolve_deps c = resolve(cmd, sp) File "/home/user/.local/share/virtualenvs/user-5PivF_Od/lib/python3.8/site-packages/pipenv/utils.py", line 1176, in resolve sys.exit(c.return_code) SystemExit: 1 2022-08-31 11:22:23,292 1 WARNING kebechet.managers.update.update:681: Failed to update dependencies to their latest version, reporting issue 2022-08-31 11:22:24,880 1 DEBUG kebechet.managers.manager:109: Running pipenv command 'pipenv --version' 2022-08-31 11:22:25,659 1 DEBUG kebechet.managers.manager:109: Running pipenv command 'pipenv sync --dev' 2022-08-31 11:25:51,675 1 DEBUG kebechet.managers.manager:109: Running pipenv command 'pipenv graph' 2022-08-31 11:25:55,198 1 ERROR kebechet:219: An error occurred during run of manager {'configuration': {'labels': ['bot']}} for 'thoth-station/s2i-minimal-notebook', skipping Traceback (most recent call last): File "/home/user/kebechet/managers/update/update.py", line 737, in _do_update self._pipenv_update_all() File "/home/user/kebechet/managers/update/update.py", line 587, in _pipenv_update_all cls.run_pipenv("pipenv update --dev") File "/home/user/kebechet/managers/manager.py", line 113, in run_pipenv raise PipenvError(result) kebechet.exception.PipenvError During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/home/user/.local/share/virtualenvs/user-5PivF_Od/lib/python3.8/site-packages/ogr/abstract.py", line 107, in wrapper return function(*args, **kwargs) File "/home/user/.local/share/virtualenvs/user-5PivF_Od/lib/python3.8/site-packages/ogr/services/github/issue.py", line 96, in create github_issue = project.github_repo.create_issue( File "/home/user/.local/share/virtualenvs/user-5PivF_Od/lib/python3.8/site-packages/github/Repository.py", line 1218, in create_issue headers, data = self._requester.requestJsonAndCheck( File "/home/user/.local/share/virtualenvs/user-5PivF_Od/lib/python3.8/site-packages/github/Requester.py", line 353, in requestJsonAndCheck return self.__check( File "/home/user/.local/share/virtualenvs/user-5PivF_Od/lib/python3.8/site-packages/github/Requester.py", line 378, in __check raise self.__createException(status, responseHeaders, output) github.GithubException.GithubException: 422 {"message": "Validation Failed", "errors": [{"resource": "Issue", "code": "custom", "field": "body", "message": "body is too long (maximum is 65536 characters)"}], "documentation_url": "https://docs.github.com/rest/reference/issues#create-an-issue"} The above exception was the direct cause of the following exception: Traceback (most recent call last): File "/home/user/kebechet/kebechet_runners.py", line 217, in run instance.run(**manager_configuration) File "/home/user/kebechet/managers/update/update.py", line 885, in run result = self._do_update( File "/home/user/kebechet/managers/update/update.py", line 739, in _do_update self._create_issue_for_pipenv_failure(exc=exc, labels=labels) File "/home/user/kebechet/managers/update/update.py", line 703, in _create_issue_for_pipenv_failure self.project.create_issue( File "/home/user/.local/share/virtualenvs/user-5PivF_Od/lib/python3.8/site-packages/ogr/abstract.py", line 117, in wrapper __check_for_internal_failure(ex) File "/home/user/.local/share/virtualenvs/user-5PivF_Od/lib/python3.8/site-packages/ogr/abstract.py", line 59, in __check_for_internal_failure raise ex File "/home/user/.local/share/virtualenvs/user-5PivF_Od/lib/python3.8/site-packages/ogr/abstract.py", line 107, in wrapper return function(*args, **kwargs) File "/home/user/.local/share/virtualenvs/user-5PivF_Od/lib/python3.8/site-packages/ogr/utils.py", line 199, in indirectly_called return specialized_function(self, *args, **kwargs) File "/home/user/.local/share/virtualenvs/user-5PivF_Od/lib/python3.8/site-packages/ogr/abstract.py", line 119, in wrapper __check_for_internal_failure(__wrap_exception(ex)) File "/home/user/.local/share/virtualenvs/user-5PivF_Od/lib/python3.8/site-packages/ogr/abstract.py", line 59, in __check_for_internal_failure raise ex ogr.exceptions.GithubAPIException 2022-08-31 11:25:55,227 1 INFO kebechet:201: Running manager 'info' for 'thoth-station/s2i-minimal-notebook' 2022-08-31 11:25:57,540 1 INFO kebechet.managers.info.info:51: No issue to report to, exiting 2022-08-31 11:25:57,541 1 INFO kebechet:201: Running manager 'version' for 'thoth-station/s2i-minimal-notebook' 2022-08-31 11:25:59,880 1 INFO kebechet:253: Finished management for 'thoth-station/s2i-minimal-notebook' ```
goern commented 1 year ago

any updates on this?!

KPostOffice commented 1 year ago

https://github.com/thoth-station/kebechet/blob/b7178d2d760d9774fd1b7382c34cca027b35c639/kebechet/managers/update/update.py#L710

https://github.com/thoth-station/kebechet/blob/b7178d2d760d9774fd1b7382c34cca027b35c639/kebechet/managers/update/update.py#L98

The attempt with these two lines is to limit the length of the issue. However it does so naively. These values have already been adjusted before. It might be worthwhile to try to come up with a more general solution.

Proposal: 1) Split data which is in the formatted string into two categories:

2) Format the string with the "required" information 3) Subtract len of intermediate string from 65000. Divide by num of items in "other info". Truncate lengths before adding them to the final string

(can be improved a bit more by ordering "other info" from shortest to longest allowing extra free space to go to items in "other info" which are longer)

KPostOffice commented 1 year ago

function signature:

def create_github_body(format_string: str, required_info: Dict[str, str], other_info: Dict[str, str], limit: int = 65000)
codificat commented 1 year ago

Do I read this correctly as /assign @KPostOffice /triage accepted /lifecycle active ? :smile: