Mantieni tutto organizzato con le raccolte
Salva e classifica i contenuti in base alle tue preferenze.
Puoi integrare Cloud Deploy con alcuni degli altri sistemi su cui ti basi per la distribuzione del software. Questa pagina descrive come integrare Cloud Deploy con quanto segue:
Puoi utilizzare Cloud Deploy con Pub/Sub per integrare i test con la pipeline di distribuzione, in modo da promuovere automaticamente la release per la distribuzione continua.
Quando ricevi una notifica che ti informa che il deployment è andato a buon fine, esegui i test sull'applicazione di cui è stato eseguito il deployment.
Quando i test sono riusciti, chiama Cloud Deploy per eseguire automaticamente la promozione alla fase successiva:
è il nome della release. Questo valore è obbligatorio.
PIPELINE_NAME
è il nome della pipeline di distribuzione che gestisce questa release. Questo valore è obbligatorio.
REGION
è la regione in cui è in esecuzione la pipeline. Se hai impostato la proprietà
deploy/region, puoi omettere questo flag.
KEY=VALUE,...
è un elenco di una o più coppie di stringhe chiave-valore separate da virgole che possono contenere informazioni sui risultati dei test e su altri dati di test.
Ecco un esempio:
Le annotazioni sull'implementazione sono immutabili, pertanto se aggiungi un'annotazione dello stato, non potrai aggiornare in un secondo momento lo stato nella stessa implementazione.
Utilizzare le annotazioni per fornire l'accesso ai risultati dei test
Se hai l'URL che rimanda alla pagina in cui è possibile accedere ai risultati del test, puoi fornire questo URL come annotazione per un'implementazione utilizzando il flag --annotations.
Ecco un esempio:
Integrazione con la gestione dei flussi di lavoro di terze parti
Cloud Deploy pubblica messaggi operativi in Pub/Sub.
Lo strumento di gestione dei flussi di lavoro può iscriversi a questi argomenti Pub/Sub e utilizzarli per attivare flussi di lavoro specifici.
Per le approvazioni
L'argomento clouddeploy-approvals invia una notifica al sistema quando è necessaria un'approvazione per l'implementazione. Il sistema di flusso di lavoro esterno può quindi fare la sua magia per ottenere l'approvazione, quindi chiama gcloud deploy rollouts approve.
L'account che emette il comando rollouts approve deve avere il ruolo IAM predefinito roles/clouddeploy.approver.
Per configurare un flusso di lavoro di approvazione esterno:
Nella definizione del target, includi requireApproval: true.
Per utilizzare i messaggi, iscriviti all'argomento clouddeploy-approvals
Pub/Sub e configura il sistema di gestione del flusso di lavoro.
Quando il sistema di gestione dei flussi di lavoro riceve un messaggio dall'argomento clouddeploy-approvals che include "Action": "Required", avvia un flusso di lavoro di approvazione, configurato in base ai requisiti della tua organizzazione.
Il messaggio include anche un riferimento all'implementazione da approvare, nel seguente formato:
[[["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-10 UTC."],[[["\u003cp\u003eCloud Deploy can integrate with test tooling using Pub/Sub to automate release promotion upon successful deployment and testing.\u003c/p\u003e\n"],["\u003cp\u003eAnnotations on rollouts can be used to provide links to test results, offering a way to access testing information directly.\u003c/p\u003e\n"],["\u003cp\u003eCloud Deploy integrates with third-party workflow management systems through Pub/Sub, allowing for the automation of workflows, including approvals.\u003c/p\u003e\n"],["\u003cp\u003eBy subscribing to the \u003ccode\u003eclouddeploy-approvals\u003c/code\u003e topic, workflow management systems can trigger custom approval processes and manage the approval or rejection of rollouts.\u003c/p\u003e\n"],["\u003cp\u003eBefore performing any integrations, you must ensure that you have enabled the required APIs, defined at least one delivery pipeline and target, and have set up Pub/Sub notifications for \u003ccode\u003eclouddeploy-operations\u003c/code\u003e and \u003ccode\u003eclouddeploy-approvals\u003c/code\u003e topics.\u003c/p\u003e\n"]]],[],null,["# Integrating Cloud Deploy with other systems\n\nYou can integrate Cloud Deploy with some of the other systems you\nrely on for software delivery. This page describes how to integrate Cloud Deploy\nwith the following:\n\n- Test tooling\n- Workflow management\n\nSee [Integrating with your CI system](/deploy/docs/integrating-ci)\nto learn how to call Cloud Deploy from your CI pipeline.\n\nBefore you begin\n----------------\n\nThe instructions on this page assume you already meet the following conditions:\n\n- You have [enabled the applicable APIs](https://console.cloud.google.com/flows/enableapi?apiid=clouddeploy.googleapis.com,cloudbuild.googleapis.com,storage-component.googleapis.com,container.googleapis.com&redirect=https://cloud.google.com/deploy/docs/deploy-app-gke&_ga=2.88599711.504283000.1626992575-1788689322.1622287630)\n\n- You have at least one delivery pipeline [defined](/deploy/docs/config-file)\n and [registered](/deploy/docs/create-pipeline-targets#register_the_delivery_pipeline_and_targets)\n with Cloud Deploy.\n\n- You have at least one [target defined](/deploy/docs/config-files#target_definitions),\n and your delivery pipeline references that target.\n\n- You have [set up Pub/Sub notifications](/deploy/docs/subscribe-deploy-notifications)\n to receive notifications from the following topics:\n\n - `clouddeploy-operations`\n - `clouddeploy-approvals`\n\nIntegrating with automated testing\n----------------------------------\n\nYou can use Cloud Deploy with Pub/Sub to integrate testing\nwith your delivery pipeline, so you can promote the release automatically, for\ncontinuous delivery.\n\nYou can also use annotations on a rollout to provide a link to test results.\nFor more information, see [Using labels and annotations with Cloud Deploy](/deploy/docs/labels-annotations).\n\n### Using Pub/Sub to automate promotion\n\n1. Listen to [Pub/Sub messages](/deploy/docs/subscribe-deploy-notifications)\n from the `clouddeploy-operations` topic.\n\n The message contains the following attributes:\n - `Action: SUCCEED`\n - `ResourceType: Rollout`\n - `Resource: projects/.../locations/.../deliveryPipelines/.../releases/.../rollouts/...`\n2. When you receive a notification that deployment has succeeded, run your tests\n on your deployed application.\n\n3. When your tests succeed, call Cloud Deploy to automatically\n promote to the next stage:\n\n gcloud deploy releases promote \u003cvar label=\"release name\" translate=\"no\"\u003e\u003cspan class=\"devsite-syntax-n\"\u003eRELEASE_NAME\u003c/span\u003e\u003c/var\u003e \\\n --delivery-pipeline=\u003cvar label=\"pipeline name\" translate=\"no\"\u003e\u003cspan class=\"devsite-syntax-n\"\u003ePIPELINE_NAME\u003c/span\u003e\u003c/var\u003e \\\n --region=\u003cvar label=\"region\" translate=\"no\"\u003e\u003cspan class=\"devsite-syntax-n\"\u003eREGION\u003c/span\u003e\u003c/var\u003e \\\n --annotations=\u003cvar label=\"annotations\" translate=\"no\"\u003e\u003cspan class=\"devsite-syntax-n\"\u003eKEY\u003c/span\u003e\u003cspan class=\"devsite-syntax-o\"\u003e=\u003c/span\u003e\u003cspan class=\"devsite-syntax-n\"\u003eVALUE\u003c/span\u003e\u003cspan class=\"devsite-syntax-p\"\u003e,...\u003c/span\u003e\u003c/var\u003e\n\n where:\n - \u003cvar label=\"release name\" translate=\"no\"\u003eRELEASE_NAME\u003c/var\u003e\n\n is the name of the release. This value is required.\n - \u003cvar label=\"pipeline name\" translate=\"no\"\u003ePIPELINE_NAME\u003c/var\u003e\n\n is the name of the delivery pipeline managing this release. This value is\n required.\n - \u003cvar label=\"region\" translate=\"no\"\u003eREGION\u003c/var\u003e\n\n is the region in which the pipeline is running. If you've set the property\n `deploy/region`, you can omit this flag.\n - \u003cvar label=\"annotations\" translate=\"no\"\u003eKEY=VALUE,...\u003c/var\u003e\n\n is a list of one or more key-value string pairs, comma-separated, which can\n contain information about your test results and other testing information.\n Here's an example:\n\n `gcloud deploy releases promote --annotations=\"from_target=test,status=stable\"`\n\n Annotations on the rollout are immutable, so if you add a status\n annotation, you can't later update that status on the same rollout.\n\n### Using annotations to provide access to test results\n\nIf you have the URL pointing to where test results can be accessed, you can\nprovide that URL as an annotation on a rollout, using the `--annotations` flag.\nHere's an example: \n\n gcloud deploy releases promote --delivery-pipeline=my-demo-app-1 --region=us-central1 --project=my-demo-app-1-project --release=test-release-001 --annotations=\"test_results_url=https://example.com/results/my-demo-app-test-results-dev\"\n\nFor more information, see [Using labels and annotations with Cloud Deploy](/deploy/docs/labels-annotations).\n\nIntegrating with third-party workflow management\n------------------------------------------------\n\nCloud Deploy publishes operational messages to Pub/Sub.\nYour workflow management tool can subscribe to these Pub/Sub topics and use them\nto trigger specific workflows.\n\n### For approvals\n\nThe `clouddeploy-approvals` topic notifies your system when an approval is\nrequired for a rollout. Your external workflow system can then work its magic to\nget the approval, then call `gcloud deploy rollouts approve`.\n\nThe account that issues the `rollouts approve` command must have the predefined\nIAM role `roles/clouddeploy.approver`.\n\nTo set up an external approval workflow:\n\n1. [Require approval on the target](/deploy/docs/promote-release#manage_approvals_for_a_delivery_pipeline).\n\n In the definition for that target, include `requireApproval: true`.\n2. To consume the messages, subscribe to the `clouddeploy-approvals`\n Pub/Sub topic, and set up your workflow management system.\n\n3. When your workflow management system receives a message from the\n `clouddeploy-approvals` topic that includes `\"Action\": \"Required\"`, it kicks off\n an approval workflow, configured according to the requirements of your\n organization.\n\n The message also includes a reference to the rollout to be approved, in the\n following format:\n\n `Resource: projects/.../locations/.../deliveryPipelines/.../releases/.../rollouts/...`\n\n The output of the approval workflow is an [approval or rejection](/deploy/docs/promote-release#manage_approvals_for_a_delivery_pipeline)\n of the rollout.\n4. Your workflow management system returns the approval or rejection to\n Cloud Deploy in the form of the following command:\n\n The command for approval is as follows: \n\n gcloud deploy rollouts approve \u003cvar label=\"rollout\" translate=\"no\"\u003eROLLOUT\u003c/var\u003e \\\n --delivery-pipeline=\u003cvar label=\"pipeline name\" translate=\"no\"\u003ePIPELINE_NAME\u003c/var\u003e \\\n --region=\u003cvar label=\"region\" translate=\"no\"\u003eREGION\u003c/var\u003e \\\n --release=\u003cvar label=\"release name\" translate=\"no\"\u003eRELEASE_NAME\u003c/var\u003e\n\n The command for rejecting the rollout is as follows: \n\n gcloud deploy rollouts reject \u003cvar label=\"rollout\" translate=\"no\"\u003e\u003cspan class=\"devsite-syntax-n\"\u003eROLLOUT\u003c/span\u003e\u003c/var\u003e \\\n --delivery-pipeline=\u003cvar label=\"pipeline name\" translate=\"no\"\u003e\u003cspan class=\"devsite-syntax-n\"\u003ePIPELINE_NAME\u003c/span\u003e\u003c/var\u003e \\\n --region=\u003cvar label=\"region\" translate=\"no\"\u003e\u003cspan class=\"devsite-syntax-n\"\u003eREGION\u003c/span\u003e\u003c/var\u003e \\\n --release=\u003cvar label=\"release name\" translate=\"no\"\u003e\u003cspan class=\"devsite-syntax-n\"\u003eRELEASE_NAME\u003c/span\u003e\u003c/var\u003e\n\n where:\n - \u003cvar label=\"rollout\" translate=\"no\"\u003eROLLOUT\u003c/var\u003e\n\n is the name of the rollout for which approval was requested.\n - \u003cvar label=\"pipeline name\" translate=\"no\"\u003ePIPELINE_NAME\u003c/var\u003e\n\n is the delivery pipeline managing deployment of your application.\n - \u003cvar label=\"release name\" translate=\"no\"\u003eRELEASE_NAME\u003c/var\u003e\n\n is the name of the release with which this rollout is associated.\n - \u003cvar label=\"region\" translate=\"no\"\u003eREGION\u003c/var\u003e\n\n is the region in which the delivery pipeline is running.\n\nHere's an example:\n\n`gcloud deploy rollouts approve test-rollout --delivery-pipeline=web-app --release=test-release --region=us-central1`"]]