smarkets / marge-bot

A merge-bot for GitLab
BSD 3-Clause "New" or "Revised" License
700 stars 136 forks source link

No user exists for uid 0 #187

Closed dominikmontada closed 5 years ago

dominikmontada commented 5 years ago

Hi. I am running Marge bot in Docker using the master tag and am getting the following error:

2019-05-13 02:11:39,367 DEBUG REQUEST: GET https://my.gitlab.instance/api/v4/user {'PRIVATE-TOKEN': 'REDACTED'} {'params': {}}
2019-05-13 02:11:39,373 DEBUG Starting new HTTPS connection (1): my.gitlab.instance:443
2019-05-13 02:11:39,618 DEBUG https://my.gitlab.instance:443 "GET /api/v4/user HTTP/1.1" 200 None
2019-05-13 02:11:39,621 DEBUG RESPONSE CODE: 200
2019-05-13 02:11:39,623 DEBUG RESPONSE BODY: b'{"id":16,"name":"Marge Bot","username":"marge-bot","state":"active","avatar_url":"https://my.gitlab.instance/uploads/-/system/user/avatar/16/MargeSimpson5.gif","web_url":"https://my.gitlab.instance/marge-bot","created_at":"2019-05-09T14:55:12.130+09:00","bio":null,"location":null,"public_email":"","skype":"","linkedin":"","twitter":"","website_url":"","organization":null,"last_sign_in_at":"2019-05-09T14:58:16.296+09:00","confirmed_at":"2019-05-09T14:55:11.689+09:00","last_activity_on":"2019-05-13","email":"marge@invalid.com","theme_id":1,"color_scheme_id":1,"projects_limit":100000,"current_sign_in_at":"2019-05-13T10:14:17.419+09:00","identities":[],"can_create_group":true,"can_create_project":true,"two_factor_enabled":false,"external":false,"private_profile":null,"is_admin":true,"shared_runners_minutes_limit":null,"extra_shared_runners_minutes_limit":null}'
2019-05-13 02:11:39,625 INFO Finding out my current projects...
2019-05-13 02:11:39,625 DEBUG REQUEST: GET https://my.gitlab.instance/api/v4/version {'PRIVATE-TOKEN': 'REDACTED'} {'params': {}}
2019-05-13 02:11:39,628 DEBUG Starting new HTTPS connection (1): my.gitlab.instance:443
2019-05-13 02:11:39,842 DEBUG https://my.gitlab.instance:443 "GET /api/v4/version HTTP/1.1" 200 46
2019-05-13 02:11:39,845 DEBUG RESPONSE CODE: 200
2019-05-13 02:11:39,846 DEBUG RESPONSE BODY: b'{"version":"11.10.4-ee","revision":"88a3c791"}'
2019-05-13 02:11:39,846 DEBUG REQUEST: GET https://my.gitlab.instance/api/v4/projects {'PRIVATE-TOKEN': 'REDACTED'} {'params': {'membership': 'true', 'with_merge_requests_enabled': 'true', 'archived': 'false', 'min_access_level': '30', 'page': '1', 'per_page': '100'}}
2019-05-13 02:11:39,848 DEBUG Starting new HTTPS connection (1): my.gitlab.instance:443
2019-05-13 02:11:40,169 DEBUG https://my.gitlab.instance:443 "GET /api/v4/projects?membership=true&with_merge_requests_enabled=true&archived=false&min_access_level=30&page=1&per_page=100 HTTP/1.1" 200 None
2019-05-13 02:11:40,173 DEBUG RESPONSE CODE: 200
2019-05-13 02:11:40,173 DEBUG RESPONSE BODY: b'[{"id":14,"description":"","name":"documents","name_with_namespace":"archway / service-template / documents","path":"documents","path_with_namespace":"archway/service-template/documents","created_at":"2019-04-02T15:14:06.092+09:00","default_branch":"master","tag_list":[],"ssh_url_to_repo":"git@my.gitlab.instance:archway/service-template/documents.git","http_url_to_repo":"https://my.gitlab.instance/archway/service-template/documents.git","web_url":"https://my.gitlab.instance/archway/service-template/documents","readme_url":"https://my.gitlab.instance/archway/service-template/documents/blob/master/README.md","avatar_url":null,"star_count":1,"forks_count":0,"last_activity_at":"2019-04-09T16:56:03.412+09:00","namespace":{"id":18,"name":"service-template","path":"service-template","kind":"group","full_path":"archway/service-template","parent_id":2},"_links":{"self":"https://my.gitlab.instance/api/v4/projects/14","issues":"https://my.gitlab.instance/api/v4/projects/14/issues","merge_requests":"https://my.gitlab.instance/api/v4/projects/14/merge_requests","repo_branches":"https://my.gitlab.instance/api/v4/projects/14/repository/branches","labels":"https://my.gitlab.instance/api/v4/projects/14/labels","events":"https://my.gitlab.instance/api/v4/projects/14/events","members":"https://my.gitlab.instance/api/v4/projects/14/members"},"archived":false,"visibility":"private","resolve_outdated_diff_discussions":false,"container_registry_enabled":true,"issues_enabled":true,"merge_requests_enabled":true,"wiki_enabled":true,"jobs_enabled":true,"snippets_enabled":true,"shared_runners_enabled":true,"lfs_enabled":true,"creator_id":13,"import_status":"none","open_issues_count":0,"public_jobs":true,"ci_config_path":null,"shared_with_groups":[],"only_allow_merge_if_pipeline_succeeds":false,"request_access_enabled":false,"only_allow_merge_if_all_discussions_are_resolved":false,"printing_merge_request_link_enabled":true,"merge_method":"merge","external_authorization_classification_label":null,"permissions":{"project_access":null,"group_access":{"access_level":40,"notification_level":3}},"repository_storage":"default"},{"id":8,"description":"SAO generator for a static Nuxt project with Keycloak authentication","name":"Frontend Generators","name_with_namespace":"archway / service-template / Frontend Generators","path":"frontend-generator","path_with_namespace":"archway/service-template/frontend-generator","created_at":"2019-02-28T17:12:27.715+09:00","default_branch":"master","tag_list":["keycloak","nuxt","sao"],"ssh_url_to_repo":"git@my.gitlab.instance:archway/service-template/frontend-generator.git","http_url_to_repo":"https://my.gitlab.instance/archway/service-template/frontend-generator.git","web_url":"https://my.gitlab.instance/archway/service-template/frontend-generator","readme_url":null,"avatar_url":null,"star_count":1,"forks_count":0,"last_activity_at":"2019-04-22T13:32:58.724+09:00","namespace":{"id":18,"name":"service-template","path":"service-template","kind":"group","full_path":"archway/service-template","parent_id":2},"_links":{"self":"https://my.gitlab.instance/api/v4/projects/8","issues":"https://my.gitlab.instance/api/v4/projects/8/issues","merge_requests":"https://my.gitlab.instance/api/v4/projects/8/merge_requests","repo_branches":"https://my.gitlab.instance/api/v4/projects/8/repository/branches","labels":"https://my.gitlab.instance/api/v4/projects/8/labels","events":"https://my.gitlab.instance/api/v4/projects/8/events","members":"https://my.gitlab.instance/api/v4/projects/8/members"},"archived":false,"visibility":"private","resolve_outdated_diff_discussions":false,"container_registry_enabled":true,"issues_enabled":true,"merge_requests_enabled":true,"wiki_enabled":true,"jobs_enabled":true,"snippets_enabled":true,"shared_runners_enabled":true,"lfs_enabled":true,"creator_id":2,"import_status":"none","open_issues_count":1,"public_jobs":true,"ci_config_path":null,"shared_with_groups":[],"only_allow_merge_if_pipeline_succeeds":false,"request_access_enabled":false,"only_allow_merge_if_all_discussions_are_resolved":false,"printing_merge_request_link_enabled":true,"merge_method":"ff","external_authorization_classification_label":null,"permissions":{"project_access":null,"group_access":{"access_level":40,"notification_level":3}},"repository_storage":"default"},{"id":1,"description":"","name":"ASP.NET Core Template","name_with_namespace":"archway / service-template / ASP.NET Core Template","path":"aspnetcore-template","path_with_namespace":"my/repository","created_at":"2019-02-08T15:26:08.647+09:00","default_branch":"develop","tag_list":[],"ssh_url_to_repo":"git@my.gitlab.instance:my/repository.git","http_url_to_repo":"https://my.gitlab.instance/my/repository.git","web_url":"https://my.gitlab.instance/my/repository","readme_url":"https://my.gitlab.instance/my/repository/blob/develop/README.md","avatar_url":null,"star_count":1,"forks_count":1,"last_activity_at":"2019-05-13T09:04:47.565+09:00","namespace":{"id":18,"name":"service-template","path":"service-template","kind":"group","full_path":"archway/service-template","parent_id":2},"_links":{"self":"https://my.gitlab.instance/api/v4/projects/1","issues":"https://my.gitlab.instance/api/v4/projects/1/issues","merge_requests":"https://my.gitlab.instance/api/v4/projects/1/merge_requests","repo_branches":"https://my.gitlab.instance/api/v4/projects/1/repository/branches","labels":"https://my.gitlab.instance/api/v4/projects/1/labels","events":"https://my.gitlab.instance/api/v4/projects/1/events","members":"https://my.gitlab.instance/api/v4/projects/1/members"},"archived":false,"visibility":"private","resolve_outdated_diff_discussions":false,"container_registry_enabled":true,"issues_enabled":true,"merge_requests_enabled":true,"wiki_enabled":true,"jobs_enabled":true,"snippets_enabled":true,"shared_runners_enabled":true,"lfs_enabled":false,"creator_id":1,"import_status":"finished","open_issues_count":10,"public_jobs":true,"ci_config_path":null,"shared_with_groups":[],"only_allow_merge_if_pipeline_succeeds":false,"request_access_enabled":false,"only_allow_merge_if_all_discussions_are_resolved":true,"printing_merge_request_link_enabled":true,"merge_method":"ff","external_authorization_classification_label":null,"permissions":{"project_access":null,"group_access":{"access_level":40,"notification_level":3}},"repository_storage":"default"}]'
2019-05-13 02:11:40,174 DEBUG REQUEST: GET https://my.gitlab.instance/api/v4/projects {'PRIVATE-TOKEN': 'REDACTED'} {'params': {'membership': 'true', 'with_merge_requests_enabled': 'true', 'archived': 'false', 'min_access_level': '30', 'page': '2', 'per_page': '100'}}
2019-05-13 02:11:40,176 DEBUG Starting new HTTPS connection (1): my.gitlab.instance:443
2019-05-13 02:11:40,403 DEBUG https://my.gitlab.instance:443 "GET /api/v4/projects?membership=true&with_merge_requests_enabled=true&archived=false&min_access_level=30&page=2&per_page=100 HTTP/1.1" 200 2
2019-05-13 02:11:40,406 DEBUG RESPONSE CODE: 200
2019-05-13 02:11:40,407 DEBUG RESPONSE BODY: b'[]'
2019-05-13 02:11:40,407 DEBUG Projects that match project_regexp: ['my/repository']
2019-05-13 02:11:42,884 INFO Fetching merge requests assigned to me in my/repository...
2019-05-13 02:11:42,885 DEBUG REQUEST: GET https://my.gitlab.instance/api/v4/projects/1/merge_requests {'PRIVATE-TOKEN': 'REDACTED'} {'params': {'state': 'opened', 'order_by': 'created_at', 'sort': 'asc', 'page': '1', 'per_page': '100'}}
2019-05-13 02:11:42,886 DEBUG Starting new HTTPS connection (1): my.gitlab.instance:443
2019-05-13 02:11:43,153 DEBUG https://my.gitlab.instance:443 "GET /api/v4/projects/1/merge_requests?state=opened&order_by=created_at&sort=asc&page=1&per_page=100 HTTP/1.1" 200 None
2019-05-13 02:11:43,156 DEBUG RESPONSE CODE: 200
2019-05-13 02:11:43,156 DEBUG RESPONSE BODY: b'[{"id":84,"iid":28,"project_id":1,"title":"improve docker build time with --cache-from","description":"Implements #29","state":"opened","created_at":"2019-05-13T09:15:40.697+09:00","updated_at":"2019-05-13T10:46:45.725+09:00","merged_by":null,"merged_at":null,"closed_by":null,"closed_at":null,"target_branch":"develop","source_branch":"docker-cache","user_notes_count":0,"upvotes":0,"downvotes":0,"author":{"id":2,"name":"Dominik Montada","username":"dominikm","state":"active","avatar_url":"https://my.gitlab.instance/uploads/-/system/user/avatar/2/dominik.png","web_url":"https://my.gitlab.instance/dominikm"},"assignee":{"id":16,"name":"Marge Bot","username":"marge-bot","state":"active","avatar_url":"https://my.gitlab.instance/uploads/-/system/user/avatar/16/MargeSimpson5.gif","web_url":"https://my.gitlab.instance/marge-bot"},"source_project_id":1,"target_project_id":1,"labels":[],"work_in_progress":false,"milestone":null,"merge_when_pipeline_succeeds":false,"merge_status":"can_be_merged","sha":"0ed24f0935fd7577858626f904e4c0621f1f554e","merge_commit_sha":null,"discussion_locked":null,"should_remove_source_branch":null,"force_remove_source_branch":true,"reference":"!28","web_url":"https://my.gitlab.instance/my/repository/merge_requests/28","time_stats":{"time_estimate":0,"total_time_spent":0,"human_time_estimate":null,"human_total_time_spent":null},"squash":true,"approvals_before_merge":null}]'
2019-05-13 02:11:43,157 DEBUG REQUEST: GET https://my.gitlab.instance/api/v4/projects/1/merge_requests {'PRIVATE-TOKEN': 'REDACTED'} {'params': {'state': 'opened', 'order_by': 'created_at', 'sort': 'asc', 'page': '2', 'per_page': '100'}}
2019-05-13 02:11:43,158 DEBUG Starting new HTTPS connection (1): my.gitlab.instance:443
2019-05-13 02:11:43,395 DEBUG https://my.gitlab.instance:443 "GET /api/v4/projects/1/merge_requests?state=opened&order_by=created_at&sort=asc&page=2&per_page=100 HTTP/1.1" 200 2
2019-05-13 02:11:43,398 DEBUG RESPONSE CODE: 200
2019-05-13 02:11:43,398 DEBUG RESPONSE BODY: b'[]'
2019-05-13 02:11:43,399 DEBUG MRs that match branch_regexp: ['https://my.gitlab.instance/my/repository/merge_requests/28']
2019-05-13 02:11:43,399 INFO Running git clone --origin=origin git@my.gitlab.instance:my/repository.git /tmpq8myqx1r/tmpqch2ptmt
2019-05-13 02:11:43,419 WARNING git returned 128
2019-05-13 02:11:43,419 WARNING stdout: b''
2019-05-13 02:11:43,420 WARNING stderr: b"Cloning into '/tmpq8myqx1r/tmpqch2ptmt'...\nNo user exists for uid 0\r\nfatal: Could not read from remote repository.\n\nPlease make sure you have the correct access rights\nand the repository exists.\n"
2019-05-13 02:11:43,420 ERROR Couldn't initialize repository for project!
Traceback (most recent call last):
  File "/nix/store/2lipwjimyyrrj8f8y88658yijgrxrda3-python3.6-marge-0.8.2/lib/python3.6/site-packages/marge/git.py", line 183, in git
    return _run(*command, env=env, check=True, timeout=timeout_seconds)
  File "/nix/store/2lipwjimyyrrj8f8y88658yijgrxrda3-python3.6-marge-0.8.2/lib/python3.6/site-packages/marge/git.py", line 209, in _run
    retcode, process.args, output=stdout, stderr=stderr,
