$npx -y skills add medusajs/medusa-agent-skills --skill mcloud-deploymentsExecute mcloud deployments commands to list deployments, retrieve deployment details, and fetch build logs. Use when listing deployments, checking deployment status, or reading build output for debugging build failures.
| 1 | # Cloud CLI: Deployments Commands |
| 2 | |
| 3 | Execute `mcloud deployments` commands to inspect deployments and their build logs. |
| 4 | |
| 5 | ## Constraints |
| 6 | |
| 7 | - Always pass `--json` when parsing output — plaintext format may change. |
| 8 | - Always confirm context (`mcloud whoami --json`) before running commands if org/project are not already known. |
| 9 | - Use `--deployment` IDs in the format `depl_*` or build IDs; build IDs resolve to their latest deployment automatically. |
| 10 | |
| 11 | ## Commands |
| 12 | |
| 13 | ### deployments list |
| 14 | |
| 15 | List recent deployments for a project (default: 20 most recent across all environments). |
| 16 | |
| 17 | ```bash |
| 18 | mcloud deployments list --organization <org-id> --project <project-id-or-handle> --json |
| 19 | ``` |
| 20 | |
| 21 | **Options:** |
| 22 | - `-o/--organization <id>` — Organization ID (falls back to active context) |
| 23 | - `-p/--project <id-or-handle>` — Project ID or handle (falls back to active context) |
| 24 | - `-e/--environment <handle>` — Filter by environment handle |
| 25 | - `--environment-type <production|long-lived|preview>` — Filter by environment type |
| 26 | - `--commit <sha>` — Filter by Git commit SHA (full or prefix) |
| 27 | - `--limit <1-200>` — Max results (default: `20`) |
| 28 | - `--offset <number>` — Pagination offset (default: `0`) |
| 29 | - `--json` — Output as JSON |
| 30 | |
| 31 | ### deployments get |
| 32 | |
| 33 | Retrieve a single deployment's details by ID. |
| 34 | |
| 35 | ```bash |
| 36 | mcloud deployments get <deployment-id> --organization <org-id> --project <project-id-or-handle> --json |
| 37 | ``` |
| 38 | |
| 39 | **Arguments:** |
| 40 | - `deployment` — Deployment ID (required) |
| 41 | |
| 42 | **Options:** |
| 43 | - `-o/--organization <id>`, `-p/--project <id-or-handle>`, `--json` |
| 44 | |
| 45 | ### deployments build-logs |
| 46 | |
| 47 | Fetch build logs for a deployment. Use this to debug `build-failed` status. |
| 48 | |
| 49 | ```bash |
| 50 | mcloud deployments build-logs <deployment-id> --organization <org-id> --project <project-id-or-handle> |
| 51 | ``` |
| 52 | |
| 53 | **Arguments:** |
| 54 | - `deployment` — Deployment ID (required) |
| 55 | |
| 56 | **Options:** |
| 57 | - `-o/--organization <id>`, `-p/--project <id-or-handle>` |
| 58 | - `--type <backend|storefront>` — Which build log stream to read (default: `backend`) |
| 59 | - `--json` — Output as JSON |
| 60 | |
| 61 | ## Deployment Statuses |
| 62 | |
| 63 | | Status | Meaning | |
| 64 | |--------|---------| |
| 65 | | `created` | Build not started yet | |
| 66 | | `building` | Build running | |
| 67 | | `built` | Build succeeded, awaiting rollout | |
| 68 | | `deploying` | Rolling out to environment | |
| 69 | | `deployed` | Live and serving traffic | |
| 70 | | `build-failed` | Build step failed — read `build-logs` | |
| 71 | | `deployment-failed` | Build succeeded, runtime crashed — read `mcloud logs` | |
| 72 | | `timed-out` | Exceeded time budget (backend only) | |
| 73 | | `canceled` | Superseded by a newer deployment | |
| 74 | | `idle` | No longer the active deployment | |
| 75 | |
| 76 | ## Examples |
| 77 | |
| 78 | ```bash |
| 79 | # List all deployments (with active context set) |
| 80 | mcloud deployments list --json |
| 81 | |
| 82 | # Find most recent build-failed deployment |
| 83 | mcloud deployments list --json \ |
| 84 | | jq -r '[.[] | select(.backend_status == "build-failed")][0].id' |
| 85 | |
| 86 | # Get deployment details |
| 87 | mcloud deployments get bld_01ABC123 --json |
| 88 | |
| 89 | # Read backend build logs |
| 90 | mcloud deployments build-logs bld_01ABC123 |
| 91 | |
| 92 | # Read storefront build logs |
| 93 | mcloud deployments build-logs bld_01ABC123 --type storefront |
| 94 | |
| 95 | # Filter deployments by commit SHA |
| 96 | mcloud deployments list --commit a1b2c3d --json | jq '.' |
| 97 | |
| 98 | # Get deployments for a specific environment |
| 99 | mcloud deployments list --environment production --json |
| 100 | ``` |