Skip to content

support environments/stop_stale #3243

@felixhummel

Description

@felixhummel

Description of the problem, including code/CLI snippet

python-gitlab should support stopping stale environments: https://docs.gitlab.com/api/environments/#stop-stale-environments

Expected Behavior

something like

gl = Gitlab.from_config("git.example.com")
project = gl.projects.get("foo/bar")

# THIS DOES NOT WORK
project.environments.stop_stale("2025-07-08T00:00:00Z")

Actual Behavior

there is no function like that

workaround

from gitlab import Gitlab

gl = Gitlab.from_config("git.example.com")
project = gl.projects.get("foo/bar")
gl.http_post(
    f"/projects/{project.id}/environments/stop_stale",
    post_data={"before": "2025-07-08T00:00:00Z"},
)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions