FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

`project-merge-request cancel-merge-when-pipeline-succeeds` fails with `gitlab.exceptions.GitlabMROnBuildSuccessError: 404: 404 Not Found` · Issue #2349 · python-gitlab/python-gitlab · GitHub

Repository navigation

project-merge-request cancel-merge-when-pipeline-succeeds fails with gitlab.exceptions.GitlabMROnBuildSuccessError: 404: 404 Not Found #2349

Description

Description of the problem, including code/CLI snippet

When a pipeline is marked a merge on successful pipeline it seems this cannot be cancelled as the request is failing with a 404.

Running python-gitlab with -d shows that's it's doing a PUT:

DEBUG:urllib3.connectionpool:https://gitlab.<redacted>:443 "PUT /api/v4/projects/10/merge_requests/26/cancel_merge_when_pipeline_succeeds HTTP/1.1" 404 25
                                                           ^^^^^

The documentation however specfies a POST should be used: https://docs.gitlab.com/ee/api/merge_requests.html#cancel-merge-when-pipeline-succeeds

Expected Behavior

The request to merge is cancelled when pipeline succeeded.

Actual Behavior

# gitlab -v project-merge-request cancel-merge-when-pipeline-succeeds --project-id 10 --iid 26                    INT ✘ 
Traceback (most recent call last):
  File "/usr/lib/python3.10/site-packages/gitlab/exceptions.py", line 333, in wrapped_f
    return f(*args, **kwargs)
  File "/usr/lib/python3.10/site-packages/gitlab/v4/objects/merge_requests.py", line 188, in cancel_merge_when_pipeline_succeeds
    server_data = self.manager.gitlab.http_put(path, **kwargs)
  File "/usr/lib/python3.10/site-packages/gitlab/client.py", line 1067, in http_put
    result = self.http_request(
  File "/usr/lib/python3.10/site-packages/gitlab/client.py", line 798, in http_request
    raise gitlab.exceptions.GitlabHttpError(
gitlab.exceptions.GitlabHttpError: 404: 404 Not Found

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/bin/gitlab", line 33, in <module>
    sys.exit(load_entry_point('python-gitlab==3.10.0', 'console_scripts', 'gitlab')())
  File "/usr/lib/python3.10/site-packages/gitlab/cli.py", line 377, in main
    gitlab.v4.cli.run(
  File "/usr/lib/python3.10/site-packages/gitlab/v4/cli.py", line 542, in run
    data = g_cli.run()
  File "/usr/lib/python3.10/site-packages/gitlab/v4/cli.py", line 81, in run
    return self.do_custom()
  File "/usr/lib/python3.10/site-packages/gitlab/v4/cli.py", line 102, in do_custom
    return getattr(class_instance, method_name)(**self.args)
  File "/usr/lib/python3.10/site-packages/gitlab/cli.py", line 71, in wrapped_f
    return f(*args, **kwargs)
  File "/usr/lib/python3.10/site-packages/gitlab/exceptions.py", line 335, in wrapped_f
    raise error(e.error_message, e.response_code, e.response_body) from e
gitlab.exceptions.GitlabMROnBuildSuccessError: 404: 404 Not Found

Specifications

  • python-gitlab version: 3.10.0
  • API version you are using (v3/v4): v4
  • Gitlab server version (or gitlab.com): 15.5.1 (but also observed on 15.3.3)

Activity

  1. TheDJVG commented on Oct 30, 2022

    Author

    A POST seems work (201 created) but it seems that the returning data does not include certain information:

    DEBUG:urllib3.connectionpool:https://gitlab.<redacted>:443 "POST /api/v4/projects/10/merge_requests/26/cancel_merge_when_pipeline_succeeds HTTP/1.1" 201 81
    Traceback (most recent call last):
      File "/usr/bin/gitlab", line 33, in <module>
        sys.exit(load_entry_point('python-gitlab==3.10.0', 'console_scripts', 'gitlab')())
      File "/usr/lib/python3.10/site-packages/gitlab/cli.py", line 377, in main           
        gitlab.v4.cli.run(                                                                 
      File "/usr/lib/python3.10/site-packages/gitlab/v4/cli.py", line 551, in run
        printer.display(get_dict(data, fields), verbose=verbose, obj=data)       
      File "/usr/lib/python3.10/site-packages/gitlab/v4/cli.py", line 490, in display
        id = getattr(obj, obj._id_attr)                                                    
      File "/usr/lib/python3.10/site-packages/gitlab/base.py", line 134, in __getattr__
        raise AttributeError(message)                                                      
    AttributeError: 'ProjectMergeRequest' object has no attribute 'iid'
    
  2. JohnVillalovos commented on Oct 30, 2022

    Member

    Thanks for the bug report. I'll try to work on updating it from a PUT to a POST. And add a functional test to the API.

  3. added 3 commits that reference this issue on Oct 30, 2022
    4184511
    a07a94e
    19ee535
  4. added a commit that references this issue on Oct 31, 2022
    cd31cda
  5. locked as resolved and limited conversation to collaborators on Nov 6, 2023
  6. added a commit that references this issue on Feb 26, 2024
    bd82d74
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


    Back | FazBrowse Home | New Git URL