Skip to content

Support Cluster Agent ID in Environment Create mutation

This MR is based on Support Cluster Agent ID in Environment Update ... (!121115 - merged)

What does this MR do and why?

Support Cluster Agent ID in Environment Create mutation

This commit allows users to set Cluster Agent ID to a newly created environment.

Related to Allow to Select Agent in Environment setting page (#396407 - closed)

Mutation request examples

Set an cluster to an environment

GraphQL Mutation request

mutation {
  environmentCreate(input: {
    	projectPath: "root/pipeline-playground",
    	name: "test",
      clusterAgentId: "gid://gitlab/Clusters::Agent/2"
    }) {
    environment {
      name
      clusterAgent {
        name
      }
    }
    errors
  }
}

Response

{
  "data": {
    "environmentCreate": {
      "environment": {
        "name": "test",
        "clusterAgent": {
          "name": "prod"
        }
      },
      "errors": []
    }
  }
}

How to set up and validate locally

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

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 Shinya Maeda

Merge request reports

Loading