Skip to content

API: expose Environment "auto stop jobs" array, and "auto_stop_in" values

Proposal

Currently, the results of a call to GET api/v4/projects/:id/environments/:environment_id do not include any information about autostop jobs or autostop timers associated with the environment. This makes it difficult to ascertain if your pipelines are setting the autostop jobs as you need them to, as the auto-stop actions are not visible or retrievable anywhere at all. The auto-stop timer is exposed in the Environments webUI page, but the stop job(s) are not.

This is a request to add the set of auto-stop actions/jobs and the auto-stop timer associated with an Environment.

For clarity, given:

stages:
  - deploy
  - done

.deploy:
  stage: deploy
  script:
    - date
  environment:
    name: test
    action: start
    auto_stop_in: 1 week

deploy1:
  extends: [ .deploy ]
  environment:
    on_stop: done1

deploy2:
  extends: [ .deploy ]
  environment:
    on_stop: done2

.done:
  stage: done
  script:
    - date
  environment:
    name: test
    action: stop

done1:
  extends: [ .done ]

done2:
  extends: [ .done ]
  

I'd like a call to get the Environment details to include the details of the jobs done1 and done2 in an element named something like "autostops" or "autostop_jobs" or similar, along with information about when these jobs will be scheduled to run (the auto_stop_in value).