Allow users to set Agent to an Environment via public v4 API
Release notes
Problem to solve
With Allow to Select Agent in Environment setting page (#396407 - closed), users can set an agent to an environment, but if environments are created dynamically (e.g. Review Apps) setting one by one for each environment is cumbersome task so there should be an automated way.
We should allow users to define the environment - cluster connection programmatically, so I don't have to use a UI for repetitive tasks.
Proposal
Support cluster_agent_id
param in Environment API.
cluster_agent_id
param can accept numerical ID (e.g. 123
) or Full path of agent (e.g. gitlab-org/agent-ci-test:production
).
And, return cluster_agent
entity from Get a specific environment API, so that users can see what's being set in the environment.
Example
https://docs.gitlab.com/ee/api/environments.html#update-an-existing-environment
curl --request PUT \
--data "cluster_agent_id=gitlab-org/agent-ci-test:production" \
--header "PRIVATE-TOKEN: <your_access_token>" \
"https://gitlab.example.com/api/v4/projects/1/environments/1"
or
curl --request PUT \
--data "cluster_agent_id=123" \
--header "PRIVATE-TOKEN: <your_access_token>" \
"https://gitlab.example.com/api/v4/projects/1/environments/1"
Intended users
Feature Usage Metrics
This page may contain information related to upcoming products, features and functionality. It is important to note that the information presented is for informational purposes only, so please do not rely on the information for purchasing or planning purposes. Just like with all projects, the items mentioned on the page are subject to change or delay, and the development, release, and timing of any products, features, or functionality remain at the sole discretion of GitLab Inc.