Restez organisé à l'aide des collections
Enregistrez et classez les contenus selon vos préférences.
Cette page explique comment utiliser les notifications du service Cloud Deploy, y compris comment vous y abonner.
Cloud Deploy utilise Pub/Sub pour publier des notifications à deux fins:
Pour vous permettre d'intégrer Cloud Deploy à des outils tiers et à d'autres outils Google, tels que des outils de gestion des demandes d'assistance ou d'infrastructure de test.
Pour étendre Cloud Deploy à l'aide d'une logique métier supplémentaire.
Thèmes disponibles
Cloud Deploy publie des messages dans l'ensemble de sujets Google Pub/Sub suivants:
clouddeploy-resources
En cas d'opération (création, mise à jour, suppression) sur une ressource de base Cloud Deploy (automatisation, type de cible personnalisée, pipeline de diffusion, exécution de tâche, version, déploiement, cible).
clouddeploy-operations
Lorsque Cloud Deploy génère la configuration Skaffold.
Lorsque Cloud Deploy déploie une application sur une cible (Start, Succeed, Failure, Terminated (exécution de la tâche), Cancelled (déploiement)).
clouddeploy-approvals
Lorsque Cloud Deploy a besoin d'une approbation (ou d'un refus) d'un déploiement.
Lorsque le déploiement a été approuvé ou refusé.
clouddeploy-advances
Lorsqu'un déploiement Cloud Deploy est passé d'une phase à l'autre.
Pour savoir comment configurer des abonnements Pub/Sub pour les notifications du service Cloud Deploy, consultez le Guide pour les abonnés Pub/Sub.
Vous pouvez également en savoir plus sur les bibliothèques clientes Pub/Sub, qui facilitent le développement d'applications pour les abonnés.
Valeurs des champs
Cette section liste les valeurs possibles pour les champs des messages Pub/Sub de Cloud Deploy.
Pour Action
Dans ces notifications, les valeurs possibles pour Action sont les suivantes.
Ressources
Create
Update
Delete
Pour les opérations:
Start
Succeed
Failure
Terminated
Cancelled
Pour les approbations:
Required
Approved
Rejected
Pour les avances:
Required
Advanced
Pour ResourceType
Les valeurs possibles pour ResourceType sont les suivantes:
DeliveryPipeline
Target
Release
Rollout
JobRun
Exemples de messages
Les exemples suivants présentent plusieurs types de messages Pub/Sub provenant de sujets Cloud Deploy.
Création du pipeline de livraison
Voici un exemple de message Pub/Sub publié sur clouddeploy-resources en réponse à la création d'un deliveryPipeline:
Sauf indication contraire, le contenu de cette page est régi par une licence Creative Commons Attribution 4.0, et les échantillons de code sont régis par une licence Apache 2.0. Pour en savoir plus, consultez les Règles du site Google Developers. Java est une marque déposée d'Oracle et/ou de ses sociétés affiliées.
Dernière mise à jour le 2025/09/03 (UTC).
[[["Facile à comprendre","easyToUnderstand","thumb-up"],["J'ai pu résoudre mon problème","solvedMyProblem","thumb-up"],["Autre","otherUp","thumb-up"]],[["Difficile à comprendre","hardToUnderstand","thumb-down"],["Informations ou exemple de code incorrects","incorrectInformationOrSampleCode","thumb-down"],["Il n'y a pas l'information/les exemples dont j'ai besoin","missingTheInformationSamplesINeed","thumb-down"],["Problème de traduction","translationIssue","thumb-down"],["Autre","otherDown","thumb-down"]],["Dernière mise à jour le 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)."]]