Skip to content

Allow configuring "auto_stop_setting" through graphql

What does this MR do and why?

Allow configuring auto_stop_setting through GraphQL.

Configuring it through REST API will be enabled by the another MR: !175940 (merged).

Changelog: added

References

MR acceptance checklist

Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

Screenshots or screen recordings

Screenshots are required for UI changes, and strongly recommended for all other merge requests.

Before After

How to set up and validate locally

Numbered steps to set up and validate the change are strongly suggested.

  1. Run GDK and open grapiql (https://gdk.test:3443/-/graphql-explorer)
  2. Create environment.
mutation CreateEnvironment($projectPath: ID!, $name: String!, $autoStopSetting: AutoStopSetting) {
  environmentCreate(
    input: { projectPath: $projectPath, name: $name, autoStopSetting: $autoStopSetting }
  ) {
    environment {
      id
      name
      tier
      autoStopSetting
    }
    errors
  }
}

# variable
{
  "projectPath": "root/auto-stop-setting",
  "name": "staging3",
  "autoStopSetting": "WITH_ACTION"
}
  1. Update it
mutation UpdateAutoStopSetting($environmentId: EnvironmentID!, $autoStopSetting: AutoStopSetting!) {
  environmentUpdate(input: { id: $environmentId, autoStopSetting: $autoStopSetting }) {
    environment {
      id
      autoStopSetting
    }
    errors
  }
}

# variable
{
  "environmentId": "gid://gitlab/Environment/51",
  "autoStopSetting": "ALWAYS"
}
  1. Get it
query Env {
  project(fullPath:"root/auto-stop-setting") {
    environment(name: "staging3") {
          id
          tier
          autoStopSetting
    }
  }  
}

response:

{
  "data": {
    "project": {
      "environment": {
        "id": "gid://gitlab/Environment/51",
        "tier": "STAGING",
        "autoStopSetting": "ALWAYS"
      }
    }
  },
  "correlationId": "01JFCBD2DCPEYA7AR5GV2WTKRQ"
}
Edited by Taka Nishida

Merge request reports

Loading