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: # 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 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: 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: # 10 minutes. duration: 600s googleCloud: alertPolicyChecks: productionPartialDeploymentAlertPolicyChecks - phaseId: "canary-5" profiles: ["production-partial-phase-5"] percentage: 50 analysis: # 10 minutes. duration: 600s 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: # 10 minutes. duration: 600s 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 phase after successful deployment and analysis. # Placeholder: Replace with project service account. serviceAccount: serviceAccount selector: targets: - id: crash - id: sandbox - id: production rules: - advanceRolloutRule: id: advance-canary-phases sourcePhases: - "canary-1" wait: 0m