plan static method
DVReleasePlan
plan(
- DVDeployConfig config,
- DVReleaseAdapter adapter, {
- DVReleaseDiagnosticSink? onDiagnostic,
Implementation
static DVReleasePlan plan(
DVDeployConfig config,
DVReleaseAdapter adapter, {
DVReleaseDiagnosticSink? onDiagnostic,
}) {
final DVReleaseDiagnosticSink diagnose =
onDiagnostic ?? dvLogReleaseDiagnostic;
config.canary.validate();
final List<DVReleaseFinding> findings = <DVReleaseFinding>[];
DVDeployStrategy strategy = config.strategy;
if (strategy == DVDeployStrategy.canary && !adapter.canWeightTraffic) {
strategy = DVDeployStrategy.blueGreen;
final DVReleaseFinding finding = DVReleaseFinding(
'DV-RELEASE-002',
'${adapter.name} cannot weight traffic, so the canary runs as '
'blue-green: the new release takes all traffic at once, is held '
'for ${DVReleasePlan._describe(config.canary.hold)} under the '
'health gate, and is switched back if the gate trips',
);
findings.add(finding);
diagnose(finding.code, finding.message);
}
return DVReleasePlan._(
adapter: adapter.name,
requested: config.strategy,
strategy: strategy,
steps: strategy == DVDeployStrategy.canary
? List<int>.unmodifiable(config.canary.steps)
: const <int>[100],
hold: config.canary.hold,
gate: config.gate,
findings: List<DVReleaseFinding>.unmodifiable(findings),
);
}