Files
nomulus/release/clouddeploy/delivery-pipeline.yaml
T

326 lines
12 KiB
YAML

apiVersion: deploy.cloud.google.com/v1
kind: DeliveryPipeline
metadata:
name: deploy-nomulus
description: deploy-nomulus is a Cloud native replacement for Spinnaker that enables
gradual rollouts and SLA-based canary analysis for Nomulus.
serialPipeline:
stages:
- targetId: crash
strategy:
canary:
customCanaryDeployment:
phaseConfigs:
- phaseId: "canary-1"
profiles: ["crash-partial-phase-1"]
percentage: 10
analysis:
# 10 minutes.
duration: 600s
googleCloud:
alertPolicyChecks:
crashPartialDeploymentAlertPolicyChecks
- phaseId: "canary-5"
profiles: ["crash-partial-phase-5"]
percentage: 50
analysis:
# 10 minutes.
duration: 600s
googleCloud:
alertPolicyChecks:
crashPartialDeploymentAlertPolicyChecks
- phaseId: "stable"
profiles: ["crash"]
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 container images add-tag $DEPLOYED_IMAGE \
${BASE_IMAGE}:live-cd-${TARGET_ID} --quiet
- type: container
image: gcr.io/google.com/cloudsdktool/google-cloud-cli:stable
env:
TARGET_ID: ${{ target.id }}
TAG_NAME: ${{ deploy_params['tag_name'] }}
PROJECT_ID: ${{ deploy_params['project_id'] }}
command: ["/bin/bash"]
args:
- "-c"
- |
gcloud storage cp gs://${PROJECT_ID}-deploy/${TAG_NAME}/cloudbuild-schema-deploy-${TARGET_ID}.yaml .
gcloud builds submit --no-source --config=cloudbuild-schema-deploy-${TARGET_ID}.yaml
- type: container
image: gcr.io/google.com/cloudsdktool/google-cloud-cli:stable
env:
TARGET_ID: ${{ target.id }}
TAG_NAME: ${{ deploy_params['tag_name'] }}
PROJECT_ID: ${{ deploy_params['project_id'] }}
command: ["/bin/bash"]
args:
- "-c"
- |
gcloud storage cp gs://${PROJECT_ID}-deploy/${TAG_NAME}/cloudbuild-deploy-gke-${TARGET_ID}.yaml .
gcloud builds submit --no-source --config=cloudbuild-deploy-gke-${TARGET_ID}.yaml
analysis:
# 10 minutes.
duration: 600s
googleCloud:
alertPolicyChecks:
crashStableDeploymentAlertPolicyChecks
- targetId: sandbox
strategy:
canary:
customCanaryDeployment:
phaseConfigs:
- phaseId: "canary-1"
profiles: ["sandbox-partial-phase-1"]
percentage: 10
predeploy:
tasks:
- type: container
image: gcr.io/google.com/cloudsdktool/google-cloud-cli:stable
env:
TARGET_ID: ${{ target.id }}
TAG_NAME: ${{ deploy_params['tag_name'] }}
PROJECT_ID: ${{ deploy_params['project_id'] }}
command: ["/bin/bash"]
args:
- "-c"
- |
gcloud storage cp gs://${PROJECT_ID}-deploy/${TAG_NAME}/cloudbuild-schema-verify-${TARGET_ID}.yaml .
gcloud builds submit --no-source --config=cloudbuild-schema-verify-${TARGET_ID}.yaml
analysis:
# 30 minutes.
duration: 1800s
googleCloud:
alertPolicyChecks:
sandboxPartialDeploymentAlertPolicyChecks
- phaseId: "canary-5"
profiles: ["sandbox-partial-phase-5"]
percentage: 50
analysis:
# 30 minutes.
duration: 1800s
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 container images add-tag $DEPLOYED_IMAGE \
${BASE_IMAGE}:live-cd-${TARGET_ID} --quiet
- type: container
image: gcr.io/google.com/cloudsdktool/google-cloud-cli:stable
env:
TARGET_ID: ${{ target.id }}
TAG_NAME: ${{ deploy_params['tag_name'] }}
PROJECT_ID: ${{ deploy_params['project_id'] }}
command: ["/bin/bash"]
args:
- "-c"
- |
gcloud storage cp gs://${PROJECT_ID}-deploy/${TAG_NAME}/cloudbuild-schema-deploy-${TARGET_ID}.yaml .
gcloud builds submit --no-source --config=cloudbuild-schema-deploy-${TARGET_ID}.yaml
- type: container
image: gcr.io/google.com/cloudsdktool/google-cloud-cli:stable
env:
TARGET_ID: ${{ target.id }}
TAG_NAME: ${{ deploy_params['tag_name'] }}
PROJECT_ID: ${{ deploy_params['project_id'] }}
command: ["/bin/bash"]
args:
- "-c"
- |
gcloud storage cp gs://${PROJECT_ID}-deploy/${TAG_NAME}/cloudbuild-deploy-gke-${TARGET_ID}.yaml .
gcloud builds submit --no-source --config=cloudbuild-deploy-gke-${TARGET_ID}.yaml
analysis:
# 30 minutes.
duration: 1800s
googleCloud:
alertPolicyChecks:
sandboxStableDeploymentAlertPolicyChecks
- targetId: production
strategy:
canary:
customCanaryDeployment:
phaseConfigs:
- phaseId: "canary-1"
profiles: ["production-partial-phase-1"]
percentage: 10
predeploy:
tasks:
- type: container
image: gcr.io/google.com/cloudsdktool/google-cloud-cli:stable
env:
TARGET_ID: ${{ target.id }}
TAG_NAME: ${{ deploy_params['tag_name'] }}
PROJECT_ID: ${{ deploy_params['project_id'] }}
command: ["/bin/bash"]
args:
- "-c"
- |
gcloud storage cp gs://${PROJECT_ID}-deploy/${TAG_NAME}/cloudbuild-schema-verify-${TARGET_ID}.yaml .
gcloud builds submit --no-source --config=cloudbuild-schema-verify-${TARGET_ID}.yaml
analysis:
# 1 hour.
duration: 3600s
googleCloud:
alertPolicyChecks:
productionPartialDeploymentAlertPolicyChecks
- phaseId: "canary-5"
profiles: ["production-partial-phase-5"]
percentage: 50
analysis:
# 1 hour.
duration: 3600s
googleCloud:
alertPolicyChecks:
productionPartialDeploymentAlertPolicyChecks
- phaseId: "stable"
profiles: ["production"]
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 container images add-tag $DEPLOYED_IMAGE \
${BASE_IMAGE}:live-cd-${TARGET_ID} --quiet
- type: container
image: gcr.io/google.com/cloudsdktool/google-cloud-cli:stable
env:
TAG_NAME: ${{ deploy_params['tag_name'] }}
PROJECT_ID: ${{ deploy_params['project_id'] }}
command: ["/bin/bash"]
args:
- "-c"
- |
gcloud storage cp gs://${PROJECT_ID}-deploy/${TAG_NAME}/cloudbuild-sync-and-tag.yaml .
gcloud builds submit --no-source --config=cloudbuild-sync-and-tag.yaml
- type: container
image: gcr.io/google.com/cloudsdktool/google-cloud-cli:stable
env:
TARGET_ID: ${{ target.id }}
TAG_NAME: ${{ deploy_params['tag_name'] }}
PROJECT_ID: ${{ deploy_params['project_id'] }}
command: ["/bin/bash"]
args:
- "-c"
- |
gcloud storage cp gs://${PROJECT_ID}-deploy/${TAG_NAME}/cloudbuild-schema-deploy-${TARGET_ID}.yaml .
gcloud builds submit --no-source --config=cloudbuild-schema-deploy-${TARGET_ID}.yaml
- type: container
image: gcr.io/google.com/cloudsdktool/google-cloud-cli:stable
env:
TARGET_ID: ${{ target.id }}
TAG_NAME: ${{ deploy_params['tag_name'] }}
PROJECT_ID: ${{ deploy_params['project_id'] }}
command: ["/bin/bash"]
args:
- "-c"
- |
gcloud storage cp gs://${PROJECT_ID}-deploy/${TAG_NAME}/cloudbuild-deploy-gke-${TARGET_ID}.yaml .
gcloud builds submit --no-source --config=cloudbuild-deploy-gke-${TARGET_ID}.yaml
analysis:
# 1 hour.
duration: 3600s
googleCloud:
alertPolicyChecks:
productionStableDeploymentAlertPolicyChecks
---
apiVersion: deploy.cloud.google.com/v1
kind: Automation
metadata:
name: deploy-nomulus/auto-advance-canary
description: Automatically advances rollouts through canary-1 and canary-5 phases in non-prod.
# Placeholder: Replace with project service account.
serviceAccount: serviceAccount
selector:
targets:
- id: crash
- id: sandbox
rules:
- advanceRolloutRule:
id: advance-canary-phases
sourcePhases:
- "canary-1"
- "canary-5"
wait: 0m
---
apiVersion: deploy.cloud.google.com/v1
kind: Automation
metadata:
name: deploy-nomulus/auto-advance-canary-production
description: Automatically advances rollouts from canary-1 to canary-5 phase in production.
# Placeholder: Replace with project service account.
serviceAccount: serviceAccount
selector:
targets:
- id: production
rules:
- advanceRolloutRule:
id: advance-canary-phases
sourcePhases:
- "canary-1"
wait: 0m
---
apiVersion: deploy.cloud.google.com/v1
kind: Automation
metadata:
name: deploy-nomulus/auto-promote-crash-to-sandbox
description: Automatically promotes release to sandbox after successful rollout in crash.
# Placeholder: Replace with project service account.
serviceAccount: serviceAccount
selector:
targets:
- id: crash
rules:
- promoteReleaseRule:
id: promote-crash-to-sandbox
destinationTargetId: "sandbox"
wait: 0m
---
apiVersion: deploy.cloud.google.com/v1
kind: Automation
metadata:
name: deploy-nomulus/auto-promote-sandbox-to-production
description: Automatically promotes release to production after successful rollout in sandbox.
# Placeholder: Replace with project service account.
serviceAccount: serviceAccount
selector:
targets:
- id: sandbox
rules:
- promoteReleaseRule:
id: promote-sandbox-to-production
destinationTargetId: "production"
wait: 0m