diff --git a/release/cloudbuild-clouddeploy.yaml b/release/cloudbuild-clouddeploy.yaml index 577a4c6c237..f099e0f5df6 100644 --- a/release/cloudbuild-clouddeploy.yaml +++ b/release/cloudbuild-clouddeploy.yaml @@ -38,7 +38,7 @@ steps: - -c - | set -e - for env in crash; do + for env in crash sandbox; do config_file="release/clouddeploy/${env}-config.yaml" if [ -f "$config_file" ]; then echo "Extracting checks from $config_file..." @@ -52,8 +52,8 @@ steps: ' "$config_file" > checks.tmp # Insert the checks where the placeholder is located and remove the placeholder - sed -i '/stableDeploymentAlertPolicyChecks/r checks.tmp' release/clouddeploy/delivery-pipeline.yaml - sed -i '/stableDeploymentAlertPolicyChecks/d' release/clouddeploy/delivery-pipeline.yaml + sed -i "/${env}StableDeploymentAlertPolicyChecks/r checks.tmp" release/clouddeploy/delivery-pipeline.yaml + sed -i "/${env}StableDeploymentAlertPolicyChecks/d" release/clouddeploy/delivery-pipeline.yaml rm -f checks.tmp # Extract only the indented block under partialDeploymentAlertPolicyChecks. @@ -68,8 +68,8 @@ steps: ' "$config_file" > partial_checks.tmp # Insert the checks where the placeholder is located and remove the placeholder - sed -i '/partialDeploymentAlertPolicyChecks/r partial_checks.tmp' release/clouddeploy/delivery-pipeline.yaml - sed -i '/partialDeploymentAlertPolicyChecks/d' release/clouddeploy/delivery-pipeline.yaml + sed -i "/${env}PartialDeploymentAlertPolicyChecks/r partial_checks.tmp" release/clouddeploy/delivery-pipeline.yaml + sed -i "/${env}PartialDeploymentAlertPolicyChecks/d" release/clouddeploy/delivery-pipeline.yaml rm -f partial_checks.tmp fi @@ -95,7 +95,7 @@ steps: - -c - | set -e - for env in crash; do + for env in crash sandbox; do target_file="release/clouddeploy/${env}-target.yaml" if [ -f "$target_file" ]; then echo "Applying target $target_file..." diff --git a/release/clouddeploy/delivery-pipeline.yaml b/release/clouddeploy/delivery-pipeline.yaml index 867b4463039..86fe3b3b538 100644 --- a/release/clouddeploy/delivery-pipeline.yaml +++ b/release/clouddeploy/delivery-pipeline.yaml @@ -19,7 +19,7 @@ serialPipeline: duration: 600s googleCloud: alertPolicyChecks: - partialDeploymentAlertPolicyChecks + crashPartialDeploymentAlertPolicyChecks - phaseId: "canary-5" profiles: ["crash-partial-phase-5"] percentage: 50 @@ -28,7 +28,7 @@ serialPipeline: duration: 600s googleCloud: alertPolicyChecks: - partialDeploymentAlertPolicyChecks + crashPartialDeploymentAlertPolicyChecks - phaseId: "stable" profiles: ["crash"] percentage: 100 @@ -51,4 +51,50 @@ serialPipeline: duration: 600s googleCloud: alertPolicyChecks: - stableDeploymentAlertPolicyChecks + crashStableDeploymentAlertPolicyChecks + - targetId: sandbox + strategy: + canary: + customCanaryDeployment: + phaseConfigs: + - phaseId: "canary-1" + profiles: ["sandbox-partial-phase-1"] + percentage: 10 + analysis: + # 10 minutes. + duration: 600s + googleCloud: + alertPolicyChecks: + sandboxPartialDeploymentAlertPolicyChecks + - phaseId: "canary-5" + profiles: ["sandbox-partial-phase-5"] + percentage: 50 + analysis: + # 10 minutes. + duration: 600s + googleCloud: + alertPolicyChecks: + sandboxPartialDeploymentAlertPolicyChecks + - phaseId: "stable" + profiles: ["sandbox"] + percentage: 100 + postdeploy: + tasks: + - type: container + image: gcr.io/google.com/cloudsdktool/google-cloud-cli:stable + env: + DEPLOYED_IMAGE: ${{ deploy_params['deployed_image'] }} + BASE_IMAGE: ${{ deploy_params['base_image'] }} + TARGET_ID: ${{ target.id }} + command: ["/bin/bash"] + args: + - "-c" + - | + gcloud artifacts docker tags add $DEPLOYED_IMAGE \ + ${BASE_IMAGE}:live-cd-${TARGET_ID} + analysis: + # 10 minutes. + duration: 600s + googleCloud: + alertPolicyChecks: + sandboxStableDeploymentAlertPolicyChecks diff --git a/release/clouddeploy/sandbox-target.yaml b/release/clouddeploy/sandbox-target.yaml new file mode 100644 index 00000000000..85867d947b9 --- /dev/null +++ b/release/clouddeploy/sandbox-target.yaml @@ -0,0 +1,20 @@ +apiVersion: deploy.cloud.google.com/v1 +kind: Target +metadata: + name: sandbox +requireApproval: true +executionConfigs: +- usages: + - RENDER + - DEPLOY + - ANALYSIS + - POSTDEPLOY + executionTimeout: 3600s + defaultPool: + # Placeholder: Replace with artifact bucket name. + artifactStorage: artifactStorage + # Placeholder: Replace with project number. + serviceAccount: serviceAccount +gke: + # Placeholder: Replace with project ID, location, and cluster name. + cluster: cluster diff --git a/release/clouddeploy/skaffold.yaml b/release/clouddeploy/skaffold.yaml index 9bdc1108679..f2b31eb5040 100644 --- a/release/clouddeploy/skaffold.yaml +++ b/release/clouddeploy/skaffold.yaml @@ -29,5 +29,32 @@ profiles: - ../jetty/kubernetes/nomulus-crash-console-partial-phase-5.yaml - ../jetty/kubernetes/nomulus-crash-frontend-partial-phase-5.yaml - ../jetty/kubernetes/nomulus-crash-pubapi-partial-phase-5.yaml + deploy: + kubectl: { } +- name: sandbox + manifests: + rawYaml: + - ../jetty/kubernetes/nomulus-sandbox-backend.yaml + - ../jetty/kubernetes/nomulus-sandbox-console.yaml + - ../jetty/kubernetes/nomulus-sandbox-frontend.yaml + - ../jetty/kubernetes/nomulus-sandbox-pubapi.yaml + deploy: + kubectl: { } +- name: sandbox-partial-phase-1 + manifests: + rawYaml: + - ../jetty/kubernetes/nomulus-sandbox-backend-partial-phase-1.yaml + - ../jetty/kubernetes/nomulus-sandbox-console-partial-phase-1.yaml + - ../jetty/kubernetes/nomulus-sandbox-frontend-partial-phase-1.yaml + - ../jetty/kubernetes/nomulus-sandbox-pubapi-partial-phase-1.yaml + deploy: + kubectl: { } +- name: sandbox-partial-phase-5 + manifests: + rawYaml: + - ../jetty/kubernetes/nomulus-sandbox-backend-partial-phase-5.yaml + - ../jetty/kubernetes/nomulus-sandbox-console-partial-phase-5.yaml + - ../jetty/kubernetes/nomulus-sandbox-frontend-partial-phase-5.yaml + - ../jetty/kubernetes/nomulus-sandbox-pubapi-partial-phase-5.yaml deploy: kubectl: { } \ No newline at end of file