Skip to content

processing archived projects (and failing) #157

@weakcamel

Description

@weakcamel

When running gitlabform against ALL projects, gitlabform is attempting to apply configuration also to archived ones. This doesn't work since they're read-only and results in the following exception (in this case, on attempting to set MR approvals):

+++ Error while processing 'groupname/archivedproject'
Traceback (most recent call last):
  File "/root/.local/share/virtualenvs/config-5_OqMU1e/lib/python3.8/site-packages/gitlabform/gitlabform/core.py", line 313, in process_all
    self.process_merge_requests(project_and_group, configuration)
  File "/root/.local/share/virtualenvs/config-5_OqMU1e/lib/python3.8/site-packages/gitlabform/gitlabform/core.py", line 42, in method_wrapper
    return method(self, project_and_group, configuration)
  File "/root/.local/share/virtualenvs/config-5_OqMU1e/lib/python3.8/site-packages/gitlabform/gitlabform/core.py", line 86, in method_wrapper
    return method(self, project_and_group, SafeDict(configuration))
  File "/root/.local/share/virtualenvs/config-5_OqMU1e/lib/python3.8/site-packages/gitlabform/gitlabform/core.py", line 356, in process_merge_requests
    self.gl.post_approvals_settings(project_and_group, approvals)
  File "/root/.local/share/virtualenvs/config-5_OqMU1e/lib/python3.8/site-packages/gitlabform/gitlab/projects.py", line 142, in post_approvals_settings
    self._make_requests_to_api("projects/%s/approvals", pid, 'POST', data, expected_codes=201)
  File "/root/.local/share/virtualenvs/config-5_OqMU1e/lib/python3.8/site-packages/gitlabform/gitlab/core.py", line 115, in _make_requests_to_api
    response = self._make_request_to_api(path_as_format_string, args, method, data, expected_codes, json)
  File "/root/.local/share/virtualenvs/config-5_OqMU1e/lib/python3.8/site-packages/gitlabform/gitlab/core.py", line 171, in _make_request_to_api
    raise UnexpectedResponseException(
gitlabform.gitlab.core.UnexpectedResponseException: Request url='https://gitlab1.speechmatics.io/api/v4/projects/335/approvals', method=POST, data='{'approvals_before_merge': 1, 'reset_approvals_on_push': False, 'disable_overriding_approvers_per_merge_request': True, 'merge_requests_author_approval': True, 'id': '335'}' failed - expected code(s) [201], got code 403 & body: 'b'{"message":"403 Forbidden"}''

Note: I'm using 1.17.0.1 (soon to be upgraded) but release notes of more current releases don't indicate any changes in this area.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions