upsert_deployment
Add or update a Deployment · write tool
Adds a Deployment, or updates the fields (url, endpoints, instances) of the one its (service, environment, target) triple names, in this Project’s YAML; comments and formatting are kept. instances is a whole number for a fixed count, such as 3, or {min, max} for an autoscale range, such as {min: 2, max: 10}; leave it out for one instance. Use it for interchangeable copies on one Target (an App Service plan running N workers); when placement matters (one per availability zone or VM), add separate Deployments on separate Targets instead. A new one goes into file (relative to the Project’s folder), else beside the Project’s other Deployments, else into model.yaml.
| Field | Type | Required | Notes |
|---|---|---|---|
project |
string | yes | The Project to edit, by id. |
service |
string | yes | The Service deployed: an id in this Project, or project:id. |
environment |
string | yes | The Environment, by bare id. |
target |
string | yes | The Deployment Target: an id in this Project, or project:id. |
fields |
map of id → any | Fields to set, as in YAML; null removes a field. Fields not given are left as they are. Default: {}. |
|
file |
string | For a new Deployment: a .yaml file relative to the Project’s folder. | |
dry_run |
boolean | Check the write and return its diff without changing any file. Default: false. |
Output
Section titled “Output”| Field | Type | Required | Notes |
|---|---|---|---|
action |
"created" or "updated" or "removed" or "unchanged" |
yes | |
id |
string or null | yes | The qualified id written (bare for a Team, Environment or Project); null for a Deployment, or a Relationship without one. |
from |
string | ||
to |
string | ||
service |
string | ||
environment |
string | ||
target |
string | ||
files |
list of string | yes | |
diff |
string | yes | |
dryRun |
boolean | yes |
Example
Section titled “Example”Called over the Kitchen sink example Workspace.
Arguments:
{ "project": "sink", "service": "reports", "environment": "prod", "target": "cluster", "dry_run": true}Result:
{ "action": "created", "id": null, "service": "sink:reports", "environment": "prod", "target": "sink:cluster", "files": [ "examples/kitchen-sink/archidocs/sink/deployments.yaml" ], "dryRun": true, "diff": "(the patch below)"}The diff, as a patch:
--- a/examples/kitchen-sink/archidocs/sink/deployments.yaml+++ b/examples/kitchen-sink/archidocs/sink/deployments.yaml@@ -35,4 +35,8 @@ - service: search environment: prod target: cloud+ - service: reports+ environment: prod+ target: cluster+ #endregionErrors
Section titled “Errors”A call that fails returns isError: true, with {code, message, suggestions?} as structuredContent. This tool returns:
invalid_inputwhen the arguments don’t fit the input above.not_foundwhen the Project, or an id it names, matches nothing.ambiguouswhen the arguments match more than one Relationship or Deployment.validation_failedwhen the write would add a check error. Nothing is written.read_onlywhen the server reads a published Workspace Bundle, or serves HTTP without--allow-writes.source_unavailablewhen the server can’t read the Workspace.
Error codes says what to do about each.
See also
Section titled “See also”Documents Archidocs v1.4.0, the latest release.