subprocess.CalledProcessError: Command '[b'git', b'clone', b'--origin=origin', b'git@my.gitlab.instance:my/repository.git', b'/tmpq8myqx1r/tmpqch2ptmt']' returned non-zero exit status 128.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/nix/store/2lipwjimyyrrj8f8y88658yijgrxrda3-python3.6-marge-0.8.2/lib/python3.6/site-packages/marge/bot.py", line 130, in _process_merge_requests
    repo = repo_manager.repo_for_project(project)
  File "/nix/store/2lipwjimyyrrj8f8y88658yijgrxrda3-python3.6-marge-0.8.2/lib/python3.6/site-packages/marge/store.py", line 24, in repo_for_project
    repo.clone()
  File "/nix/store/2lipwjimyyrrj8f8y88658yijgrxrda3-python3.6-marge-0.8.2/lib/python3.6/site-packages/marge/git.py", line 37, in clone
    self.local_path, from_repo=False)
  File "/nix/store/2lipwjimyyrrj8f8y88658yijgrxrda3-python3.6-marge-0.8.2/lib/python3.6/site-packages/marge/git.py", line 188, in git
    raise GitError(err)
marge.git.GitError: Command '[b'git', b'clone', b'--origin=origin', b'git@my.gitlab.instance:my/repository.git', b'/tmpq8myqx1r/tmpqch2ptmt']' returned non-zero exit status 128.
Traceback (most recent call last):
  File "/nix/store/2lipwjimyyrrj8f8y88658yijgrxrda3-python3.6-marge-0.8.2/lib/python3.6/site-packages/marge/git.py", line 183, in git
    return _run(*command, env=env, check=True, timeout=timeout_seconds)
  File "/nix/store/2lipwjimyyrrj8f8y88658yijgrxrda3-python3.6-marge-0.8.2/lib/python3.6/site-packages/marge/git.py", line 209, in _run
    retcode, process.args, output=stdout, stderr=stderr,
