mirror of
https://github.com/psviderski/uncloud.git
synced 2026-08-26 11:03:34 +00:00
chore(pre-deploy): warn about depends_on: service_completed_successfully to use pre-deploy hook instead
This commit is contained in:
@@ -239,6 +239,25 @@ networks:
|
||||
warnCount: 1,
|
||||
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",
|
||||
composeYAML: `services:
|
||||
|
||||
@@ -495,6 +495,21 @@ func validateServicesFeatures(project *types.Project) []error {
|
||||
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
|
||||
|
||||
@@ -11,7 +11,7 @@ If you rely on a specific Compose feature that is not supported by Uncloud, plea
|
||||
:::
|
||||
|
||||
| Feature | Support Status | Notes |
|
||||
|----------------------------------|--------------------|----------------------------------------------------------------------------------------------------------------|
|
||||
|----------------------------------|--------------------|--------------------------------------------------------------------------------------------------------------------------------------------|
|
||||
| **Services** | | |
|
||||
| `build` | ✅ Supported | Build context and Dockerfile |
|
||||
| `cap_add` | ✅ Supported | Additional kernel [capabilities](https://man7.org/linux/man-pages/man7/capabilities.7.html) |
|
||||
@@ -19,7 +19,7 @@ If you rely on a specific Compose feature that is not supported by Uncloud, plea
|
||||
| `command` | ✅ Supported | Override container command |
|
||||
| `configs` | ✅ Supported | File-based and inline configs |
|
||||
| `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 |
|
||||
| `dns` | ❌ Not supported | Built-in service discovery |
|
||||
| `dns_search` | ❌ Not supported | Built-in service discovery |
|
||||
|
||||
Reference in New Issue
Block a user