Skip to content

No way to retry a trigger job #3346

@eacherkan-via

Description

@eacherkan-via

Description of the problem, including code/CLI snippet

ProjectPipelineBridge objects (trigger/bridge jobs) cannot be retried through the high-level API. The class lacks retry(), cancel(), and similar methods that ProjectJob has.

Fetching the bridge as a ProjectJob via project.jobs.get(bridge.id) also fails with a 404, since the /projects/:id/jobs/:id endpoint does not return bridge jobs.

The only way I found to retry a bridge is via a raw HTTP call:

pipeline = project.pipelines.get(pipeline_id)
bridges = pipeline.bridges.list(all=True)
bridge = bridges[0]

# This fails - ProjectPipelineBridge has no retry()
bridge.retry()  # AttributeError

# This also fails - bridges aren't accessible via the jobs endpoint
project.jobs.get(bridge.id).retry()  # GitlabGetError: 404

# Only this works
project.manager.gitlab.http_post(f"/projects/{project.id}/jobs/{bridge.id}/retry")

Expected Behavior

ProjectPipelineBridge should support retry() (and maybe other job actions like cancel()) either by:

  • Adding the appropriate mixins/custom actions to ProjectPipelineBridge, or
  • Making bridge jobs accessible via project.jobs.get().

The GitLab REST API itself supports POST /projects/:id/jobs/:job_id/retry for bridge jobs (since GitLab 17), it's only the python-gitlab object model that prevents it.

Actual Behavior

  • bridge.retry() raises AttributeError: 'ProjectPipelineBridge' object has no attribute 'retry'
  • project.jobs.get(bridge.id) raises GitlabGetError: 404: 404 Not found

Specifications

  • python-gitlab version: 8.0.0
  • Gitlab server version: self-hosted 18.5.5

Metadata

Metadata

Assignees

No one assigned

    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