Skip to content

Commit bd70cd9

Browse files
authored
Add canary strategy to crash stage in Cloud Deploy pipeline (#3057)
* Add customCanaryDeployment strategy to crash * change key to partialDeploymentAlertPolicyChecks * add more indentation to alert policies config
1 parent 73725e9 commit bd70cd9

3 files changed

Lines changed: 66 additions & 10 deletions

File tree

release/cloudbuild-clouddeploy.yaml

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,14 +47,31 @@ steps:
4747
/^stableDeploymentAlertPolicyChecks:/ { capture = 1; next }
4848
capture {
4949
if ($0 ~ /^[^[:space:]]/ && $0 != "") { capture = 0; exit }
50-
print " " $0
50+
print " " $0
5151
}
5252
' "$config_file" > checks.tmp
5353
5454
# Insert the checks where the placeholder is located and remove the placeholder
5555
sed -i '/stableDeploymentAlertPolicyChecks/r checks.tmp' release/clouddeploy/delivery-pipeline.yaml
5656
sed -i '/stableDeploymentAlertPolicyChecks/d' release/clouddeploy/delivery-pipeline.yaml
5757
rm -f checks.tmp
58+
59+
# Extract only the indented block under partialDeploymentAlertPolicyChecks.
60+
if grep -q "^partialDeploymentAlertPolicyChecks:" "$config_file"; then
61+
echo "Extracting partial checks from $config_file..."
62+
awk '
63+
/^partialDeploymentAlertPolicyChecks:/ { capture = 1; next }
64+
capture {
65+
if ($0 ~ /^[^[:space:]]/ && $0 != "") { capture = 0; exit }
66+
print " " $0
67+
}
68+
' "$config_file" > partial_checks.tmp
69+
70+
# Insert the checks where the placeholder is located and remove the placeholder
71+
sed -i '/partialDeploymentAlertPolicyChecks/r partial_checks.tmp' release/clouddeploy/delivery-pipeline.yaml
72+
sed -i '/partialDeploymentAlertPolicyChecks/d' release/clouddeploy/delivery-pipeline.yaml
73+
rm -f partial_checks.tmp
74+
fi
5875
5976
# Populate variables in target file
6077
target_file="release/clouddeploy/${env}-target.yaml"

release/clouddeploy/delivery-pipeline.yaml

Lines changed: 30 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,34 @@ description: deploy-nomulus is a Cloud native replacement for Spinnaker that ena
77
serialPipeline:
88
stages:
99
- targetId: crash
10-
profiles:
11-
- crash
1210
strategy:
13-
standard:
14-
analysis:
15-
# 10 minutes.
16-
duration: 600s
17-
googleCloud:
18-
alertPolicyChecks:
19-
stableDeploymentAlertPolicyChecks
11+
canary:
12+
customCanaryDeployment:
13+
phaseConfigs:
14+
- phaseId: "canary-1"
15+
profiles: ["crash-partial-phase-1"]
16+
percentage: 10
17+
analysis:
18+
# 10 minutes.
19+
duration: 600s
20+
googleCloud:
21+
alertPolicyChecks:
22+
partialDeploymentAlertPolicyChecks
23+
- phaseId: "canary-5"
24+
profiles: ["crash-partial-phase-5"]
25+
percentage: 50
26+
analysis:
27+
# 10 minutes.
28+
duration: 600s
29+
googleCloud:
30+
alertPolicyChecks:
31+
partialDeploymentAlertPolicyChecks
32+
- phaseId: "stable"
33+
profiles: ["crash"]
34+
percentage: 100
35+
analysis:
36+
# 10 minutes.
37+
duration: 600s
38+
googleCloud:
39+
alertPolicyChecks:
40+
stableDeploymentAlertPolicyChecks

release/clouddeploy/skaffold.yaml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,23 @@ profiles:
1111
- ../jetty/kubernetes/nomulus-crash-console.yaml
1212
- ../jetty/kubernetes/nomulus-crash-frontend.yaml
1313
- ../jetty/kubernetes/nomulus-crash-pubapi.yaml
14+
deploy:
15+
kubectl: { }
16+
- name: crash-partial-phase-1
17+
manifests:
18+
rawYaml:
19+
- ../jetty/kubernetes/nomulus-crash-backend-partial-phase-1.yaml
20+
- ../jetty/kubernetes/nomulus-crash-console-partial-phase-1.yaml
21+
- ../jetty/kubernetes/nomulus-crash-frontend-partial-phase-1.yaml
22+
- ../jetty/kubernetes/nomulus-crash-pubapi-partial-phase-1.yaml
23+
deploy:
24+
kubectl: { }
25+
- name: crash-partial-phase-5
26+
manifests:
27+
rawYaml:
28+
- ../jetty/kubernetes/nomulus-crash-backend-partial-phase-5.yaml
29+
- ../jetty/kubernetes/nomulus-crash-console-partial-phase-5.yaml
30+
- ../jetty/kubernetes/nomulus-crash-frontend-partial-phase-5.yaml
31+
- ../jetty/kubernetes/nomulus-crash-pubapi-partial-phase-5.yaml
1432
deploy:
1533
kubectl: { }

0 commit comments

Comments
 (0)