pydo.apps.create_deployment()

Description

Creating an app deployment will pull the latest changes from your repository and schedule a new deployment for your app.

Parameters

Name Type Required Description Default Value
app_id string True The app ID
body JSON or IO[bytes] True

Request Sample

import os
from pydo import Client

client = Client(token=os.environ.get("DIGITALOCEAN_TOKEN"))

create_resp = client.apps.create_deployment(app_id="b6bdf840", body={"force_build": True})

Responses

See the API spec for this endpoint to view additional detail on responses, headers, parameters, and more.

A JSON object with a deployment key.

Click to expand an example response for deployment.
{
  "value": {
    "deployment": {
      "id": "b6bdf840-2854-4f87-a36c-5f231c617c84",
      "spec": {
        "name": "sample-golang",
        "services": [
          {
            "name": "web",
            "github": {
              "repo": "digitalocean/sample-golang",
              "branch": "branch"
            },
            "run_command": "bin/sample-golang",
            "environment_slug": "go",
            "instance_size_slug": "apps-s-1vcpu-0.5gb",
            "instance_count": 2,
            "routes": [
              {
                "path": "/"
              }
            ]
          }
        ],
        "region": "ams"
      },
      "services": [
        {
          "name": "web",
          "source_commit_hash": "9a4df0b8e161e323bc3cdf1dc71878080fe144fa"
        }
      ],
      "phase_last_updated_at": "0001-01-01T00:00:00Z",
      "created_at": "2020-07-28T18:00:00Z",
      "updated_at": "2020-07-28T18:00:00Z",
      "cause": "commit 9a4df0b pushed to github/digitalocean/sample-golang",
      "progress": {
        "pending_steps": 6,
        "total_steps": 6,
        "steps": [
          {
            "name": "build",
            "status": "PENDING",
            "steps": [
              {
                "name": "initialize",
                "status": "PENDING"
              },
              {
                "name": "components",
                "status": "PENDING",
                "steps": [
                  {
                    "name": "web",
                    "status": "PENDING",
                    "component_name": "web",
                    "message_base": "Building service"
                  }
                ]
              }
            ]
          },
          {
            "name": "deploy",
            "status": "PENDING",
            "steps": [
              {
                "name": "initialize",
                "status": "PENDING"
              },
              {
                "name": "components",
                "status": "PENDING",
                "steps": [
                  {
                    "name": "web",
                    "status": "PENDING",
                    "steps": [
                      {
                        "name": "deploy",
                        "status": "PENDING",
                        "component_name": "web",
                        "message_base": "Deploying service"
                      },
                      {
                        "name": "wait",
                        "status": "PENDING",
                        "component_name": "web",
                        "message_base": "Waiting for service"
                      }
                    ],
                    "component_name": "web"
                  }
                ]
              },
              {
                "name": "finalize",
                "status": "PENDING"
              }
            ]
          }
        ]
      },
      "phase": "PENDING_BUILD",
      "tier_slug": "basic"
    }
  }
}

Unauthorized

Click to expand an example response.
{
  "id": "unauthorized",
  "message": "Unable to authenticate you."
}

The resource was not found.

Click to expand an example response.
{
  "id": "not_found",
  "message": "The resource you requested could not be found."
}

API Rate limit exceeded

Click to expand an example response.
{
  "id": "too_many_requests",
  "message": "API Rate limit exceeded."
}

Server error.

Click to expand an example response.
{
  "id": "server_error",
  "message": "Unexpected server-side error"
}

Unexpected error

Click to expand an example response.
{
  "id": "example_error",
  "message": "some error message"
}