chore(pre-deploy): warn about depends_on: service_completed_successfully to use pre-deploy hook instead

This commit is contained in:
Pasha Sviderski
2026-04-10 17:08:38 +10:00
parent 4e060914ec
commit 07e380b95f
3 changed files with 102 additions and 68 deletions
+19
View File
@@ -239,6 +239,25 @@ networks:
warnCount: 1, warnCount: 1,
warnContains: []string{"networks"}, warnContains: []string{"networks"},
}, },
{
name: "unsupported depends_on service_completed_successfully",
composeYAML: `services:
migrate:
image: alpine
command: ["true"]
app:
image: nginx
depends_on:
migrate:
condition: service_completed_successfully
`,
warnCount: 1,
warnContains: []string{
"service_completed_successfully",
"pre-deploy hook",
"https://uncloud.run/docs/guides/deployments/pre-deploy-hooks",
},
},
{ {
name: "multiple unsupported features", name: "multiple unsupported features",
composeYAML: `services: composeYAML: `services:
+15
View File
@@ -495,6 +495,21 @@ func validateServicesFeatures(project *types.Project) []error {
errs = append(errs, err(service.Name, "networks")) errs = append(errs, err(service.Name, "networks"))
} }
} }
// Err about depends_on conditions 'service_completed_successfully' that we do not support because services in
// Uncloud are long-running. Services that run to completion need a separate abstraction, e.g. a Job.
// Plus we don't want the lifecycle of a service to control the lifecycle of another one. It should be fully
// owned. Otherwise, it's hard to make the behaviour deterministic when each service could also be deployed and
// managed independently.
for depName, dep := range service.DependsOn {
if dep.Condition == types.ServiceConditionCompletedSuccessfully {
errs = append(errs, fmt.Errorf(
"service '%s': depends_on condition '%s' on service '%s' is not supported, "+
"use a pre-deploy hook instead: %s",
service.Name, types.ServiceConditionCompletedSuccessfully, depName,
"https://uncloud.run/docs/guides/deployments/pre-deploy-hooks"))
}
}
} }
return errs return errs
@@ -10,74 +10,74 @@ If you rely on a specific Compose feature that is not supported by Uncloud, plea
::: :::
| Feature | Support Status | Notes | | Feature | Support Status | Notes |
|----------------------------------|--------------------|----------------------------------------------------------------------------------------------------------------| |----------------------------------|--------------------|--------------------------------------------------------------------------------------------------------------------------------------------|
| **Services** | | | | **Services** | | |
| `build` | ✅ Supported | Build context and Dockerfile | | `build` | ✅ Supported | Build context and Dockerfile |
| `cap_add` | ✅ Supported | Additional kernel [capabilities](https://man7.org/linux/man-pages/man7/capabilities.7.html) | | `cap_add` | ✅ Supported | Additional kernel [capabilities](https://man7.org/linux/man-pages/man7/capabilities.7.html) |
| `cap_drop` | ✅ Supported | Which kernel [capabilities](https://man7.org/linux/man-pages/man7/capabilities.7.html) to drop | | `cap_drop` | ✅ Supported | Which kernel [capabilities](https://man7.org/linux/man-pages/man7/capabilities.7.html) to drop |
| `command` | ✅ Supported | Override container command | | `command` | ✅ Supported | Override container command |
| `configs` | ✅ Supported | File-based and inline configs | | `configs` | ✅ Supported | File-based and inline configs |
| `cpus` | ✅ Supported | CPU limit | | `cpus` | ✅ Supported | CPU limit |
| `depends_on` | ⚠️ Limited | Services deployed in order but conditions not checked | | `depends_on` | ⚠️ Limited | Deployed in dependency order. Use [pre-deploy hooks](../4-guides/1-deployments/5-pre-deploy-hooks.md) for `service_completed_successfully` |
| `devices` | ✅ Supported | Device mappings | | `devices` | ✅ Supported | Device mappings |
| `dns` | ❌ Not supported | Built-in service discovery | | `dns` | ❌ Not supported | Built-in service discovery |
| `dns_search` | ❌ Not supported | Built-in service discovery | | `dns_search` | ❌ Not supported | Built-in service discovery |
| `entrypoint` | ✅ Supported | Override container entrypoint | | `entrypoint` | ✅ Supported | Override container entrypoint |
| `env_file` | ✅ Supported | Environment file | | `env_file` | ✅ Supported | Environment file |
| `environment` | ✅ Supported | Environment variables | | `environment` | ✅ Supported | Environment variables |
| `gpus` | ✅ Supported | GPU device access | | `gpus` | ✅ Supported | GPU device access |
| `healthcheck` | ✅ Supported | Health check configuration | | `healthcheck` | ✅ Supported | Health check configuration |
| `image` | ✅ Supported | Container image specification | | `image` | ✅ Supported | Container image specification |
| `init` | ✅ Supported | Run init process in container | | `init` | ✅ Supported | Run init process in container |
| `labels` | ❌ Not supported | | | `labels` | ❌ Not supported | |
| `links` | ❌ Not supported | Use service names for communication | | `links` | ❌ Not supported | Use service names for communication |
| `logging` | ✅ Supported | Defaults to [local](https://docs.docker.com/engine/logging/drivers/local/) log driver | | `logging` | ✅ Supported | Defaults to [local](https://docs.docker.com/engine/logging/drivers/local/) log driver |
| `mem_limit` | ✅ Supported | Memory limit | | `mem_limit` | ✅ Supported | Memory limit |
| `mem_reservation` | ✅ Supported | Memory reservation | | `mem_reservation` | ✅ Supported | Memory reservation |
| `mem_swappiness` | ❌ Not supported | | | `mem_swappiness` | ❌ Not supported | |
| `memswap_limit` | ❌ Not supported | | | `memswap_limit` | ❌ Not supported | |
| `networks` | ❌ Not supported | All containers share cluster network | | `networks` | ❌ Not supported | All containers share cluster network |
| `pid` | ✅ Supported | Set the PID namespace mode, `pid: host` only | | `pid` | ✅ Supported | Set the PID namespace mode, `pid: host` only |
| `ports` | ⚠️ Limited | `mode: host` only, use [`x-ports`](2-extensions.md#x-ports) for HTTP/HTTPS | | `ports` | ⚠️ Limited | `mode: host` only, use [`x-ports`](2-extensions.md#x-ports) for HTTP/HTTPS |
| `privileged` | ✅ Supported | Run containers in privileged mode | | `privileged` | ✅ Supported | Run containers in privileged mode |
| `pull_policy` | ✅ Supported | `always`, `missing`, `never` | | `pull_policy` | ✅ Supported | `always`, `missing`, `never` |
| `secrets` | ❌ Not supported | Use configs or environment variables | | `secrets` | ❌ Not supported | Use configs or environment variables |
| `security_opt` | ❌ Not supported | | | `security_opt` | ❌ Not supported | |
| `shm_size` | ✅ Supported | Shared memory size | | `shm_size` | ✅ Supported | Shared memory size |
| `stop_grace_period` | ✅ Supported | Time to wait after SIGTERM before SIGKILL | | `stop_grace_period` | ✅ Supported | Time to wait after SIGTERM before SIGKILL |
| `storage_opt` | ❌ Not supported | | | `storage_opt` | ❌ Not supported | |
| `sysctls` | ✅ Supported | Namespaced kernel parameters | | `sysctls` | ✅ Supported | Namespaced kernel parameters |
| `ulimits` | ✅ Supported | Resource limits | | `ulimits` | ✅ Supported | Resource limits |
| `user` | ✅ Supported | Set container user | | `user` | ✅ Supported | Set container user |
| `volumes` | ✅ Supported | Named volumes, bind mounts, tmpfs | | `volumes` | ✅ Supported | Named volumes, bind mounts, tmpfs |
| **Deploy** | | | | **Deploy** | | |
| `labels` | ❌ Not supported | | | `labels` | ❌ Not supported | |
| `mode` | ✅ Supported | Either `global` or `replicated` | | `mode` | ✅ Supported | Either `global` or `replicated` |
| `placement` | ❌ Not supported | Use [`x-machines`](2-extensions.md#x-machines) extension | | `placement` | ❌ Not supported | Use [`x-machines`](2-extensions.md#x-machines) extension |
| `replicas` | ✅ Supported | Number of container replicas | | `replicas` | ✅ Supported | Number of container replicas |
| `resources` | ⚠️ Limited | CPU, memory limits and device reservations | | `resources` | ⚠️ Limited | CPU, memory limits and device reservations |
| `restart_policy` | ❌ Not supported | Defaults to `unless-stopped` | | `restart_policy` | ❌ Not supported | Defaults to `unless-stopped` |
| `rollback_config` | ❌ Not supported | See [#151](https://github.com/psviderski/uncloud/issues/151) | | `rollback_config` | ❌ Not supported | See [#151](https://github.com/psviderski/uncloud/issues/151) |
| `update_config` | ⚠️ Limited | `order` and `monitor` supported. See [rolling deployments](../4-guides/1-deployments/4-rolling-deployments.md) | | `update_config` | ⚠️ Limited | `order` and `monitor` supported. See [rolling deployments](../4-guides/1-deployments/4-rolling-deployments.md) |
| **Volumes** | | | | **Volumes** | | |
| Named volumes | ✅ Supported | Docker volumes | | Named volumes | ✅ Supported | Docker volumes |
| Bind mounts | ✅ Supported | Host path binding | | Bind mounts | ✅ Supported | Host path binding |
| Tmpfs mounts | ✅ Supported | In-memory filesystems | | Tmpfs mounts | ✅ Supported | In-memory filesystems |
| Volume labels | ✅ Supported | Custom labels | | Volume labels | ✅ Supported | Custom labels |
| External volumes | ✅ Supported | Must exist before deployment | | External volumes | ✅ Supported | Must exist before deployment |
| [Volume drivers][volume-drivers] | ✅ Supported | `local` (supports [NFS][volume-nfs], [CIFS/Samba][volume-cifs]) and manually installed third-party drivers | | [Volume drivers][volume-drivers] | ✅ Supported | `local` (supports [NFS][volume-nfs], [CIFS/Samba][volume-cifs]) and manually installed third-party drivers |
| **Configs** | | | | **Configs** | | |
| File-based configs | ✅ Supported | Read from file | | File-based configs | ✅ Supported | Read from file |
| Inline configs | ✅ Supported | Defined in compose file | | Inline configs | ✅ Supported | Defined in compose file |
| External configs | ❌ Not supported | Not supported | | External configs | ❌ Not supported | Not supported |
| Short syntax | ❌ Not supported | Use long syntax only | | Short syntax | ❌ Not supported | Use long syntax only |
| **Extensions** | | | | **Extensions** | | |
| `x-context` | ✅ Uncloud-specific | Cluster context override | | `x-context` | ✅ Uncloud-specific | Cluster context override |
| `x-caddy` | ✅ Uncloud-specific | Custom Caddy configuration | | `x-caddy` | ✅ Uncloud-specific | Custom Caddy configuration |
| `x-machines` | ✅ Uncloud-specific | Machine placement constraints | | `x-machines` | ✅ Uncloud-specific | Machine placement constraints |
| `x-ports` | ✅ Uncloud-specific | Service port publishing | | `x-ports` | ✅ Uncloud-specific | Service port publishing |
| `x-pre_deploy` | ✅ Uncloud-specific | Pre-deploy hook command | | `x-pre_deploy` | ✅ Uncloud-specific | Pre-deploy hook command |
[volume-drivers]: https://docs.docker.com/engine/storage/volumes/#use-a-volume-driver [volume-drivers]: https://docs.docker.com/engine/storage/volumes/#use-a-volume-driver