Mantieni tutto organizzato con le raccolte
Salva e classifica i contenuti in base alle tue preferenze.
Questa pagina descrive come utilizzare le notifiche del servizio Cloud Deploy, incluso come iscriversi.
Cloud Deploy utilizza Pub/Sub per pubblicare notifiche per due scopi:
Per consentirti di integrare Cloud Deploy con strumenti di terze parti e altri strumenti Google, come gli strumenti per la gestione delle richieste di assistenza o l'infrastruttura di test.
Per estendere Cloud Deploy con logica di business supplementare.
Argomenti disponibili
Cloud Deploy pubblica i messaggi nel seguente insieme di argomenti Google Pub/Sub:
clouddeploy-resources
Quando viene eseguita un'operazione (creazione, aggiornamento, eliminazione) su qualsiasi risorsa di base di Cloud Deploy (automazione, tipo di target personalizzato, pipeline di distribuzione, esecuzione di job, release, implementazione, target).
clouddeploy-operations
Quando Cloud Deploy esegue il rendering della configurazione di Skaffold.
Quando Cloud Deploy esegue il deployment in un target (Start, Succeed,
Failure, Terminated (esecuzione del job), Cancelled (implementazione)).
clouddeploy-approvals
Quando Cloud Deploy ha bisogno dell'approvazione (o del rifiuto) di un'implementazione.
Quando un'implementazione è stata approvata o rifiutata.
clouddeploy-advances
Quando un'implementazione di Cloud Deploy è passata da una fase alla successiva.
Quando un'implementazione è pronta per essere avanzata.
Per scoprire come configurare le sottoscrizioni Pub/Sub per le notifiche del servizio Cloud Deploy, leggi la guida per gli abbonati a Pub/Sub.
Puoi anche scoprire di più sulle librerie client Pub/Sub, che semplificano lo sviluppo di applicazioni di abbonamento.
Valori dei campi
Questa sezione elenca i possibili valori per i campi dei messaggi Pub/Sub di Cloud Deploy.
Per Action
In queste notifiche, i valori possibili per Action sono i seguenti.
Per le risorse
Create
Update
Delete
Per le operazioni:
Start
Succeed
Failure
Terminated
Cancelled
Per le approvazioni:
Required
Approved
Rejected
Per gli anticipi:
Required
Advanced
Per ResourceType
I valori possibili per ResourceType sono:
DeliveryPipeline
Target
Release
Rollout
JobRun
Messaggi di esempio
Gli esempi riportati di seguito mostrano diversi tipi di messaggi Pub/Sub degli argomenti Cloud Deploy.
Creazione della pipeline di distribuzione
Di seguito è riportato un esempio di messaggio Pub/Sub pubblicato in clouddeploy-resources in risposta alla creazione di un nuovo deliveryPipeline:
Di seguito è riportato un esempio di messaggio Pub/Sub pubblicato in clouddeploy-operations per notificare che è stata eseguita il rendering di una release:
Di seguito è riportato un esempio di messaggio Pub/Sub pubblicato in clouddeploy-approvals per notificare che l'implementazione richiede l'approvazione:
Di seguito è riportato un esempio di messaggio Pub/Sub pubblicato in clouddeploy-advances per notificare che un'implementazione è passata da una fase all'altra:
[[["Facile da capire","easyToUnderstand","thumb-up"],["Il problema è stato risolto","solvedMyProblem","thumb-up"],["Altra","otherUp","thumb-up"]],[["Difficile da capire","hardToUnderstand","thumb-down"],["Informazioni o codice di esempio errati","incorrectInformationOrSampleCode","thumb-down"],["Mancano le informazioni o gli esempi di cui ho bisogno","missingTheInformationSamplesINeed","thumb-down"],["Problema di traduzione","translationIssue","thumb-down"],["Altra","otherDown","thumb-down"]],["Ultimo aggiornamento 2025-09-03 UTC."],[[["\u003cp\u003eCloud Deploy uses Pub/Sub to send notifications, allowing integration with third-party and Google tools, and to extend Cloud Deploy with custom logic.\u003c/p\u003e\n"],["\u003cp\u003eThere are four main Pub/Sub topics for Cloud Deploy: \u003ccode\u003eclouddeploy-resources\u003c/code\u003e, \u003ccode\u003eclouddeploy-operations\u003c/code\u003e, \u003ccode\u003eclouddeploy-approvals\u003c/code\u003e, and \u003ccode\u003eclouddeploy-advances\u003c/code\u003e, each covering different types of events.\u003c/p\u003e\n"],["\u003cp\u003eYou can receive Cloud Deploy notifications by enabling both the Cloud Deploy API and Pub/Sub API, and then creating the relevant Pub/Sub topics.\u003c/p\u003e\n"],["\u003cp\u003ePub/Sub messages from Cloud Deploy include fields like \u003ccode\u003eAction\u003c/code\u003e (e.g., Create, Start, Required, Advanced) and \u003ccode\u003eResourceType\u003c/code\u003e (e.g., DeliveryPipeline, Release, Rollout) to describe the event.\u003c/p\u003e\n"],["\u003cp\u003eYou can subscribe to Cloud Deploy notifications using either a push or pull model for your Pub/Sub subscriptions, and you can explore client libraries for easier subscriber application development.\u003c/p\u003e\n"]]],[],null,["# Using Cloud Deploy notifications\n\nThis page describes how to use Cloud Deploy service notifications,\nincluding how to subscribe to them.\n\nCloud Deploy uses Pub/Sub to publish notifications for\ntwo purposes:\n\n- To let you integrate Cloud Deploy with third-party tools and other\n Google tools, such as tools for workflow ticketing or test infrastructure.\n\n- To extend Cloud Deploy with supplemental business logic.\n\nAvailable topics\n----------------\n\nCloud Deploy publishes messages to the following set of\n[Google Pub/Sub](/pubsub) topics:\n\n- `clouddeploy-resources`\n\n When there is an operation (create, update, delete) against any\n Cloud Deploy core resource (automation, custom target type,\n delivery pipeline, job run, release, rollout, target).\n- `clouddeploy-operations`\n\n - When Cloud Deploy renders the Skaffold configuration.\n - When Cloud Deploy deploys to a target (`Start`, `Succeed`, `Failure`, `Terminated` (job run), `Cancelled` (rollout)).\n- `clouddeploy-approvals`\n\n - When Cloud Deploy needs an approval (or rejection) of a rollout.\n - When a rollout has been approved or rejected.\n- `clouddeploy-advances`\n\n - When a Cloud Deploy rollout has been advanced from one phase to the next.\n - When a rollout is ready to be advanced.\n\nYou can use a [push or pull model](/pubsub/docs/subscriber#push_pull) for your\nPub/Sub subscriptions.\n\nReceive Cloud Deploy service notifications\n------------------------------------------\n\nTo receive Cloud Deploy service notifications:\n\n1. Enable the Cloud Deploy API for your project:\n\n [Enable the Cloud Deploy API](https://console.cloud.google.com/apis/library/clouddeploy.googleapis.com)\n2. Enable the Pub/Sub API:\n\n [Enable the Pub/Sub API](https://console.cloud.google.com/apis/library/pubsub.googleapis.com)\n3. Create the Pub/Sub topic or topics, based on which notification\n types you want to receive:\n\n gcloud pubsub topics create clouddeploy-resources\n gcloud pubsub topics create clouddeploy-operations\n gcloud pubsub topics create clouddeploy-approvals\n gcloud pubsub topics create clouddeploy-advances\n\n To learn more about managing Pub/Sub topics, see [Managing topics and subscriptions](/../pubsub/docs/admin).\n\n| **Note:** Pub/Sub notifications generated by Cloud Deploy are subject to the [Pub/Sub Service Level Agreement (SLA)](/../pubsub/sla).\n\nSubscribe to Cloud Deploy service notifications\n-----------------------------------------------\n\nYou have several of options for subscribing to notifications.\nFor example, you can\n[push messages to an endpoint](/pubsub/docs/push#configuring-http-endpoints),\nor\n[write a Python app for polling your subscription](/pubsub/docs/pull#pubsub-pull-python).\n\nTo learn how to set up Pub/Sub subscriptions for Cloud Deploy\nservice notifications, read the [Pub/Sub Subscriber Guide](/pubsub/docs/subscriber).\nYou can also learn about [Pub/Sub Client Libraries](/pubsub/docs/reference/libraries),\nwhich make developing subscriber applications easier.\n\nField values\n------------\n\nThis section lists possible values for fields in the Cloud Deploy\nPub/Sub messages.\n\n### For `Action`\n\nIn these notifications, the possible values for `Action` are as follows.\n\n- For resources\n\n - `Create`\n - `Update`\n - `Delete`\n- For operations:\n\n - `Start`\n - `Succeed`\n - `Failure`\n - `Terminated`\n - `Cancelled`\n- For approvals:\n\n - `Required`\n - `Approved`\n - `Rejected`\n- For advances:\n\n - `Required`\n - `Advanced`\n\n### For `ResourceType`\n\nAnd the possible values for `ResourceType` are as follows:\n\n- `DeliveryPipeline`\n- `Target`\n- `Release`\n- `Rollout`\n- `JobRun`\n\nSample messages\n---------------\n\nThe following examples show several types of Pub/Sub messages from\nCloud Deploy topics.\n\n### Delivery pipeline create\n\nThe following is an example of a Pub/Sub message published to\n`clouddeploy-resources` in response to creation of a new `deliveryPipeline`: \n\n {\n \"ackId\": \"RFAGFixdRkhRNxkIaFEOT14jPzUgKEUQBQgUBXx9cEFMdVhddmhRDRlyfWByY11AAgVMVnldURsHaE5tdR_Wg6LHS0NVaF4TBgpGVX5fXx0IYVtedi_m7r_2wPXOXkAvOYXL6Mtpe735h9xvZiM9XxJLLD5-IzRFQV5AEkwoAURJUytDCypYEU4EISE-MD5FUw\",\n \"message\": {\n \"attributes\": {\n \"Action\": \"Create\",\n \"Resource\": \"projects/120123456789/locations/us-central1/deliveryPipelines/etest\",\n \"ResourceType\": \"DeliveryPipeline\",\n \"Location\": \"us-central1\",\n \"DeliveryPipelineId\": \"etest\",\n \"ProjectNumber\": \"120123456789\",\n\n },\n \"messageId\": \"2407836004659723\",\n \"publishTime\": \"2021-05-17T21:24:48.204Z\"\n }\n }\n\n### Render start\n\nThe following is an example of a Pub/Sub message published to\n`clouddeploy-operations` to notify that a release has been rendered: \n\n {\n \"ackId\": \"U0RQBhYsXUZIUTcZCGhRDk9eIz81IChFFwYIFAV8fXBBTHVeXHRoUQ0Zcn1gcmNfR1MLFlN5WFEaB2hObXUfioKix0tDVWheEwYKRVZ3W1kdBGFVXH0v_qD5rMP1zl5AKDnZyujLaXudkqxfZiM9XxJLLD5-PTNFQV5AEkw2BkRJUytDCypYEU4EISE-MD5F\",\n \"message\": {\n \"attributes\": {\n \"Action\": \"Start\",\n \"Resource\": \"projects/120123456789/locations/us-central1/deliveryPipelines/etest/releases/f2\",\n \"ResourceType\": \"Release\"\n \"Location\": \"us-central1\",\n \"DeliveryPipelineId\": \"etest\",\n \"ProjectNumber\": \"120123456789\",\n \"ReleaseId\": \"f2\",\n },\n \"messageId\": \"2407805942699908\",\n \"publishTime\": \"2021-05-17T21:28:04.201Z\"\n }\n }\n\n### Approval required\n\nThe following is an example of a Pub/Sub message published to\n`clouddeploy-approvals` to notify that a rollout requires approval: \n\n {\n \"ackId\": \"RVNEUAYWLF1GSFE3GQhoUQ5PXiM_NSAoRRILUxNRXHQBWhBpWF8aB1ENGXJ8ZnxtCRBVU0FWf1VbEQ16bVxti6C2rERfQXduWhQJBkBXd11aHQhoXF9dotnkpeTv2kFwYSuN8_7mSH_Mo6AYZiA9XBJLLD5-IzZFQV5AEkwoA0RJUytDCypYEU4EISE-MD4\",\n \"message\": {\n \"attributes\": {\n \"Action\": \"Required\",\n \"Rollout\": \"projects/120123456789/locations/us-central1/deliveryPipelines/etest/releases/f2/rollouts/rollout-123\"\n \"ReleaseId\": \"f2\",\n \"RolloutId\": \"rollout-123\",\n \"TargetId\": \"prod\",\n \"Location\": \"us-central1\",\n \"ProjectNumber\": \"120123456789\",\n },\n \"messageId\": \"2407845492165003\",\n \"publishTime\": \"2021-05-17T21:31:25.143Z\"\n }\n }\n\n### Rollout advance\n\nThe following is an example of a Pub/Sub message published to\n`clouddeploy-advances` to notify that a rollout has been advanced from one phase\nto the next: \n\n {\n \"ackId\": \"RFAGFixdRkhRNxkIaFEOT14jPzUgKEUSAwVPAihdeTFXKkFZdWhRDRlyfWB9bV4UUFZMV38OURoHaE5tdR_z4ILjS0NVbVkQBApEUHldXhkEa1RcfC-a0fmv1OzMV0AvOaCoyO9pe77r3NluZiM9XhJLLD5-Jz1FQV5AEkwsCERJUytDCypYEU4EISE-MD5FUw\",\n \"message\": {\n \"attributes\": {\n \"Action\": \"Advanced\",\n \"Location\": \"us-central1\",\n \"PhaseId\": \"stable\",\n \"ProjectNumber\": \"120123456789\",\n \"ReleaseId\": \"rollout-123\",\n \"Rollout\": \"projects/120123456789/locations/us-central1/deliveryPipelines/etest/releases/f2/rollouts/rollout-123\",\n \"RolloutId\": \"rollout-123\",\n \"TargetId\": \"prod\"\n },\n \"messageId\": \"7335813725293809\",\n \"publishTime\": \"2023-04-03T15:16:30.425Z\"\n }\n }\n\nIn this message, `PhaseId` identifies the phase that the rollout has been\nadvanced to.\n\nWhat's next\n-----------\n\n- [Learn more about Pub/Sub](/pubsub/docs)."]]