subprocess.CalledProcessError: Command '[b'git', b'clone', b'--origin=origin', b'git@my.gitlab.instance:my/repository.git', b'/tmpq8myqx1r/tmpqch2ptmt']' returned non-zero exit status 128.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/nix/store/2lipwjimyyrrj8f8y88658yijgrxrda3-python3.6-marge-0.8.2/bin/.marge.app-wrapped", line 4, in <module>
    marge.app.main()
  File "/nix/store/2lipwjimyyrrj8f8y88658yijgrxrda3-python3.6-marge-0.8.2/lib/python3.6/site-packages/marge/app.py", line 307, in main
    marge_bot.start()
  File "/nix/store/2lipwjimyyrrj8f8y88658yijgrxrda3-python3.6-marge-0.8.2/lib/python3.6/site-packages/marge/bot.py", line 42, in start
    self._run(repo_manager)
  File "/nix/store/2lipwjimyyrrj8f8y88658yijgrxrda3-python3.6-marge-0.8.2/lib/python3.6/site-packages/marge/bot.py", line 60, in _run
    projects,
  File "/nix/store/2lipwjimyyrrj8f8y88658yijgrxrda3-python3.6-marge-0.8.2/lib/python3.6/site-packages/marge/bot.py", line 98, in _process_projects
    self._process_merge_requests(repo_manager, project, merge_requests)
  File "/nix/store/2lipwjimyyrrj8f8y88658yijgrxrda3-python3.6-marge-0.8.2/lib/python3.6/site-packages/marge/bot.py", line 130, in _process_merge_requests
    repo = repo_manager.repo_for_project(project)
  File "/nix/store/2lipwjimyyrrj8f8y88658yijgrxrda3-python3.6-marge-0.8.2/lib/python3.6/site-packages/marge/store.py", line 24, in repo_for_project
    repo.clone()
  File "/nix/store/2lipwjimyyrrj8f8y88658yijgrxrda3-python3.6-marge-0.8.2/lib/python3.6/site-packages/marge/git.py", line 37, in clone
    self.local_path, from_repo=False)
  File "/nix/store/2lipwjimyyrrj8f8y88658yijgrxrda3-python3.6-marge-0.8.2/lib/python3.6/site-packages/marge/git.py", line 188, in git
    raise GitError(err)
