Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updating pipeline schedules is not working #364

Closed
stuart-warren opened this issue May 10, 2022 · 9 comments
Closed

Updating pipeline schedules is not working #364

stuart-warren opened this issue May 10, 2022 · 9 comments

Comments

@stuart-warren
Copy link

Describe the bug

Similar to #361 updating pipeline schedules seems to have the same issue

Processing section 'schedules'
Error: Error occurred while processing project foo/gitlab/gitlabform, exception:
Request url='https://gitlab.foo.tech//api/v4/projects/foo%2Fgitlab%2Fgitlabform/pipeline_schedules/2464', method=PUT, data='{"active": true, "cron": "0 10 * * MON-FRI", "cron_timezone": "London", "ref": "master"}' failed - expected code(s) [200, 201], got code 403 & body: '{"message":"403 Forbidden"}'
Traceback (most recent call last):
  File "/gitlabform/gitlabform/core.py", line 430, in run
    self.project_processors.process_entity(
  File "/gitlabform/gitlabform/processors/__init__.py", line 30, in process_entity
    processor.process(
  File "/gitlabform/gitlabform/processors/util/decorators.py", line 42, in method_wrapper
    return method(self, project_and_group, SafeDict(configuration), *args)
  File "/gitlabform/gitlabform/processors/abstract_processor.py", line 48, in process
    self._process_configuration(project_or_project_and_group, configuration)
  File "/gitlabform/gitlabform/processors/project/schedules_processor.py", line 38, in _process_configuration
    updated_schedule = self.gitlab.update_pipeline_schedule(
  File "/gitlabform/gitlabform/gitlab/schedules.py", line 39, in update_pipeline_schedule
    return self._make_requests_to_api(
  File "/gitlabform/gitlabform/gitlab/core.py", line 127, in _make_requests_to_api
    response = self._make_request_to_api(
  File "/gitlabform/gitlabform/gitlab/core.py", line 218, in _make_request_to_api
    raise UnexpectedResponseException(
gitlabform.gitlab.core.UnexpectedResponseException: Request url='https://gitlab.foo.tech//api/v4/projects/foo%2Fgitlab%2Fgitlabform/pipeline_schedules/2464', method=PUT, data='{"active": true, "cron": "0 10 * * MON-FRI", "cron_timezone": "London", "ref": "master"}' failed - expected code(s) [200, 201], got code 403 & body: '{"message":"403 Forbidden"}'

GitLabForm version

2.11.0

GitLab version

F.e. 14.9.4-ee

@stuart-warren
Copy link
Author

Ah, think this may be due to an upstream change needing more than maintainer access to update pipeline schedules

https://gitlab.com/gitlab-org/gitlab-foss/blob/master/CHANGELOG.md#14101-2022-04-29

@stuart-warren
Copy link
Author

This was due to the gitlabform bot not being the owner of the scheduled pipeline it was trying to update

Curious it doesn't set the owner before trying to update the schedule

@stuart-warren stuart-warren reopened this May 10, 2022
@gdubicki
Copy link
Member

Hi @stuart-warren!

I wonder why this hasn't been caught by our acceptance tests... Anyway, I did what you suggested. Can you please test v2.11.1rc1 pre-release with the fix?

@stuart-warren
Copy link
Author

You probably don't have @jocado manually making themselves an owner of your scheduled pipelines :D

@stuart-warren
Copy link
Author

Unfortunately, this fails. Have added comment to MR

@stuart-warren
Copy link
Author

rc2 seems to work for me, thanks

@gdubicki
Copy link
Member

I just released v2.11.1 final with the fix.

@gdubicki
Copy link
Member

Thanks for the quick verification @stuart-warren! :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants