Update an environment's deployment settings
Changes the settings you send and answers them all as they are now. Moving the source off git removes the environment's repositories, so it needs confirm_remove_repositories true when there are any. To change a pipeline's folders or build switches, send its pipeline_id with them; a refused folder refuses the whole request.
Path parameters
The id of a CoreStack Enterprise environment. Not the same number as a site row id. At least 1.
Body
True to move an environment that has repositories off git, which removes them and their webhooks.
manual or git. sftp is accepted only for an environment that already uses it.
manualgitsftpWhether a push deploys on its own. Applies only while the pipeline is on and the source is git.
manualautomaticWhether a build keeps its own var folder. Only on a pipeline it applies to.
Whether scheduled tasks pause while a build runs. Only on a pipeline it applies to.
Turn the deployment pipeline on or off.
The pipeline whose folders or build switches change. Goes with at least one of them. At least 1.
The pipeline's web folder: an absolute path that starts and ends with a slash, of letters, digits, ., _, - and /, with no .. part, at most 255 characters, under /var/www/, /var/www_m2/, /var/www_vsf/ or /var/www_blog/, and never one of those itself.
The pipeline's storage folder, held to the same rule as root_directory. Up to 255 characters.
Returns
200 The deployment settings after the change.
Fields of the 200 answer
Fields
Where deployments come from.
manualsftpgitnullThe sources the environment may be set to. sftp is listed only for an environment that still uses it.
manualsftpgitThe environment's id.
automatic deploys every push on its own. manual leaves each push waiting to be deployed. Null unless the pipeline is on and the source is git.
manualautomaticnullWhether the deployment pipeline is on.
Fields of each item
Whether you may change the pipeline's build switches.
Whether you may change the pipeline's folders.
Whether a build keeps its own var folder. Null on a pipeline it does not apply to.
What to know about the build switches as they are set. Empty when nothing.
Whether scheduled tasks pause while a build runs. Null on a pipeline it does not apply to.
The pipeline's web folder.
The pipeline's storage folder.
How many repositories the environment has.
If it is refused
| Status | Reason | What to do |
|---|---|---|
401 | none | Send a valid token as Authorization: Bearer <token>. |
403 | company_unavailable | Your company is unavailable. |
403 | forbidden | The person is not allowed to do this. |
403 | scope_required | Use a token with the scope named in scope. |
403 | two_factor_required | Turn on two-factor on your account, then send again. |
404 | none | Check the id. You see only what your account can reach. |
409 | not_available | The tool does not apply to this object. |
422 | confirm | The action needs an explicit confirmation field. Ask the person, then send it. |
422 | invalid | Fix the field named in field; errors says why. |
429 | rate_limited | Wait for the seconds in Retry-After. |
Reasons are listed by name in Errors and refusals.
The same task elsewhere
curl -X PATCH https://manage.corefinity.com/api/environments/1311/deployment-settings \
-H "Authorization: Bearer $COREFINITY_TOKEN" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-d '{
"git_deploys": "automatic"
}'use Illuminate\Support\Facades\Http;
$response = Http::withToken(env('COREFINITY_TOKEN'))
->acceptJson()
->patch('https://manage.corefinity.com/api/environments/1311/deployment-settings', [
'git_deploys' => 'automatic',
]);
$data = $response->json();const res = await fetch('https://manage.corefinity.com/api/environments/1311/deployment-settings', {
method: 'PATCH',
headers: {
Authorization: `Bearer ${process.env.COREFINITY_TOKEN}`,
Accept: 'application/json',
'Content-Type': 'application/json',
},
body: JSON.stringify({
git_deploys: 'automatic',
}),
});
// An answer with no body (204) has nothing to parse.
const text = await res.text();
const data = text && JSON.parse(text);import os
import requests
res = requests.patch(
"https://manage.corefinity.com/api/environments/1311/deployment-settings",
headers={
"Authorization": f"Bearer {os.environ['COREFINITY_TOKEN']}",
"Accept": "application/json",
},
json={
"git_deploys": "automatic",
},
)
data = res.json() if res.content else None{
"deployment_settings": {
"deployment_source": "git",
"deployment_sources": [
"manual",
"git"
],
"enterprise_env_id": 1311,
"git_deploys": "automatic",
"pipeline_enabled": true,
"pipelines": [
{
"build_switches_editable": false,
"folders_editable": true,
"isolate_build_var": null,
"name": "Storefront (Wordpress)",
"notes": [],
"pause_crons_during_build": null,
"pipeline_id": 2210,
"root_directory": "/var/www/harbourandfinch.example.com/",
"root_storage": "/var/www/harbourandfinch.example.com/shared/"
}
],
"repositories": 1
}
}{
"message": "Unauthenticated."
}{
"code": "company_unavailable",
"message": "Your company is unavailable.",
"reason": "company_unavailable"
}{
"message": "Not found."
}{
"code": "not_available",
"message": "Git deploys apply only to an environment that deploys from git.",
"reason": "not_available"
}{
"code": "confirm",
"errors": {
"confirm_remove_repositories": [
"Moving this environment off git deployments removes its repository and that repository's webhook. Ask the person, then send confirm_remove_repositories: true."
]
},
"message": "Moving this environment off git deployments removes its repository and that repository's webhook. Ask the person, then send confirm_remove_repositories: true.",
"reason": "confirm"
}{
"code": "rate_limited",
"message": "Too many requests. Try again in 60 seconds.",
"reason": "rate_limited",
"retry_after_seconds": 60
}Try it is off for this endpointIt deletes data that cannot be brought back. Copy the request and run it yourself when you are sure.