marge.git.GitError: Command '[b'git', b'clone', b'--origin=origin', b'git@my.gitlab.instance:my/repository.git', b'/tmpq8myqx1r/tmpqch2ptmt']' returned non-zero exit status 128.

I tried reproducing the error on the stable tag, however since I am using sub-groups in GitLab I am relying on #166, which is only in the master tag. For testing purposes I added Marge bot directly to the relevant subgroup to get it running, but I ran into a similar, however different error:

2019-05-13 02:15:43,145 DEBUG REQUEST: GET https://my.gitlab.instance/api/v4/user {'PRIVATE-TOKEN': 'REDACTED'} {'params': {}}
2019-05-13 02:15:43,148 DEBUG Starting new HTTPS connection (1): my.gitlab.instance
2019-05-13 02:15:43,385 DEBUG https://my.gitlab.instance:443 "GET /api/v4/user HTTP/1.1" 200 None
2019-05-13 02:15:43,388 DEBUG RESPONSE CODE: 200
2019-05-13 02:15:43,388 DEBUG RESPONSE BODY: b'{"id":16,"name":"Marge Bot","username":"marge-bot","state":"active","avatar_url":"https://my.gitlab.instance/uploads/-/system/user/avatar/16/MargeSimpson5.gif","web_url":"https://my.gitlab.instance/marge-bot","created_at":"2019-05-09T14:55:12.130+09:00","bio":null,"location":null,"public_email":"","skype":"","linkedin":"","twitter":"","website_url":"","organization":null,"last_sign_in_at":"2019-05-09T14:58:16.296+09:00","confirmed_at":"2019-05-09T14:55:11.689+09:00","last_activity_on":"2019-05-13","email":"marge@invalid.com","theme_id":1,"color_scheme_id":1,"projects_limit":100000,"current_sign_in_at":"2019-05-13T10:14:17.419+09:00","identities":[],"can_create_group":true,"can_create_project":true,"two_factor_enabled":false,"external":false,"private_profile":null,"is_admin":true,"shared_runners_minutes_limit":null,"extra_shared_runners_minutes_limit":null}'
2019-05-13 02:15:43,389 INFO Finding out my current projects...
2019-05-13 02:15:43,389 DEBUG REQUEST: GET https://my.gitlab.instance/api/v4/projects {'PRIVATE-TOKEN': 'REDACTED'} {'params': {'membership': 'true', 'with_merge_requests_enabled': 'true', 'page': '1', 'per_page': '100'}}
2019-05-13 02:15:43,391 DEBUG Starting new HTTPS connection (1): my.gitlab.instance
2019-05-13 02:15:43,714 DEBUG https://my.gitlab.instance:443 "GET /api/v4/projects?membership=true&with_merge_requests_enabled=true&page=1&per_page=100 HTTP/1.1" 200 None
2019-05-13 02:15:43,717 DEBUG RESPONSE CODE: 200
2019-05-13 02:15:43,717 DEBUG RESPONSE BODY: b'[{"id":14,"description":"","name":"documents","name_with_namespace":"archway / service-template / documents","path":"documents","path_with_namespace":"archway/service-template/documents","created_at":"2019-04-02T15:14:06.092+09:00","default_branch":"master","tag_list":[],"ssh_url_to_repo":"git@my.gitlab.instance:archway/service-template/documents.git","http_url_to_repo":"https://my.gitlab.instance/archway/service-template/documents.git","web_url":"https://my.gitlab.instance/archway/service-template/documents","readme_url":"https://my.gitlab.instance/archway/service-template/documents/blob/master/README.md","avatar_url":null,"star_count":1,"forks_count":0,"last_activity_at":"2019-04-09T16:56:03.412+09:00","namespace":{"id":18,"name":"service-template","path":"service-template","kind":"group","full_path":"archway/service-template","parent_id":2},"_links":{"self":"https://my.gitlab.instance/api/v4/projects/14","issues":"https://my.gitlab.instance/api/v4/projects/14/issues","merge_requests":"https://my.gitlab.instance/api/v4/projects/14/merge_requests","repo_branches":"https://my.gitlab.instance/api/v4/projects/14/repository/branches","labels":"https://my.gitlab.instance/api/v4/projects/14/labels","events":"https://my.gitlab.instance/api/v4/projects/14/events","members":"https://my.gitlab.instance/api/v4/projects/14/members"},"archived":false,"visibility":"private","resolve_outdated_diff_discussions":false,"container_registry_enabled":true,"issues_enabled":true,"merge_requests_enabled":true,"wiki_enabled":true,"jobs_enabled":true,"snippets_enabled":true,"shared_runners_enabled":true,"lfs_enabled":true,"creator_id":13,"import_status":"none","open_issues_count":0,"public_jobs":true,"ci_config_path":null,"shared_with_groups":[],"only_allow_merge_if_pipeline_succeeds":false,"request_access_enabled":false,"only_allow_merge_if_all_discussions_are_resolved":false,"printing_merge_request_link_enabled":true,"merge_method":"merge","external_authorization_classification_label":null,"permissions":{"project_access":null,"group_access":{"access_level":40,"notification_level":3}},"repository_storage":"default"},{"id":8,"description":"SAO generator for a static Nuxt project with Keycloak authentication","name":"Frontend Generators","name_with_namespace":"archway / service-template / Frontend Generators","path":"frontend-generator","path_with_namespace":"archway/service-template/frontend-generator","created_at":"2019-02-28T17:12:27.715+09:00","default_branch":"master","tag_list":["keycloak","nuxt","sao"],"ssh_url_to_repo":"git@my.gitlab.instance:archway/service-template/frontend-generator.git","http_url_to_repo":"https://my.gitlab.instance/archway/service-template/frontend-generator.git","web_url":"https://my.gitlab.instance/archway/service-template/frontend-generator","readme_url":null,"avatar_url":null,"star_count":1,"forks_count":0,"last_activity_at":"2019-04-22T13:32:58.724+09:00","namespace":{"id":18,"name":"service-template","path":"service-template","kind":"group","full_path":"archway/service-template","parent_id":2},"_links":{"self":"https://my.gitlab.instance/api/v4/projects/8","issues":"https://my.gitlab.instance/api/v4/projects/8/issues","merge_requests":"https://my.gitlab.instance/api/v4/projects/8/merge_requests","repo_branches":"https://my.gitlab.instance/api/v4/projects/8/repository/branches","labels":"https://my.gitlab.instance/api/v4/projects/8/labels","events":"https://my.gitlab.instance/api/v4/projects/8/events","members":"https://my.gitlab.instance/api/v4/projects/8/members"},"archived":false,"visibility":"private","resolve_outdated_diff_discussions":false,"container_registry_enabled":true,"issues_enabled":true,"merge_requests_enabled":true,"wiki_enabled":true,"jobs_enabled":true,"snippets_enabled":true,"shared_runners_enabled":true,"lfs_enabled":true,"creator_id":2,"import_status":"none","open_issues_count":1,"public_jobs":true,"ci_config_path":null,"shared_with_groups":[],"only_allow_merge_if_pipeline_succeeds":false,"request_access_enabled":false,"only_allow_merge_if_all_discussions_are_resolved":false,"printing_merge_request_link_enabled":true,"merge_method":"ff","external_authorization_classification_label":null,"permissions":{"project_access":null,"group_access":{"access_level":40,"notification_level":3}},"repository_storage":"default"},{"id":1,"description":"","name":"ASP.NET Core Template","name_with_namespace":"archway / service-template / ASP.NET Core Template","path":"aspnetcore-template","path_with_namespace":"my/repository","created_at":"2019-02-08T15:26:08.647+09:00","default_branch":"develop","tag_list":[],"ssh_url_to_repo":"git@my.gitlab.instance:my/repository.git","http_url_to_repo":"https://my.gitlab.instance/my/repository.git","web_url":"https://my.gitlab.instance/my/repository","readme_url":"https://my.gitlab.instance/my/repository/blob/develop/README.md","avatar_url":null,"star_count":1,"forks_count":1,"last_activity_at":"2019-05-13T09:04:47.565+09:00","namespace":{"id":18,"name":"service-template","path":"service-template","kind":"group","full_path":"archway/service-template","parent_id":2},"_links":{"self":"https://my.gitlab.instance/api/v4/projects/1","issues":"https://my.gitlab.instance/api/v4/projects/1/issues","merge_requests":"https://my.gitlab.instance/api/v4/projects/1/merge_requests","repo_branches":"https://my.gitlab.instance/api/v4/projects/1/repository/branches","labels":"https://my.gitlab.instance/api/v4/projects/1/labels","events":"https://my.gitlab.instance/api/v4/projects/1/events","members":"https://my.gitlab.instance/api/v4/projects/1/members"},"archived":false,"visibility":"private","resolve_outdated_diff_discussions":false,"container_registry_enabled":true,"issues_enabled":true,"merge_requests_enabled":true,"wiki_enabled":true,"jobs_enabled":true,"snippets_enabled":true,"shared_runners_enabled":true,"lfs_enabled":false,"creator_id":1,"import_status":"finished","open_issues_count":10,"public_jobs":true,"ci_config_path":null,"shared_with_groups":[],"only_allow_merge_if_pipeline_succeeds":false,"request_access_enabled":false,"only_allow_merge_if_all_discussions_are_resolved":true,"printing_merge_request_link_enabled":true,"merge_method":"ff","external_authorization_classification_label":null,"permissions":{"project_access":null,"group_access":{"access_level":40,"notification_level":3}},"repository_storage":"default"}]'
2019-05-13 02:15:43,718 DEBUG REQUEST: GET https://my.gitlab.instance/api/v4/projects {'PRIVATE-TOKEN': 'REDACTED'} {'params': {'membership': 'true', 'with_merge_requests_enabled': 'true', 'page': '2', 'per_page': '100'}}
2019-05-13 02:15:43,719 DEBUG Starting new HTTPS connection (1): my.gitlab.instance
2019-05-13 02:15:43,955 DEBUG https://my.gitlab.instance:443 "GET /api/v4/projects?membership=true&with_merge_requests_enabled=true&page=2&per_page=100 HTTP/1.1" 200 2
2019-05-13 02:15:43,965 DEBUG RESPONSE CODE: 200
2019-05-13 02:15:43,966 DEBUG RESPONSE BODY: b'[]'
2019-05-13 02:15:43,967 DEBUG Projects that match project_regexp: ['my/repository']
2019-05-13 02:15:46,474 INFO Fetching merge requests assigned to me in my/repository...
2019-05-13 02:15:46,475 DEBUG REQUEST: GET https://my.gitlab.instance/api/v4/projects/1/merge_requests {'PRIVATE-TOKEN': 'REDACTED'} {'params': {'state': 'opened', 'order_by': 'created_at', 'sort': 'asc', 'page': '1', 'per_page': '100'}}
2019-05-13 02:15:46,479 DEBUG Starting new HTTPS connection (1): my.gitlab.instance
2019-05-13 02:15:46,758 DEBUG https://my.gitlab.instance:443 "GET /api/v4/projects/1/merge_requests?state=opened&order_by=created_at&sort=asc&page=1&per_page=100 HTTP/1.1" 200 None
2019-05-13 02:15:46,762 DEBUG RESPONSE CODE: 200
2019-05-13 02:15:46,762 DEBUG RESPONSE BODY: b'[{"id":84,"iid":28,"project_id":1,"title":"improve docker build time with --cache-from","description":"Implements #29","state":"opened","created_at":"2019-05-13T09:15:40.697+09:00","updated_at":"2019-05-13T10:46:45.725+09:00","merged_by":null,"merged_at":null,"closed_by":null,"closed_at":null,"target_branch":"develop","source_branch":"docker-cache","user_notes_count":0,"upvotes":0,"downvotes":0,"author":{"id":2,"name":"Dominik Montada","username":"dominikm","state":"active","avatar_url":"https://my.gitlab.instance/uploads/-/system/user/avatar/2/dominik.png","web_url":"https://my.gitlab.instance/dominikm"},"assignee":{"id":16,"name":"Marge Bot","username":"marge-bot","state":"active","avatar_url":"https://my.gitlab.instance/uploads/-/system/user/avatar/16/MargeSimpson5.gif","web_url":"https://my.gitlab.instance/marge-bot"},"source_project_id":1,"target_project_id":1,"labels":[],"work_in_progress":false,"milestone":null,"merge_when_pipeline_succeeds":false,"merge_status":"can_be_merged","sha":"0ed24f0935fd7577858626f904e4c0621f1f554e","merge_commit_sha":null,"discussion_locked":null,"should_remove_source_branch":null,"force_remove_source_branch":true,"reference":"!28","web_url":"https://my.gitlab.instance/my/repository/merge_requests/28","time_stats":{"time_estimate":0,"total_time_spent":0,"human_time_estimate":null,"human_total_time_spent":null},"squash":true,"approvals_before_merge":null}]'
2019-05-13 02:15:46,762 DEBUG REQUEST: GET https://my.gitlab.instance/api/v4/projects/1/merge_requests {'PRIVATE-TOKEN': 'REDACTED'} {'params': {'state': 'opened', 'order_by': 'created_at', 'sort': 'asc', 'page': '2', 'per_page': '100'}}
2019-05-13 02:15:46,765 DEBUG Starting new HTTPS connection (1): my.gitlab.instance
2019-05-13 02:15:47,007 DEBUG https://my.gitlab.instance:443 "GET /api/v4/projects/1/merge_requests?state=opened&order_by=created_at&sort=asc&page=2&per_page=100 HTTP/1.1" 200 2
2019-05-13 02:15:47,010 DEBUG RESPONSE CODE: 200
2019-05-13 02:15:47,010 DEBUG RESPONSE BODY: b'[]'
2019-05-13 02:15:47,010 DEBUG MRs that match branch_regexp: ['https://my.gitlab.instance/my/repository/merge_requests/28']
2019-05-13 02:15:47,011 INFO Running git clone --origin=origin git@my.gitlab.instance:my/repository.git /tmphpqbv437/tmpa0xwrlhk
2019-05-13 02:15:47,354 WARNING git returned 128
2019-05-13 02:15:47,354 WARNING stdout: b''
2019-05-13 02:15:47,355 WARNING stderr: b"Cloning into '/tmphpqbv437/tmpa0xwrlhk'...\nWarning: Permanently added 'my.gitlab.instance,35.229.165.201' (ECDSA) to the list of known hosts.\r\nPermission denied (publickey,keyboard-interactive).\r\nfatal: Could not read from remote repository.\n\nPlease make sure you have the correct access rights\nand the repository exists.\n"
2019-05-13 02:15:47,356 ERROR Couldn't initialize repository for project!
Traceback (most recent call last):
  File "/nix/store/rsc74jcy093n1qdiqda61sj3valz7839-python3.6-marge-0.8.1/lib/python3.6/site-packages/marge/git.py", line 183, in git
    return _run(*command, env=env, check=True, timeout=timeout_seconds)
  File "/nix/store/rsc74jcy093n1qdiqda61sj3valz7839-python3.6-marge-0.8.1/lib/python3.6/site-packages/marge/git.py", line 209, in _run
    retcode, process.args, output=stdout, stderr=stderr,
subprocess.CalledProcessError: Command '[b'git', b'clone', b'--origin=origin', b'git@my.gitlab.instance:my/repository.git', b'/tmphpqbv437/tmpa0xwrlhk']' returned non-zero exit status 128.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/nix/store/rsc74jcy093n1qdiqda61sj3valz7839-python3.6-marge-0.8.1/lib/python3.6/site-packages/marge/bot.py", line 130, in _process_merge_requests
    repo = repo_manager.repo_for_project(project)
  File "/nix/store/rsc74jcy093n1qdiqda61sj3valz7839-python3.6-marge-0.8.1/lib/python3.6/site-packages/marge/store.py", line 24, in repo_for_project
    repo.clone()
  File "/nix/store/rsc74jcy093n1qdiqda61sj3valz7839-python3.6-marge-0.8.1/lib/python3.6/site-packages/marge/git.py", line 37, in clone
    self.local_path, from_repo=False)
  File "/nix/store/rsc74jcy093n1qdiqda61sj3valz7839-python3.6-marge-0.8.1/lib/python3.6/site-packages/marge/git.py", line 188, in git
    raise GitError(err)
marge.git.GitError: Command '[b'git', b'clone', b'--origin=origin', b'git@my.gitlab.instance:my/repository.git', b'/tmphpqbv437/tmpa0xwrlhk']' returned non-zero exit status 128.
Traceback (most recent call last):
  File "/nix/store/rsc74jcy093n1qdiqda61sj3valz7839-python3.6-marge-0.8.1/lib/python3.6/site-packages/marge/git.py", line 183, in git
    return _run(*command, env=env, check=True, timeout=timeout_seconds)
  File "/nix/store/rsc74jcy093n1qdiqda61sj3valz7839-python3.6-marge-0.8.1/lib/python3.6/site-packages/marge/git.py", line 209, in _run
    retcode, process.args, output=stdout, stderr=stderr,
