Skip to content

Extend environment field in GraphQL to expose deploy freezes

What does this MR do and why?

This merge request exposes deploy_freezes in the environment field in GraphQL API.

Please note the following:

  • There has been a discussion on whether to add deploy_freezes to the project or the environment field.
  • We reached an agreement we add it now to environment for the MVC and add scopes to deploy freezes later.
  • The business logic for how start_time and end_time is calculated is specified here.
  • We use Gitlab::SafeRequestStore to cache the result of deploy_freezes as per the backend proposal.

Resolves backend part of #212460 (closed).

Query Example

projects(fullPath: `root/gitlab-212460`) {
  environment(name: "production") {
    deploy_freezes {        
      status
      start_cron
      end_cron
      start_time
      end_time
    }
  }
}

Response

{
  "data": {
    "project": {
      "environment": {
        "deployFreezes": [
          {
            "status": "INACTIVE",
            "startCron": "0 15 * * *",
            "endCron": "0 18 * * *",
            "startTime": "2022-11-30T14:00:00Z",
            "endTime": "2022-11-30T17:00:00Z"
          },
          {
            "status": "ACTIVE",
            "startCron": "0 12 * * *",
            "endCron": "0 22 * * *",
            "startTime": "2022-11-30T11:00:00Z",
            "endTime": "2022-11-30T21:00:00Z"
          }
        ]
      }
    }
  }
}

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Ahmed Hemdan

Merge request reports

Loading