Copy a pipeline from another environment
Copies the chosen parts of the pipeline of another environment of the same site onto this one: its stages, settings, variables, registry secrets and deployment options. Send dry_run true to see what would change and write nothing; copying onto a production environment needs confirm_production true. Your role needs the Edit Environment Deployment Pipeline permission.
- Needs
execas well: The copied stages bring a command this pipeline does not run now (never for a dry run).
Path parameters
The id of a site row. A website's production site and each of its environments has its own id. Digits only. At least 1.
The id of one of the environment's pipelines, as the pipeline read answers it in binding_id and bindings[].id. Digits only. At least 1.
Body
True to copy onto a production environment.
Write nothing and answer what would change.
One of that environment's pipelines. Its repository's pipeline when left out. At least 1.
The site row of another environment of the same site. At least 1.
Up to 5 items.
stagessettingsvariablessecretsoptionsThe revision of this pipeline that you read. Needed to copy stages or settings, which are refused stale without it; a dry run checks against the pipeline as it is now when it is left out.
Returns
200 What was, or would be, copied, part by part.
Fields of the 200 answer
Each part asked for, with what changed.
Fields of each item
What the copy adds to this pipeline.
What it replaces.
What is already the same.
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 | scope_required | Use a token with the scope named in scope. |
403 | forbidden | The person is not allowed to do this. |
403 | two_factor_required | Turn on two-factor on your account, then send again. |
404 | feature_off | This feature is not on for your organisation yet. |
409 | managed_elsewhere | This site is read-only here. Change it in the control panel that manages it. |
409 | pipeline_classic | Corefinity still runs this pipeline in its classic form, so it cannot be edited yet. |
409 | pipeline_locked | Corefinity has locked this pipeline: Held while a migration is checked. |
409 | stale | What you read has changed since you read it. Read it again, then send the change with its new version or quote. |
422 | confirm | The action needs an explicit confirmation field. Ask the person, then send it. |
422 | line_credentials | This line holds a credential. Move this value into a variable, then save again. |
422 | maintenance_policy_unavailable | Choose Always or Off: this platform has no pending-upgrade check. |
422 | invalid | Fix the field named in field; errors says why. |
422 | timeout_out_of_range | Choose a timeout between 60 and 3600 seconds. |
422 | version_unavailable | This version is not available here. |
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 POST https://manage.corefinity.com/api/corestack/sites/1042/deployments/pipeline/2210/copy \
-H "Authorization: Bearer $COREFINITY_TOKEN" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-d '{
"from_site_id": 1042,
"parts": [
"stages",
"settings"
],
"revision": "3b4b4f4d2bd57cc6"
}'use Illuminate\Support\Facades\Http;
$response = Http::withToken(env('COREFINITY_TOKEN'))
->acceptJson()
->post('https://manage.corefinity.com/api/corestack/sites/1042/deployments/pipeline/2210/copy', [
'from_site_id' => 1042,
'parts' => [
'stages',
'settings',
],
'revision' => '3b4b4f4d2bd57cc6',
]);
$data = $response->json();const res = await fetch('https://manage.corefinity.com/api/corestack/sites/1042/deployments/pipeline/2210/copy', {
method: 'POST',
headers: {
Authorization: `Bearer ${process.env.COREFINITY_TOKEN}`,
Accept: 'application/json',
'Content-Type': 'application/json',
},
body: JSON.stringify({
from_site_id: 1042,
parts: [
'stages',
'settings',
],
revision: '3b4b4f4d2bd57cc6',
}),
});
// 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.post(
"https://manage.corefinity.com/api/corestack/sites/1042/deployments/pipeline/2210/copy",
headers={
"Authorization": f"Bearer {os.environ['COREFINITY_TOKEN']}",
"Accept": "application/json",
},
json={
"from_site_id": 1042,
"parts": [
"stages",
"settings",
],
"revision": "3b4b4f4d2bd57cc6",
},
)
data = res.json() if res.content else None{
"dry_run": false,
"from_site_id": 1042,
"parts": [
{
"added": [],
"overwritten": [
"post_deploy"
],
"part": "stages",
"removed": [],
"unchanged": [
"build",
"database"
]
},
{
"added": [],
"overwritten": [],
"part": "settings",
"removed": [],
"unchanged": [
"maintenance_policy",
"tunnels",
"pause_crons",
"run_migrations",
"timeouts",
"keep_node_modules"
]
}
]
}{
"message": "Unauthenticated."
}{
"code": "company_unavailable",
"message": "Your company is unavailable.",
"reason": "company_unavailable"
}{
"code": "feature_off",
"message": "Not found.",
"reason": "feature_off"
}{
"code": "managed_elsewhere",
"message": "This site is managed by another control panel",
"reason": "managed_elsewhere"
}{
"code": "confirm",
"errors": {
"confirm_production": [
"Copying into production changes how it deploys. Confirm to continue."
]
},
"message": "Copying into production changes how it deploys. Confirm to continue.",
"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 overwrites data that cannot be brought back. Copy the request and run it yourself when you are sure.