subprocess.CalledProcessError: Command '[b'git', b'clone', b'--origin=origin', b'git@my.gitlab.instance:my/repository.git', b'/tmphpqbv437/tmpa0xwrlhk']' returned non-zero exit status 128.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/nix/store/rsc74jcy093n1qdiqda61sj3valz7839-python3.6-marge-0.8.1/bin/.marge.app-wrapped", line 4, in <module>
    marge.app.main()
  File "/nix/store/rsc74jcy093n1qdiqda61sj3valz7839-python3.6-marge-0.8.1/lib/python3.6/site-packages/marge/app.py", line 275, in main
    marge_bot.start()
  File "/nix/store/rsc74jcy093n1qdiqda61sj3valz7839-python3.6-marge-0.8.1/lib/python3.6/site-packages/marge/bot.py", line 42, in start
    self._run(repo_manager)
  File "/nix/store/rsc74jcy093n1qdiqda61sj3valz7839-python3.6-marge-0.8.1/lib/python3.6/site-packages/marge/bot.py", line 60, in _run
    projects,
  File "/nix/store/rsc74jcy093n1qdiqda61sj3valz7839-python3.6-marge-0.8.1/lib/python3.6/site-packages/marge/bot.py", line 98, in _process_projects
    self._process_merge_requests(repo_manager, project, merge_requests)
  File "/nix/store/rsc74jcy093n1qdiqda61sj3valz7839-python3.6-marge-0.8.1/lib/python3.6/site-packages/marge/bot.py", line 130, in _process_merge_requests
    repo = repo_manager.repo_for_project(project)
  File "/nix/store/rsc74jcy093n1qdiqda61sj3valz7839-python3.6-marge-0.8.1/lib/python3.6/site-packages/marge/store.py", line 24, in repo_for_project
    repo.clone()
  File "/nix/store/rsc74jcy093n1qdiqda61sj3valz7839-python3.6-marge-0.8.1/lib/python3.6/site-packages/marge/git.py", line 37, in clone
    self.local_path, from_repo=False)
  File "/nix/store/rsc74jcy093n1qdiqda61sj3valz7839-python3.6-marge-0.8.1/lib/python3.6/site-packages/marge/git.py", line 188, in git
    raise GitError(err)
marge.git.GitError: Command '[b'git', b'clone', b'--origin=origin', b'git@my.gitlab.instance:my/repository.git', b'/tmphpqbv437/tmpa0xwrlhk']' returned non-zero exit status 128.

I used the command from the docs to start Marge:

docker run --restart=on-failure \ # restart if marge crashes because GitLab is flaky
  -e MARGE_AUTH_TOKEN="$(cat marge-bot.token)" \
  -e MARGE_SSH_KEY="$(cat marge-bot-ssh-key)" \
  smarkets/marge-bot \
  --gitlab-url='https://my.gitlab.instance'

I tried running it on Kubernetes and am getting exactly the same errors. I have added the SSH key to GitLab and Marge is an administrator and maintainer in the relevant projects. The token and SSH key were also created as described in the docs.

aschmolck commented 5 years ago

Thanks for your report, this is due to a recent build refactoring and I'm planning to fix it tomorrow. Will update this bug once I've done so.

dominikmontada commented 5 years ago

@aschmolck Do you have any update on this issue?

aschmolck commented 5 years ago

@dominikmontada Sorry for the delay, didn't manage to get it done before leaving on holiday. Should be merged soon.

dominikmontada commented 5 years ago

@aschmolck No worries. I hope you had a nice vacation! Also thank you for the fix. New version is working flawlessly.